Android中获取手机信息

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

在如东等地区,都构建了全面的区域性战略布局,加强发展的系统性、市场前瞻性、产品创新能力,以专注、极致的服务理念,为客户提供网站建设、成都做网站 网站设计制作按需规划网站,公司网站建设,企业网站建设,高端网站设计,全网营销推广,成都外贸网站制作,如东网站建设费用合理。

java代码:

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

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

java代码:

 
 
 
 
  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 版本号  

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

Java代码:

 
 
 
 
  1. String  
  2. BOARD  
  3. The name of the underlying board, like "goldfish".  
  4.  
  5. String  
  6. BOOTLOADER  
  7. The system bootloader version number.  
  8.  
  9. String  
  10. BRAND  
  11. The brand (e.g., carrier) the software is customized for, if any.  
  12.  
  13. String  
  14. CPU_ABI  
  15. The name of the instruction set (CPU type + ABI convention) of native code.  
  16.  
  17. String  
  18. CPU_ABI2  
  19. The name of the second instruction set (CPU type + ABI convention) of native code.  
  20.  
  21. String  
  22. DEVICE  
  23. The name of the industrial design.  
  24.  
  25. String  
  26. DISPLAY  
  27. A build ID string meant for displaying to the user  
  28.  
  29. String  
  30. FINGERPRINT  
  31. A string that uniquely identifies this build.  
  32.  
  33. String  
  34. HARDWARE  
  35. The name of the hardware (from the kernel command line or /proc).  
  36.  
  37. String  
  38. HOST  
  39.  
  40. String  
  41. ID  
  42. Either a changelist number, or a label like "M4-rc20".  
  43.  
  44. String  
  45. MANUFACTURER  
  46. The manufacturer of the product/hardware.  
  47.  
  48. String  
  49. MODEL  
  50. The end-user-visible name for the end product.  
  51.  
  52. String  
  53. PRODUCT  
  54. The name of the overall product.  
  55.  
  56. String  
  57. RADIO  
  58. The radio firmware version number.  
  59.  
  60. String  
  61. SERIAL  
  62. A hardware serial number, if available.  
  63.  
  64. String  
  65. TAGS  
  66. Comma-separated tags describing the build, like "unsigned,debug".  
  67. long  
  68. TIME  
  69.  
  70. String  
  71. TYPE  
  72. The type of build, like "user" or "eng".  
  73.  
  74. String  
  75. UNKNOWN  
  76. Value used for when a build property is unknown.  
  77.  
  78. String  
  79. USER 

效果图:

【编辑推荐】

Android UI设计模式

Android开发之旅:Android架构

Android Phone 7界面设置小教程

Android系统手机隐藏代码大全曝光

Android Activity和Intent机制学习笔记

当前文章:Android中获取手机信息
分享URL:http://www.hantingmc.com/qtweb/news22/98872.html

网站建设、网络推广公司-创新互联,是专注品牌与效果的网站制作,网络营销seo公司;服务项目有等

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联