[Android] Get IMEI code

Source: Internet
Author: User

As we all know, each mobile phone has its own string, which is the only one in the world. Even if the same brand and model are the same, they will not be the same. This Code is the iemi code.

 

With the IMEI code, we can easily distinguish each machine from its owner and user. The IMEI code cannot be modified by the user. Therefore, it prevents "cheating" users to a large extent. For example, we can use the iemi code for login verification.

 

Some of my previous projects involved androidpad. I can also obtain the IMEI code. It can be seen that the IMEI code is not limited to mobile phones, but the difference is that the Aigo pad I tested contains letters, therefore, if you find a letter in the IMEI code query in the future, do not hesitate. This is normal.

 

 

No more nonsense. Read the code!

 

 

The Code consists of Java code and manifest. xml.

First look at the Java code:

// Obtain the IMEI code telephonymanager = (telephonymanager) This. getsystemservice (context. telephony_service); string IMEI = telephonymanager. getdeviceid (); // print the obtained IMEI code to the system. out. println ("IMEI:" + IMEI); we set the IMEI string and print the string to see the IMEI code.

 

The second is the permissions in manifest. xml:

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

 

 

Not much content, but very useful!

Friendly reminder, the virtual machine does not have an IMEI code, but he also assigned a value-a bunch of 0!

 

 

Demo resources: http://download.csdn.net/detail/etzmico/3685331

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.