Android开发平台中,可通过TelephonyManager 获取本机号码。

                                TelephonyManager phoneMgr                =                (TelephonyManager)                this                .getSystemService(Context.TELEPHONY_SERVICE);
txtPhoneNumber.setText(phoneMgr.getLine1Number());
// txtPhoneNumber是一个EditText 用于显示手机号

  注:根据Android的安全机制,在使用TelephonyManager时,必须在AndroidManifest.xml中添加 否则无法获得系统的许可。

  手机型号 Build.MODEL

String MODEL The end-user-visible name for the end product.

  sdk版本 Build.VERSION.SDK

String SDK This constant is deprecated. Use SDK_INT to easily get this as an integer.

  及frimware版本号(系统版本号) Build.VERSION.RELEASE

String RELEASE The 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能向我们提供包括 硬件厂商,硬件编号,序列号等很多信息 调用方法也都同上,很简单。

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 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打头的号码,别太惊讶..

Android 编程获取手机型号,本机电话号码,sdk版本及firmware版本号(即系统版本号)_第1张图片

  我的twitter: @mainroadlee 

  手头做的项目涉及到Android平台中网络设置,数据库,http协议下的数据传输,支付系统,以及SNS API(twitter, facebook, me2day, etc), QR码扫描等模块。

  如果大家感兴趣的话,我会在开发闲暇时间陆续将常用的一些模块的开发调用,写成独立,简洁的教程发上来。

更多相关文章

  1. Android 获取系统信息(手机品牌、型号、安卓版本号等等)
  2. Android最新的各个分支版本号(2013-10-27)
  3. Mac通过Android aapt解析apk包名、版本号、权限等信息
  4. Android SDK目录及版本号区别

随机推荐

  1. Android(安卓)中级教程之------Android(
  2. Android基础 | 控件基础 | ImageView用法
  3. 用 Golang 开发 Android(安卓)应用(六)——
  4. Android(安卓)中的数据库 SQLite
  5. android 局域网聊天工具(可发送文字/语音
  6. 长按power键Android9.0关机耗时分析
  7. Android内核的简单分析
  8. android Instrumentation
  9. Android:Android学习路线图
  10. Android开发之旅:android架构