android 获取sim卡,Android 获取手机SIM卡运营商
直接上代碼:
/**
* 獲取SIM卡運(yùn)營(yíng)商
*
* @param context
* @return
*/
public static String getOperators(Context context) {
TelephonyManager tm = (TelephonyManager) context
.getSystemService(Context.TELEPHONY_SERVICE);
String operator = null;
String IMSI = tm.getSubscriberId();
if (IMSI == null || IMSI.equals("")) {
return operator;
}
if (IMSI.startsWith("46000") || IMSI.startsWith("46002")) {
operator = "中國(guó)移動(dòng)";
} else if (IMSI.startsWith("46001")) {
operator = "中國(guó)聯(lián)通";
} else if (IMSI.startsWith("46003")) {
operator = "中國(guó)電信";
}
return operator;
}
/**
* 手機(jī)型號(hào)
*
* @return
*/
public static String getPhoneModel() {
return android.os.Build.MODEL;
}
/**
* 系統(tǒng)版本號(hào)
*
* @return
*/
public static String getSystemVersion() {
return android.os.Build.VERSION.RELEASE;
}權(quán)限:
總結(jié)
以上是生活随笔為你收集整理的android 获取sim卡,Android 获取手机SIM卡运营商的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 旅行青蛙三种死亡结局 旅行的意义是什么
- 下一篇: Android内部存储与外部存储解析