Mobile Network Connection Detection
-
17 марта 2012 г. 0:25
I used the following code to detect network connection:
function isConnected() { var networkInfo = Windows.Networking.Connectivity.NetworkInformation; var internetProfile = networkInfo.getInternetConnectionProfile(); if (internetProfile && internetProfile.getNetworkConnectivityLevel() === Windows.Networking.Connectivity.NetworkConnectivityLevel.internetAccess) { return true; } else { return false; } }
It works fine with wi-fi and wired network and also Sprint 4G. However, it doesn't work with my Sprint 3G USB modem.
networkInfo.getInternetConnectionProfile() returns null.
How can I do this right?
Thanks
Louis
Все ответы
-
19 марта 2012 г. 6:13Модератор
Hi,
There are some known issues about this API in current CP. The issue you mentioned looks like a bug. I've reported this issue internally. Thanks for the report.
Allen Chen [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- Изменено Allen Chen - MSFTModerator 19 марта 2012 г. 6:13
- Помечено в качестве ответа Louis_PiG 19 марта 2012 г. 15:04

