SimInformation released


1 minute read - suggest an edit

SimInformation is a cross-platform library that provides a way to access the following information from your SIM card:

  • Integrated Circuit Card ID. (ICCID)
  • Mobile Country Code. (MCC)
  • International Mobile Subscriber Identity. (IMSI)
  • Mobile Station ID. (MSID)
  • Mobile Network Code. (MNC)
  • Mobile Subscriber International ISDN Number. (MSISDN)

Usage

The API is rather straight forward

var simInformation = new SimInformation();
IReadOnlyList<SimCard> simCards = simInformation.GetAllCards();

simCards[x].ICCID
simCards[x].MCC
simCards[x].IMSI
simCards[x].MSID
simCards[x].MNC
simCards[x].MSIDN

Instead of newing up the implementation each time you need it, register it into your IoC/DI container:

# example registration using splat
Locator.CurrentMutable.RegisterConstant(() => new SimInformation(), typeof(ISimInformation));

Then use it in your viewmodel or services as needed:

# example integration with reactiveui
public class MyCoolViewModel : ReactiveObject
{
    private readonly ISimInformation _simInformation;
    
    public MyCoolViewModel(ISimInformation simInformation = null)
    {
        _simInformation = simInformation ?? Locator.Current.GetService<ISimInformation>();
    }
}

Related Posts

ReactiveUI v7.2.0 released

Learn these three buttons

Announcing ReactiveUI virtual community meetups

ReactiveUI v7.1.0 released

ReactiveUI v7.0.0 released

Semantic Versioning of Xamarin Applications

Announcing Serilog.Sinks.Xamarin

Announcing Cake.Raygun

Announcing Cake.AppleSimulator

Example of Xamarin iOS with Cake