DeviceNetworkInformation.IsCellularDataEnabled always returns false

I recently installed Windows Phone 8.1 emulators to try some existing applications, and ran into this problem: DeviceNetworkInformation.IsCellularDataEnabled(in the namespace Microsoft.Phone.Net.NetworkInformation) always returns false.

public void UpdateDataEnabled()
{
    _dataEnabled = DeviceNetworkInformation.IsCellularDataEnabled 
        || DeviceNetworkInformation.IsWiFiEnabled;
}

DeviceNetworkInformation.IsCellularDataEnabled = false

I know that the connection really works, because I can still make HTTP requests. If I run the exact same code in 8.0.x emulators, I have no problem.

I also tried updating the project and all libraries to Windows Phone Silverlight 8.1 applications to make sure that this solves the problem and is not lucky. I checked all the features and ID_CAP_NETWORKING was also checked.

, Windows Phone 8.1 XAML, Windows 8. Silverlight.

, Windows Phone Silverlight Windows Phone 8.1. - ?

+4
2

, , verdesrobert Rishabh876. , , ,

    public bool IsNetworkAvailable()
    {
        if (DeviceNetworkInformation.IsNetworkAvailable)
        {
            if (Microsoft.Devices.Environment.DeviceType == DeviceType.Emulator)
            {
                return true;
            }
            else if ((DeviceNetworkInformation.IsWiFiEnabled || DeviceNetworkInformation.IsCellularDataEnabled) && NetworkInterface.NetworkInterfaceType != NetworkInterfaceType.None)
            {
                return true;
            }
        }
        return false;
    }

, , - , .

+2

, WP8.1 WP8.1.
, 7.1 WP8.1.

+1

Source: https://habr.com/ru/post/1536377/


All Articles