读取SIM卡信息
public String readSIMCard() { TelephonyManager tm = (TelephonyManager)this.getSystemService(TELEPHONY_SERVICE);//取得相关系统服务 StringBuffer sb = new StringBuffer(); switch(tm.getSimState()){ //getSimState()取得sim的状态 有下面6中状态 case TelephonyManager.SIM_STATE_ABSENT :sb.append("无卡");break; case TelephonyManager.SIM_STATE_UNKNOWN :sb.append("未知状态");break; case TelephonyManager.SIM_STATE_NETWORK_LOCKED :sb.append("需要NetworkPIN解锁");break; case TelephonyManager.SIM_STATE_PIN_REQUIRED :sb.append("需要PIN解锁");break; case TelephonyManager.SIM_STATE_PUK_REQUIRED :sb.append("需要PUK解锁");break; case TelephonyManager.SIM_STATE_READY :sb.append("良好");break; } if(tm.getSimSerialNumber()!=null){ sb.append("@" + tm.getSimSerialNumber().toString()); }else{ sb.append("@无法取得SIM卡号"); } if(tm.getSimOperator().equals("")){ sb.append("@无法取得供货商代码"); }else{ sb.append("@" + tm.getSimOperator().toString()); } if(tm.getSimOperatorName().equals("")){ sb.append("@无法取得供货商"); }else{ sb.append("@" + tm.getSimOperatorName().toString()); } if(tm.getSimCountryIso().equals("")){ sb.append("@无法取得国籍"); }else{ sb.append("@" + tm.getSimCountryIso().toString()); } if (tm.getNetworkOperator().equals("")) { sb.append("@无法取得网络运营商"); } else { sb.append("@" + tm.getNetworkOperator()); } if (tm.getNetworkOperatorName().equals("")) { sb.append("@无法取得网络运营商名称"); } else { sb.append("@" + tm.getNetworkOperatorName()); } if (tm.getNetworkType() == 0) { sb.append("@无法取得网络类型"); } else { sb.append("@" + tm.getNetworkType()); } return sb.toString(); }
相关推荐
拓网科技 2020-11-23
85433664 2020-11-17
拓网科技 2020-11-13
mspgqrs 2020-10-19
xiaotutu0000 2020-10-15
虞凌云 2020-09-28
lifan0 2020-09-25
移动互联技术酒歌 2020-09-18
何砝 2020-09-16
anyvip 2020-09-15
zrhCSDN 2020-09-11
网站运营学堂 2020-08-27
SanBa 2020-08-14
hiarxiaoliang 2020-08-05
虞凌云 2020-07-29
程序员说书 2020-07-08
dm00 2020-06-28
bbf00 2020-06-28
herogood 2020-06-21