Android gets the 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.
IMEI (International Mobile Equipment Identity) is the abbreviation of international mobile device identity code. It is an "electronic serial number" consisting of 15 digits ", it corresponds to each mobile phone, and the code is the only one in the world. Each mobile phone is assigned a unique group of numbers in the world after it is assembled. This number will be recorded by the manufacturer who manufactures it from production to delivery.

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

Some of my previous projects involved androidpad. (See http://www.linuxidc.com/Linux/2011-10/44917.htm and http://www.linuxidc.com/Linux/2011-10/44918.htm) I can also get IMEI code from it. It can be seen that the IMEI code is not limited to mobile phones, but the difference is that the IMEI code of the Aigo I tested contains letters.CodeWhen querying the IMEI code, there are letters in it. 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:

1. // obtain the IMEI code
Telephonymanager = (telephonymanager) This. getsystemservice (context. telephony_service );
String IMEI = telephonymanager. getdeviceid ();
5. // print the obtained IMEI code 6. 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:

1. <uses-Permission Android: Name = "android. Permission. read_phone_state"/>

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.