Android phone to get the unique identification number of the phone

Source: Internet
Author: User
Tags unique id

Write in front, send this post I think, maybe a lot of people can not use, then you become popular science understand, in fact, each game, the software will get your IMEI
Don't talk nonsense, start!
When developing a mobile app, developers are most concerned about how many users have installed and are using the mobile software they are developing. This requires identifying the uniqueness of the phone. Now I know there are two ways to get the IMEI number of the phone (IMEI number is the number that uniquely identifies the phone). Get the Android ID number (Android ID is the unique number of the phone system).
The first method:
Android acquisition of the phone IMEI number method in the Android system to obtain the IMEI number and other mobile phone information in the article is described in detail. Android in more than 2.0 of the version, the acquisition of the phone IMEI number has no need to read the corresponding access to mobile phone information.
< uses-permission android:name= "Android.permission.READ_PHONE_STATE"/>
However, the current version of 1.6 users account for nearly 50% of users, if you want to let users of the following version of 1.6 can also obtain the IMEI number, it is necessary to add permissions.
The advantage is that the phone is uniquely identified and the disadvantage is that the appropriate user rights may be required.

String Myimsi = Android.os.SystemProperties.get (Android.telephony.TelephonyProperties.PROPERTY_IMSI);
String Myimei = Android.os.SystemProperties.get (Android.telephony.TelephonyProperties.PROPERTY_IMEI);
The second method:
You can get the Android ID number if a phone device first starts to generate a number, and if the system changes, the number may change.
Android ID number explanation: Http://androidappdocs-staging.appspot.com/reference/android/provider/Settings.Secure.html#ANDROID _id
Get method:
String t=android.provider.settings.system.getstring (Getcontentresolver (), "android_id");
LOG.I ("Huilurry", "android_id=" +t);
MS Test results:
07-13 13:12:49.835:info/huilurry (17455): android_id=20014289e714f20c
The advantage is that all versions are tried, and the disadvantage is that they may be duplicated or changed with other machines. Via:http://wangjun.easymorse.com/?p=665
3, get Imei is put, telephonypackage of Telephonymanager class of Getdeviceid () method
Get Imsi/imei (Unique identification ID for SIM and phone)
Learning content: You will learn how to read the IMSI (International Mobile User ID) and IMEI (International Mobile Device ID) of the SIM card in your phone. The IMSI corresponds to the sim only, and the IMEI corresponds to the device only.
Possible applications: You may need a unique ID to authorize/register, or for your android-activity's license purpose the following two lines of code will give you the SIM card unique ID IMSI and device unique ID IMEI
Describe:
IMSI is a unique number that identifies the only user in the GSM and UMTS networks. It is stored in the SIM card of the phone and it is sent to the network via the phone.
The IMEI is also a unique number that identifies the only mobile phone in the GSM and UMTS networks. It is usually printed on the side of the battery below the cell phone and dials * #06 # to see it.
Code: Here's how you read the only Imsi-id/imei-id on Android.
Java:
String Myimsi = Android.os.SystemProperties.get (Android.telephony.TelephonyProperties.PROPERTY_IMSI);
         string Myimei = Android.os.SystemProperties.get ( Android.telephony.TelephonyProperties.PROPERTY_IMEI);

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.