开发时你是否想要获取手机的信息以此完成某种判定与功能?这里我分享一下我所知道的相关知识
1、获取手机的Android_ID
String androidId = Secure.getString(
context.getContentResolver(), Secure.ANDROID_ID)
下面的信息获取中需要用到系统的TelephonyManager对象
// 获取系统的TelephonyManager对象
TelephonyManager tManager = (TelephonyManager)
getSystemService(Context.TELEPHONY_SERVICE);2、设备编号(国际移动电话设备识别码)IMEI
tManager.getDeviceId();
3、国际移动用户识别码IMSI
//IMSI共有15位,其结构如下:
//MCC+MNC+MIN
//MCC:Mobile Country Code,移动国家码,共3位,中国为460;
//MNC:Mobile NetworkCode,移动网络码,共2位//在中国,移动的代码为电00和02,联通的代码为01,电信的代码为03
//中国移动:46000 46002
//中国联通:46001
//中国电信:46003
tManager.getSubscriberId();4、获取系统平台的版本
tManager.getDeviceSoftwareVersion();5、获取网络运营商代号
tManager.getNetworkOperator();6、获取网络运营商名称
tManager.getNetworkOperatorName();7、获取手机网络类型
PHONE_TYPE_NONE
PHONE_TYPE_GSM
PHONE_TYPE_CDMA
PHONE_TYPE_SIP
tManager.getPhoneType();8、获取设备所在位置
tManager.getCellLocation();9、获取SIM卡的国别 cn代表中国
tManager.getSimCountryIso();10、获取SIM卡状态
SIM_STATE_UNKNOWN
SIM_STATE_ABSENT
SIM_STATE_PIN_REQUIRED
SIM_STATE_PUK_REQUIRED
SIM_STATE_NETWORK_LOCKED
SIM_STATE_READY
分别对应:
<item>状态未知</item>
<item>无SIM卡</item>
<item>被PIN加锁</item>
<item>被PUK加锁</item>
<item>被NetWork PIN加锁</item>
<item>已准备好</item>
tManager.getSimState();11、 获取SIM卡序列号
tManager.getSimSerialNumber();
本文介绍了如何通过Android系统API获取手机的基本信息,包括Android_ID、IMEI、IMSI等标识符,以及SIM卡状态、运营商信息、网络类型等实用数据。
683

被折叠的 条评论
为什么被折叠?



