ARTICLE

Fetching Mobile Operator Name in Windows 7.1 Phone [Mango]

Posted by Dhananjay Kumar Articles | Windows Phone 8 June 10, 2011
Here you will see how to fetch the mobile operator's name in Windows 7.1 Phone.
Reader Level:

In this quick post I will show you

how to fetch the mobile operator's name in Windows 7.1 Phone.

Design the page

In the content Grid, I have put a button. On the click event of the button, in a message box the Mobile Operator Name we will be displayed:

MOperator1.gifMOperator1.gif

Write Code Behind

Add the namespace:

MOperator2.gif

On the click event of the button we will fetch the operator name. Operator name can be fetched by:


MOperator3.gif

Using the CellularMobileOperator() function of DeviceNetworkInformation. After fetching, you can convert it to a string.

For your reference the source code is as below:

MainPage.Xaml.cs

using System.Windows;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Net.NetworkInformation;
 
 
namespace MobileOperatorName
{
    public partial class MainPage : PhoneApplicationPage
    {
 
        public MainPage()
        {
            InitializeComponent();
            btnMobileOpeartor.Click += new RoutedEventHandler(btnMobileOpeartor_Click);
        }
 
        void btnMobileOpeartor_Click(object sender, RoutedEventArgs e)
        {
            string operatorName = "Mobile Opeartor : ";
            operatorName = operatorName + DeviceNetworkInformation.CellularMobileOperator.ToString();
            MessageBox.Show(operatorName);
        } 
    }
}


Running the Application

Press F5 to run the application.

MOperator4.gif

I hope this post was useful. Thanks for reading.

Login to add your contents and source code to this article
post comment
     
COMMENT USING
PREMIUM SPONSORS
DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and add new content to existing PDF documents from within your applications.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter