Andriod 要获得机型信息,需要得到授权。
对于模拟器,就是配置AndroidManifest.xml 文件
加入
Xml代码
<!-- 获取机型信息 -->
<uses-permission
android:name="android.permission.READ_PHONE_STATE" />
试试以下代码,你可以获得机型信息。
Java代码
TelephonyManager tm = (TelephonyManager) 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());
Log.d("info", sb.toString());
在Android中以上机型信息在手机状态Status里
Settings->About Phone->Status
各个栏目的功能介绍如下:
Battery status:电池充电/未充电状态
Battery level:电池剩余电量
Phone number:手机序列号
Network:所处的移动网络
Signal strength:信号度
Network type:网络制式
Service state:所在服务区
Roaming:漫游/未漫游
Data access:共访问的数据大小
IMEI:IMEI码
IMEI SV:IMEI码的版本
IMSI:国际移动用户识别码
Wi-Fi Mac address:G1无线Wi-Fi网络的Mac地址。
Bluetooth address:蓝牙地址
Up time:正常运行时间
Awake Time:手机唤醒时间