Ahmed Ali
Ahmed Ali

Reputation: 2668

Get Carrier name (Cellular Mobile Operator name) using Windows Phone 8.1

I want to get the carrier name for a Windows Phone 8.1 application. In Windows Phone 8 (Silverlight) I used to be able to get it using

string CarrierName = DeviceNetworkInformation.CellularMobileOperator;

but this method is no longer available in Windows Phone 8.1 (Runtime). Can anyone help?

Upvotes: 2

Views: 893

Answers (1)

meneses.pt
meneses.pt

Reputation: 2616

I have faced the same problem recently. The following code will give you the Carrier name but only if you have your data connection enabled. I coulnd't figure out another way.

var result = NetworkInformation.GetConnectionProfiles();
foreach (var connectionProfile in result)
{
    if (connectionProfile.IsWwanConnectionProfile)
    {
        foreach (var networkName in connectionProfile.GetNetworkNames())
        {
            ApplicationData.Current.LocalSettings.Values["carrier"] = networkName;
            return networkName;
        }
    }
}

Upvotes: 2

Related Questions