Code example for TelephonyManager

Methods: getSimState

0
        
        try { 
             
            final TelephonyManager telephonyManager = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);
             
            return telephonyManager.getSimState();  
             
        } catch (final Exception e) {
            LogUtils.logE("SimCard.getState() - Exception:", e);
        } 
         
        return TelephonyManager.SIM_STATE_UNKNOWN;
    } 
     
    /** 
     * Tells whether or not the SIM card is present. 
     *  
     * @param context the  
     * @return true if the SIM is ready, false otherwise (not ready or absent) 
     */