is Can Use Sim - Android android.telephony

Android examples for android.telephony:Sim Card

Description

is Can Use Sim

Demo Code

import android.app.Activity;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.os.Build;
import android.os.Environment;
import android.os.Vibrator;
import android.telephony.TelephonyManager;

public class Main{

    public static boolean isCanUseSim(Context context) {
        try {/* w  w w  . j a  v a2 s .  co m*/
            TelephonyManager mgr = (TelephonyManager) context
                    .getSystemService(Context.TELEPHONY_SERVICE);

            return TelephonyManager.SIM_STATE_READY == mgr.getSimState();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return false;
    }

}

Related Tutorials