get Sim Serial Number - Android android.telephony

Android examples for android.telephony:Sim Card

Description

get Sim Serial Number

Demo Code

import android.content.Context;
import android.telephony.TelephonyManager;

public class Main {

  public static String getSimSN(Context context) {

    if (null == context) {
      return null;
    }//  w w w  .j  av  a2  s.c  o  m
    String simSN = null;
    try {
      TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
      simSN = tm.getSimSerialNumber();
    } catch (Exception e) {
    }
    return simSN;
  }

}

Related Tutorials