- 获取电话信息的代码如下所示:
Build bd = new Build();
String model = bd.MODEL;
System.out.println("MODEL= " + model);
/**
* getDeviceId
*getImei
* getDeviceSvn
* getSubscriberId
* getIccSerialNumber
* getLine1Number
* getLine1AlphaTag
* getVoiceMailAlphaTag
*/
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
StringBuilder sb = new StringBuilder();
//获取唯一设备ID
sb.append("\nDeviceId(IMEI) = " + tm.getDeviceId());
//获取手机方位
// sb.append("\nPhoneLocation = " + tm.getCellLocation().toString());
//获取设备的软件版本
sb.append("\nDeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion());
//获取电话号码
sb.append("\nLine1Number = " + tm.getLine1Number());
//获取ISO标准的国家码
// sb.append("\nNetworkCountryIso = " + tm.getNetworkCountryIso());
//(mobile contry code) + (mobile network code)
// sb.append("\nNetworkOperator = " + tm.getNetworkOperator());
// sb.append("\nNetworkOperatorName = " + tm.getNetworkOperatorName());
//当前使用的网络类型
// sb.append("\nNetworkType = " + tm.getNetworkType());
//手机类型,如
/**
* PHONE_TYPE_NONE 无信号
* PHONE_TYPE_GSM gsm信号
* PHONE_TYPE_CDMA CDMA信号
*/
// sb.append("\nPhoneType = " + tm.getPhoneType());
//获取ISO国家码
// sb.append("\nSimCountryIso = " + tm.getSimCountryIso());
//获取SIM卡提供的移动国家码和移动网络码.5或6位的十进制数字
// sb.append("\nSimOperator = " + tm.getSimOperator());
//服务商名称,例如:中国移动、联通
// sb.append("\nSimOperatorName = " + tm.getSimOperatorName());
//SIM卡的序列号
//需要权限:READ_PHONE_STATE
sb.append("\nSimSerialNumber = " + tm.getSimSerialNumber());
//SIM卡的序列号
sb.append("\nSimState = " + tm.getSimState());
//唯一的用户ID:
// 例如:IMSI(国际移动用户识别码) for a GSM phone.
//需要权限:READ_PHONE_STATE
sb.append("\nSubscriberId(IMSI) = " + tm.getSubscriberId());
// 取得和语音邮件相关的标签,即为识别符
// 需要权限:READ_PHONE_STATE
sb.append("\nSubscriberId(IMSI) = " + tm.getVoiceMailAlphaTag());
//获取语音邮件号码:
//需要权限:READ_PHONE_STATE
// sb.append("\nVoiceMailNumber = " + tm.getVoiceMailNumber());
System.out.println(sb.toString());
-
/home/wdy/Android-5.0/android/packages/services/Telephony/src/com/android/phone/PhoneInterfaceManager.java实现 ITelephony.Stub;
/home/wdy/Android-5.0/android/frameworks/base/telephony/java/android/telephony/TelephonyManager.java
3.