TelephonyManager tm = (TelephonyManager)cxt.getSystemService(Context.TELEPHONY_SERVICE);
StringBuilder sb = new StringBuilder();
sb.append("\nDeviceId(IMEI) = " + tm.getDeviceId());
sb.append("\nDeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion());
sb.append("\nLine1Number = " + tm.getLine1Number());
sb.append("\nNetworkCountryIso = " + tm.getNetworkCountryIso());
sb.append("\nNetworkOperator = " + tm.getNetworkOperator());
sb.append("\nNetworkOperatorName = " + tm.getNetworkOperatorName());
sb.append("\nNetworkType = " + tm.getNetworkType());
sb.append("\nPhoneType = " + tm.getPhoneType());
sb.append("\nSimCountryIso = " + tm.getSimCountryIso());
sb.append("\nSimOperator = " + tm.getSimOperator());
sb.append("\nSimOperatorName = " + tm.getSimOperatorName());
sb.append("\nSimSerialNumber = " + tm.getSimSerialNumber());
sb.append("\nSimState = " + tm.getSimState());
sb.append("\nSubscriberId(IMSI) = " + tm.getSubscriberId());
sb.append("\nVoiceMailNumber = " + tm.getVoiceMailNumber());
return sb.toString();
04-01 16:20:57.105: I/System.out(952): 460003121934674
04-01 16:20:57.105: I/System.out(952): getProvidersName:中国移动
04-01 16:20:57.115: I/System.out(952): getNativePhoneNumber:136XXXXXXX
04-01 16:20:57.115: I/System.out(952): ------------------------
04-01 16:20:57.145: I/System.out(952): getPhoneInfo:
04-01 16:20:57.145: I/System.out(952): DeviceId(IMEI) = 352XXXXXXXX61328
04-01 16:20:57.145: I/System.out(952): DeviceSoftwareVersion = 01
04-01 16:20:57.145: I/System.out(952): Line1Number = 136XXXXXXX
04-01 16:20:57.145: I/System.out(952): NetworkCountryIso = cn
04-01 16:20:57.145: I/System.out(952): NetworkOperator = 46000
04-01 16:20:57.145: I/System.out(952): NetworkOperatorName = 中国移动
04-01 16:20:57.145: I/System.out(952): NetworkType = 2
04-01 16:20:57.145: I/System.out(952): PhoneType = 1
04-01 16:20:57.145: I/System.out(952): SimCountryIso = cn
04-01 16:20:57.145: I/System.out(952): SimOperator = 46000
04-01 16:20:57.145: I/System.out(952): SimOperatorName = CMCC
04-01 16:20:57.145: I/System.out(952): SimSerialNumber = 898xxxxxx90108
04-01 16:20:57.145: I/System.out(952): SimState = 5
04-01 16:20:57.145: I/System.out(952): SubscriberId(IMSI) = 46000xxxxxxxx4674
getNativePhoneNumber 获取的手机号
DeviceId(IMEI)手机 国际移动用户识别码
NetworkOperator 移动运营商编号
NetworkOperatorName 移动运营商名称
SimSerialNumber SimOperator SimCountryIso SimSerialNumber SubscriberId(IMSI) 关于手机SIM卡的一些详细信息
其实代码中没有写 获取System.ANDROID_ID这个操作,因为很多手机设备获取不到andnroid_id
当然了,我们今天主要讲述<uses-permission android:name="android.permission.READ_PHONE_STATE"/> 光使用这个权限我们可以获得的手机设备信息和手机号
如果想获得WIFI,蓝牙,GPS,读写SDCARD更多的信息,就需要添加其它的权限。