Obtain IMEI and other mobile phone information in Android

Source: Internet
Author: User

Http://marshal.easymorse.com/archives/1532

 

 

If you need to obtain mobile phone information through the android SDK. You can obtain this information as follows:

 

 
Telephonymanager=(Telephonymanager)This. Getsystemservice (context. telephony_service); string IMEI=Telephonymanager. getdeviceid ();

However, when writing this code, an error similar to how to view Android exceptions is reported, mainly because Android permissions need to be opened and added to the androidmanifest. xml file:

 

 
<Uses-PermissionAndroid: Name= "Android. Permission. read_phone_state" />

You can get the IMEI number of your mobile phone.

 

Telephonymanager can call other methods to obtain other information about the mobile phone.

For exampleGet mobile phone number, You can do this:

Telephonymanager. getline1number ();

However, in the G1 mobile phone test, the mobile phone number cannot be obtained by using the mobile global SIM card, which is an empty string.

Get the SIM card number of your mobile phone:

Telephonymanager. getsimserialnumber ();

This can be obtained in the above environment.

Get customer IDIn GSM, It is the imsi Number:

Telephonymanager. getsubscriberid ();

This can also be obtained in the merchant environment.

For more information about telephonymanager APIs, see:

Http://developer.android.com/intl/zh-CN/reference/android/telephony/TelephonyManager.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.