欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

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

程序员文章站 2024-02-05 22:55:34
复制代码 代码如下: stringbuilder phoneinfo = new stringbuilder(); phoneinfo.append("product: "...
复制代码 代码如下:

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" />