Отвечено 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



    • Изменено Louis_PiG 17 марта 2012 г. 0:26
    • Изменено Louis_PiG 17 марта 2012 г. 18:59
    •  

Все ответы