Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to get Mobile phone Information in Android

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces the relevant knowledge of "how to obtain mobile phone information in Android". The editor shows you the operation process through an actual case. The operation method is simple, fast and practical. I hope this article "how to obtain mobile phone information in Android" can help you solve the problem.

In the Android development platform, the local number can be obtained through TelephonyManager.

Java Code:

TelephonyManager phoneMgr= (TelephonyManager) this.getSystemService (Context.TELEPHONY_SERVICE); txtPhoneNumber.setText (phoneMgr.getLine1Number ()); / / txtPhoneNumber is an EditText used to display the mobile phone number

Note: according to the security mechanism of Android, when using TelephonyManager, you must add it to AndroidManifest.xml or you cannot get a license from the system.

Mobile phone model Build.MODEL

Java Code:

Private void loadPhoneStatus () {TelephonyManager phoneMgr= (TelephonyManager) this.getSystemService (Context.TELEPHONY_SERVICE); txtPhoneModel.setText (Build.MODEL); / / Mobile phone model txtPhoneNumber.setText (phoneMgr.getLine1Number ()); / / Local phone number txtSdkVersion.setText (Build.VERSION.SDK); / / SDK version number txtOsVersion.setText (Build.VERSION.RELEASE); / / Firmware/OS version number}

In fact, Build can provide us with a lot of information, including hardware manufacturer, hardware number, serial number and so on, and the calling method is the same as above, which is very simple.

Java Code:

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

Effect picture:

This is the end of the content about "how to get Mobile phone Information in Android". Thank you for reading. If you want to know more about the industry, you can follow the industry information channel. The editor will update different knowledge points for you every day.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report