List of usage examples for android.telephony TelephonyManager getSimState
public int getSimState()
From source file:Main.java
public static int getSimState(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return tm.getSimState(); }
From source file:Main.java
public static boolean isSIMPresent(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (tm.getSimState() == TelephonyManager.SIM_STATE_ABSENT) { return false; } else/*from w w w. j ava2s .com*/ return true; }
From source file:Main.java
public static boolean canMakeCall(Context ctx) { TelephonyManager manager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); return manager.getSimState() == TelephonyManager.SIM_STATE_READY && (manager.getPhoneType() == TelephonyManager.PHONE_TYPE_GSM || manager.getPhoneType() == TelephonyManager.PHONE_TYPE_CDMA); }
From source file:Main.java
public static boolean isCheckSimCardAvailable(Context context) { final TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (tm.getSimState() != TelephonyManager.SIM_STATE_READY) { return false; }//from w w w . ja v a 2s.c om return true; }
From source file:Main.java
public static boolean isTelephonyEnabled(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(context.TELEPHONY_SERVICE); return tm != null && tm.getSimState() == TelephonyManager.SIM_STATE_READY; }
From source file:Main.java
/** * * @param context/*from w w w . j av a2s . co m*/ * @return bool, true se c'e il modulo telefonico oppure se la sim e attiva */ public static boolean isTelephonyEnabled(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); return tm != null && tm.getSimState() == TelephonyManager.SIM_STATE_READY; }
From source file:Main.java
public static String getOperater(Context context) { TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); if (tm == null || 5 != tm.getSimState()) { return ""; }/* ww w . j ava 2s .c o m*/ return tm.getSimOperator(); }
From source file:Main.java
public static String getMNC(Context ctx) { String providersName = ""; TelephonyManager telephonyManager = (TelephonyManager) ctx.getSystemService(Context.TELEPHONY_SERVICE); if (telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY) { providersName = telephonyManager.getSimOperator(); providersName = providersName == null ? "" : providersName; }//from w w w . j av a 2 s. c o m return providersName; }
From source file:Main.java
public static boolean isSimUsable(final Context context) { TelephonyManager telephonyManager1 = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE); int simState = telephonyManager1.getSimState(); switch (simState) { case TelephonyManager.SIM_STATE_READY: return true; }//from w w w .j av a2 s. co m return false; }
From source file:Main.java
private static boolean isTelephonyEnabled(Activity activity) { TelephonyManager telephonyManager = (TelephonyManager) activity .getSystemService(Activity.TELEPHONY_SERVICE); return telephonyManager != null && telephonyManager.getSimState() == TelephonyManager.SIM_STATE_READY; }