Android 编程获取手机型号,本机电话号码,sdk版本及firmware版本“.NET研究”号(即系统版本号)
2011-10-20 21:57 狼人:-) 阅读(203) 评论(0) 编辑 收藏 举报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
sdk版本 Build.VERSION.SDK
及frimware版本号(系统版本号) Build.VERSION.RELEASE
private void loadPhoneStatus()
{
TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);
txtPhoneModel.setText(Build.MODEL); //手机型号
txtPhoneNumber.setText(phoneMgr.getLine1Number());//本机电话号码
txtSdkVersion.setText(Build.VERSION.SDK);上海网站建设n style="color: #008000;">//SDK版本号
txtOsVersion.setText(Build.VERSION.RELEASE);//Firmware/OS 版本号
}
事实上,Build能向我们提供包括 硬件厂商,硬件编号,序列号等很多信息 调用方法也都同上,很简单。
String | BOARD | The name of the underlying board, like "goldfish". |
String | BOOTLOADER | The system bootloader version number. |
String | BRAND | The brand (e.g., carrier) the software is customized for, if any. |
String | CPU_ABI | The name of the instruction set (CPU type + ABI convention) of native code. |
String | CPU_ABI2 | The name of the second instruction set (CPU type + ABI convention) of native code. |
String | DEVICE | The name of the industrial design. |
String | DISPLAY | A build ID string meant for displaying to the user |
String | FINGERPRINT | A string that uniquely identifies this build. |
String | HARDWARE上海闵行企业网站制作d> | The name of the hardware (from the kernel command line or /proc). |
String | HOST | |
String | ID | Either a changelist number, or a label like "M4-rc20". |
String | MANUFACTURER | The manufacturer of the product/hardware. |
String | MODEL | The end-user-visible name for the end product. |
String | PRODUCT | The name of the overall product. |
String | RADIO | The radio firmware version number. |
String | SERIAL | A hardware serial number, if available. |
String | TAGS | Comma-separated tags describing the build, like "unsigned,debug". |
long | TIME | |
String | TYPE | The type of build, like "user" or "eng". |
String | UNKNOWN | Value used for when a build property is unknown. |
String | USER |
最近在做韩国一家公司的Android平台软件开发,我的手机号是韩国的啦。所以看到010打头的号码,别太惊讶..
我的twitter: @mainroadlee
手头做的项目涉及到Android平台中网络设置,数据库,http协议下的数据传输,支付系统,以及SNS API(twitter, facebook, me2day, etc), QR码扫描等模块。
如果大家感兴趣的话,我会在开发闲暇时间陆续将常用的一些模块的开发调用,写成独立,简洁的教程发上来。
声明:此博有部分内容为转载,版权归原作者所有~
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· SQL Server 2025 AI相关能力初探
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南