How Fetch Sim Details of Windows Phone 8.1 using Visual Studio 2015 c#

239 Views Asked by At

**I need to get Carrier name of Sim.

I need to Fetch Sim Card Company Name.

I Need MCC and MNC of SIM**

I have created project for Windows Phone 8.1 in Visual Studio 2015.

I have also created UWP(Universal) project in Visual Studio 2015.

Please Help Me for fetching details of Windows Phone 8.1's and 10's Sim Card.

Please do not provide any help for windows phone 8.

I Need Only help for Windows phone 8.1 and 10.

1

There are 1 best solutions below

0
On

Unfortunately, these capabilities are only available to mobile operator apps or apps given special privilege from mobile operators. Please see the note below the code.

In Windows 10:

The API you are looking for is Windows.Networking.NetworkOperators.MobileBroadbandAccount

private string GetSubscriberId()
{
    MobileBroadbandAccount mbaAccount = null;
    var modem = MobileBroadbandModem.GetDefault();
    mbaAccount = modem.CurrentAccount;
    return mbaAccount.CurrentDeviceInformation.SimIccId;
}

Link to documentation: https://learn.microsoft.com/en-us/uwp/api/Windows.Networking.NetworkOperators.MobileBroadbandAccount

You will need to modify your Package.appxmanifest file like mentioned below (more info on restricted capabilities)

<Package
    xmlns="http://schemas.microsoft.com/appx/manifest/foundation/windows10"
    xmlns:mp="http://schemas.microsoft.com/appx/2014/phone/manifest"
    xmlns:uap="http://schemas.microsoft.com/appx/manifest/uap/windows10"
    xmlns:rescap="http://schemas.microsoft.com/appx/manifest/foundation/windows10/restrictedcapabilities"
    IgnorableNamespaces="uap mp wincap rescap">

    ....
    ....
    ....
    ....

    <Capabilities>
        <r:Capability Name="cellularDeviceIdentity" />
        <r:Capability Name="cellularDeviceControl" />
        <r:Capability Name="cellularMessaging" />
    </Capabilities>
</Package>

NOTE: If your application targets Windows 10, this should not be a problem if you are going to side load the application. As you can install any app which requires special privilege once you enable Developer Mode or Sideloading on your device from settings.

In case the access is critical to you application and you want to publish it to Windows Store you can try contacting Microsoft to give your account required special privilege.

In Windows Phone 8.1:

As mentioned above the capability is restricted and the API for WP8.1 and below are only shared with mobile partners and you can't sideload or publish these applications until and unless you have been given special access by Microsoft.