打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
Android编程获取手机型号,本机电话号码,sdk版本及firmware版本号(即系统版本号)
Android编程获取手机型号,本机电话号码,sdk版本及firmware版本号(即系统版本号)
Android开发平台中,可通过TelephonyManager 获取本机号码。
TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
txtPhoneNumber.setText(phoneMgr.getLine1Number()); //txtPhoneNumber是一个EditText 用于显示手机号
注:
根据Android的安全机制,在使用TelephonyManager时,必须在AndroidManifest.xml中添加<uses-permission android:name="READ_PHONE_STATE" /> 否则无法获得系统的许可。
手机型号 Build.MODEL
StringMODELThe end-user-visible name for the end product.
sdk版本 Build.VERSION.SDK
StringSDKThis constant is deprecated. Use SDK_INT to easily get this as an integer.
及frimware版本号(系统版本号) Build.VERSION.RELEASE
StringRELEASEThe user-visible version string.
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.
StringUSER
最近在做韩国一家公司的Android平台软件开发,我的手机号是韩国的啦。所以看到010打头的号码,别太惊讶..
我的联系方式:
http://www.mobiletuts.me
mobiletuts.me#gmail.com (replace #with @)
手头做的项目涉及到Android平台中网络设置,数据库,http协议下的数据传输,支付系统,以及SNS API(twitter, facebook, me2day, etc), QR码扫描等模块。
如果大家感兴趣的话,我会在开发闲暇时间陆续将常用的一些模块的开发调用,写成独立,简洁的教程发上来。
标签:Android,Phone State
绿色通道:与我联系
Android开发周刊
关注 - 0
粉丝 - 39
8
0
(请您对文章做出评价)
上一篇:Android根据Button状态(normal,focused,pressed)显示不同背景图片
下一篇:Android编程获取网络连接状态(3G/Wifi)及调用网络配置界面
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
android.os包中一些类的使用
android 获取手机网络状态
编译android sdk 遇到的问题
Android获取IME,IMSI等各种手机信息,并对号码组成详解
Android 直播打断事件处理
Windows 8最新Build版本号更新至8328
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服