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

  1. TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);

  2. txtPhoneNumber.setText(phoneMgr.getLine1Number()); //txtPhoneNumber是一个EditText 用于显示手机号

注:根据Android的安全机制,在使用TelephonyManager时,必须在AndroidManifest.xml中添加<uses-permission android:name="READ_PHONE_STATE" /> 否则无法获得系统的许可。


  手机型号 Build.MODEL

  1. private void loadPhoneStatus(){

  2. TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE);

  3. txtPhoneModel.setText(Build.MODEL); //手机型号
  4. txtPhoneNumber.setText(phoneMgr.getLine1Number());//本机电话号码
  5. txtSdkVersion.setText(Build.VERSION.SDK);//SDK版本号
  6. txtOsVersion.setText(Build.VERSION.RELEASE);//Firmware/OS 版本号
  7. }

事实上,Build能向我们提供包括 硬件厂商,硬件编号,序列号等很多信息 调用方法也都同上,下面是Build中的API中定义。

publicstaticfinal String BOARD The name of the underlying board, like "goldfish".
publicstaticfinal String BOOTLOADER The system bootloader version number.
publicstaticfinal String BRAND The brand (e.g., carrier) the software is customized for, if any.
publicstaticfinal String CPU_ABI The name of the instruction set (CPU type + ABI convention) of native code.
publicstaticfinal String CPU_ABI2 The name of the second instruction set (CPU type + ABI convention) of native code.
publicstaticfinal String DEVICE The name of the industrial design.
publicstaticfinal String DISPLAY A build ID string meant for displaying to the user
publicstaticfinal String FINGERPRINT A string that uniquely identifies this build.
publicstaticfinal String HARDWARE The name of the hardware (from the kernel command line or /proc).
publicstaticfinal String HOST
publicstaticfinal String ID Either a changelist number, or a label like "M4-rc20".
publicstaticfinal String MANUFACTURER The manufacturer of the product/hardware.
publicstaticfinal String MODEL The end-user-visible name for the end product.
publicstaticfinal String PRODUCT The name of the overall product.
publicstaticfinal String RADIO The radio firmware version number.
publicstaticfinal String SERIAL A hardware serial number, if available.
publicstaticfinal String TAGS Comma-separated tags describing the build, like "unsigned,debug".
publicstaticfinallong TIME
publicstaticfinal String TYPE The type of build, like "user" or "eng".
publicstaticfinal String USER


效果图:

更多相关文章

  1. android“设置”里的版本号
  2. Android架构分析之使用自定义硬件抽象层(HAL)模块
  3. android通过ksoap2对webservice的解析
  4. Android如何获得系统版本
  5. android studio升级方法
  6. Android(安卓)studio修改打包后的apk的名字
  7. 修改系统Android版本,版本号
  8. what is Android?
  9. Android中的硬件加速

随机推荐

  1. Android(安卓)ListView拖动时背景颜色会
  2. Android读写文件示例
  3. android 音乐播放器简单实现
  4. android camera 画角度图
  5. android 程序中选择图片的代码
  6. Android实现高斯模糊
  7. Android ViewPager+Fragment实现首页滑动
  8. Android input Overview
  9. Android拍照Demo
  10. android WebView 回退与退出