[代码]Android编程获取手机型号,本机电话号码等系统信息

TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
txtPhoneNumber.setText(phoneMgr.getLine1Number()); //用于显示手机号
//根据Android的安全机制,在使用TelephonyManager时
//必须在AndroidManifest.xml中添加<uses-permission android:name="READ_PHONE_STATE" /> 否则无法获得系统的许可。
private void loadPhoneStatus()
{
  TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
  txtPhoneModel.setText(Build.MODEL); //手机型号
  txtPhoneNumber.setText(phoneMgr.getLine1Number());//本机电话号码
  txtSdkVersion.setText(Build.VERSION.SDK);//SDK版本号
  txtOsVersion.setText(Build.VERSION.RELEASE);//Firmware/OS 版本号
}

事实上,Build能向我们提供包括 硬件厂商,硬件编号,序列号等很多信息 调用方法也都同上,很简单。

StringBOARDThe name of the underlying board, like "goldfish".
StringBOOTLOADERThe system bootloader version number.
StringBRANDThe brand (e.g., carrier) the software is customized for, if any.
StringCPU_ABIThe name of the instruction set (CPU type + ABI convention) of native code.
StringCPU_ABI2The name of the second instruction set (CPU type + ABI convention) of native code.
StringDEVICEThe name of the industrial design.
StringDISPLAYA build ID string meant for displaying to the user
StringFINGERPRINTA string that uniquely identifies this build.
StringHARDWAREThe name of the hardware (from the kernel command line or /proc).
StringHOST 
StringIDEither a changelist number, or a label like "M4-rc20".
StringMANUFACTURERThe manufacturer of the product/hardware.
StringMODELThe end-user-visible name for the end product.
StringPRODUCTThe name of the overall product.
StringRADIOThe radio firmware version number.
StringSERIALA hardware serial number, if available.
StringTAGSComma-separated tags describing the build, like "unsigned,debug".
longTIME 
StringTYPEThe type of build, like "user" or "eng".
StringUNKNOWNValue used for when a build property is unknown.

转载于:https://www.cnblogs.com/jriven/archive/2012/06/13/2547464.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值