Over a million developers have joined DZone.

How-To: Get Mobile Operator details in Windows Phone

DZone 's Guide to

How-To: Get Mobile Operator details in Windows Phone

· Mobile Zone ·
Free Resource

In this tutorial we are going to see how we can get the mobile operator details in Windows Phone Application development. In order to get the mobile operator information we are going to use the API class which is DeviceNetworkInformation class. This class has information on the network details of the specific device from which its called. Since this class is static we can directly make use of this class without creating any instance of the same, by using some of the properties that are available by default.

DeviceNetworkInformation Class has some list of properties by default using which we can collect the information of the specified device which will be very used for system monitoring. Below is the list of properties that can be used to get the details

So we are going to make use of these properties to check the availability of the network and play around with the properties one by one. To start with Open Visual Studio 2010 IDE and create a new Silverlight for Windows Phone project with a valid project name as shown in the screen below. Once the project is created add some controls which are used to show the details of the network operations as shown in the screen below.


Now drag and drop few controls to the screen which are used to get the details of the network operator and other stuffs. Once we designed the screen to show the desired result our screen looks like below.


Now we need to write our code behind which basically takes the DeviceNetworkInformation class to get the required details one by one as shown in the code below. Before that we need to add the below using statement in order to make use of the DeviceNetworkInformation class properties.

using Microsoft.Phone.Net.NetworkInformation;

Now add the below code sample which just calls the DeviceNetworkInformation class (we are not creating an instance of the class as its static) with the properties as shown in the code below.


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Net.NetworkInformation;

namespace F5debugHowto33
    public partial class MainPage : PhoneApplicationPage
        // Constructor
        public MainPage()

        private void button1_Click(object sender, RoutedEventArgs e)
            textBlock1.Text = "Mobile Operator :- " + DeviceNetworkInformation.CellularMobileOperator.ToString();
            textBlock2.Text = "Network Available :- " + DeviceNetworkInformation.IsNetworkAvailable.ToString();
            textBlock3.Text = "Roaming Available :- " + DeviceNetworkInformation.IsCellularDataRoamingEnabled.ToString();
            textBlock4.Text = "Wifi Available :- " + DeviceNetworkInformation.IsWiFiEnabled.ToString();
            textBlock5.Text = "Cellular Data Available :- " + DeviceNetworkInformation.IsCellularDataEnabled.ToString();


These are the basic properties which can be used in such a way to gather the information of the network mobile operator, say for example when there is a change in the operator and some notification need to be handled. In those cases we can use the NetworkAvailabilityChanged event to see if there is any change in the network operator.

Now we are done with our code, just run the application by pressing F5 directly from the keyboard or we can use the Build and execute the project option from the tool bar to run the application. Once the Build is successful we can see the Windows Phone emulator with the application and the expected outputs as shown in the screens below.

Output Screens:


So we have seen how to get the mobile operator details and the network details using the DeviceNetworkInformation class and also we have seen the event that is used to notify when there is any change in the network operator or the mobile operator. That’s it from this tutorial on Windows Phone see you all in the next tutorial soon. Mean while Happy Programming!!!s


Published at DZone with permission of

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}