I currently am porting one of my libraries to Windows Phone 8.1 Runtime and stepped into a missing API which you can use in Windows Phone 8.0 and Windows Phone Silverlight 8.1 apps.
What I need is the DeviceNetworkInformation to get with what kind of NetworkInterfaceType is the device connected to the internet.
Sample code in Windows Phone 8.0.
public void GetDeviceConnectionInfo()
{
DeviceNetworkInformation.ResolveHostNameAsync(new DnsEndPoint("microsoft.com", 80),
nrr =>
{
NetworkInterfaceInfo info = nrr.NetworkInterface;
if (info != null)
{
switch (info.InterfaceType)
{
case NetworkInterfaceType.Ethernet:
// Do something
break;
case NetworkInterfaceType.MobileBroadbandCdma:
case NetworkInterfaceType.MobileBroadbandGsm:
switch (info.InterfaceSubtype)
{
case NetworkInterfaceSubType.Cellular_3G:
case NetworkInterfaceSubType.Cellular_EVDO:
case NetworkInterfaceSubType.Cellular_EVDV:
case NetworkInterfaceSubType.Cellular_HSPA:
// Do something
break;
}
// Do something
break;
case NetworkInterfaceType.Wireless80211:
// Do something
break;
}
}
}, null);
}
And you could access the carrier's name with DeviceNetworkInformation.CellularMobileOperator
.