Android中如何获取手机信息-创新互联
这篇文章主要介绍“Android中如何获取手机信息”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Android中如何获取手机信息”文章能帮助大家解决问题。
华阴网站建设公司成都创新互联公司,华阴网站设计制作,有大型网站制作公司丰富经验。已为华阴成百上千提供企业网站建设服务。企业网站搭建\外贸网站制作要多少钱,请找那个售后服务好的华阴做网站的公司定做!Android开发平台中,可通过TelephonyManager 获取本机号码。
java代码:
TelephonyManager phoneMgr=(TelephonyManager)this.getSystemService(Context.TELEPHONY_SERVICE); txtPhoneNumber.setText(phoneMgr.getLine1Number()); //txtPhoneNumber是一个EditText 用于显示手机号
注:根据Android的安全机制,在使用TelephonyManager时,必须在AndroidManifest.xml中添加
手机型号 Build.MODEL
java代码:
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能向我们提供包括 硬件厂商,硬件编号,序列号等很多信息 调用方法也都同上,很简单。
Java代码:
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中如何获取手机信息”的内容就介绍到这里了,感谢大家的阅读。如果想了解更多行业相关的知识,可以关注创新互联行业资讯频道,小编每天都会为大家更新不同的知识点。
本文题目:Android中如何获取手机信息-创新互联
当前网址:http://pwwzsj.com/article/dscpcg.html