/**
* 判断是否包含SIM卡
*
* @return 状态
*/
public static boolean hasSimCard(Context context) {
TelephonyManager telMgr = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
int simState = telMgr.getSimState();
boolean result = true;
switch (simState) {
case TelephonyManager.SIM_STATE_ABSENT:
result = false; // 没有SIM卡
break;
case TelephonyManager.SIM_STATE_UNKNOWN:
result = false;
break;
}
if (result) {
Log.d(TAG, "iccid: " + telMgr.getSimSerialNumber());
}
return result;
}
判断是否包含SIM卡
最新推荐文章于 2019-04-18 12:56:00 发布