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