服务器之家

服务器之家 > 正文

Android获取手机配置信息具体实现代码

时间:2021-01-30 14:48     来源/作者:Android开发网

复制代码 代码如下:


StringBuilder phoneInfo = new StringBuilder();
phoneInfo.append("Product: " + android.os.Build.PRODUCT + System.getProperty("line.separator"));
phoneInfo.append( "CPU_ABI: " + android.os.Build.CPU_ABI + System.getProperty("line.separator"));
phoneInfo.append( "TAGS: " + android.os.Build.TAGS + System.getProperty("line.separator"));
phoneInfo.append( "VERSION_CODES.BASE: " + android.os.Build.VERSION_CODES.BASE + System.getProperty("line.separator"));
phoneInfo.append( "MODEL: " + android.os.Build.MODEL + System.getProperty("line.separator"));
phoneInfo.append( "SDK: " + android.os.Build.VERSION.SDK + System.getProperty("line.separator"));
phoneInfo.append( "VERSION.RELEASE: " + android.os.Build.VERSION.RELEASE + System.getProperty("line.separator"));
phoneInfo.append( "DEVICE: " + android.os.Build.DEVICE + System.getProperty("line.separator"));
phoneInfo.append( "DISPLAY: " + android.os.Build.DISPLAY + System.getProperty("line.separator"));
phoneInfo.append( "BRAND: " + android.os.Build.BRAND + System.getProperty("line.separator"));
phoneInfo.append( "BOARD: " + android.os.Build.BOARD + System.getProperty("line.separator"));
phoneInfo.append( "FINGERPRINT: " + android.os.Build.FINGERPRINT + System.getProperty("line.separator"));
phoneInfo.append( "ID: " + android.os.Build.ID + System.getProperty("line.separator"));
phoneInfo.append( "MANUFACTURER: " + android.os.Build.MANUFACTURER + System.getProperty("line.separator"));
phoneInfo.append( "USER: " + android.os.Build.USER + System.getProperty("line.separator"));
TelephonyManager tm = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE);
phoneInfo.append("DeviceId(IMEI) = " + tm.getDeviceId() + System.getProperty("line.separator"));
phoneInfo.append("DeviceSoftwareVersion = " + tm.getDeviceSoftwareVersion() + System.getProperty("line.separator"));
phoneInfo.append("Line1Number = " + tm.getLine1Number() + System.getProperty("line.separator"));
phoneInfo.append("NetworkCountryIso = " + tm.getNetworkCountryIso() + System.getProperty("line.separator"));
phoneInfo.append("NetworkOperator = " + tm.getNetworkOperator() + System.getProperty("line.separator"));
phoneInfo.append("NetworkOperatorName = " + tm.getNetworkOperatorName() + System.getProperty("line.separator"));
phoneInfo.append("NetworkType = " + tm.getNetworkType() + System.getProperty("line.separator"));
phoneInfo.append("PhoneType = " + tm.getPhoneType() + System.getProperty("line.separator"));
phoneInfo.append("SimCountryIso = " + tm.getSimCountryIso() + System.getProperty("line.separator"));
phoneInfo.append("SimOperator = " + tm.getSimOperator() + System.getProperty("line.separator"));
phoneInfo.append("SimOperatorName = " + tm.getSimOperatorName() + System.getProperty("line.separator"));
phoneInfo.append("SimSerialNumber = " + tm.getSimSerialNumber() + System.getProperty("line.separator"));
phoneInfo.append("SimState = " + tm.getSimState() + System.getProperty("line.separator"));
phoneInfo.append("SubscriberId(IMSI) = " + tm.getSubscriberId() + System.getProperty("line.separator"));
phoneInfo.append("VoiceMailNumber = " + tm.getVoiceMailNumber() + System.getProperty("line.separator"));


记得加权限:

复制代码 代码如下:


<uses-permission android:name="android.permission.READ_PHONE_STATE" />

相关文章

热门资讯

2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全
2020微信伤感网名听哭了 让对方看到心疼的伤感网名大全 2019-12-26
Intellij idea2020永久破解,亲测可用!!!
Intellij idea2020永久破解,亲测可用!!! 2020-07-29
背刺什么意思 网络词语背刺是什么梗
背刺什么意思 网络词语背刺是什么梗 2020-05-22
苹果12mini价格表官网报价 iPhone12mini全版本价格汇总
苹果12mini价格表官网报价 iPhone12mini全版本价格汇总 2020-11-13
歪歪漫画vip账号共享2020_yy漫画免费账号密码共享
歪歪漫画vip账号共享2020_yy漫画免费账号密码共享 2020-04-07
返回顶部