Check if Sim Card is Available - Android android.telephony

Android examples for android.telephony:Sim Card

Description

Check if Sim Card is Available

Demo Code

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

public class Main {

  public static boolean isCheckSimCardAvailable(Context context) {

    if (null == context) {
      return false;
    }//from w  w w  .  java  2s  .  c  om
    final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    return tm.getSimState() == TelephonyManager.SIM_STATE_READY;
  }

}

Related Tutorials