在Android的主Activity的初始化函数中添加:
TelephonyManager tm = (TelephonyManager) this
.getSystemService(TELEPHONY_SERVICE);
SubscriberId = tm.getSubscriberId();
if (SubscriberId != null && SubscriberId != "null") {
if (SubscriberId.startsWith("46001")) {
// 联通
} else if (SubscriberId.startsWith("46003")) {
// 电信
} else {
// 移动
}
}
时间: 2024-08-14 20:36:20