Android gets imsi/IMEI

Source: Internet
Author: User

The imsi (International Mobile User ID) and IMEI (international mobile device ID) of the SIM card in the mobile phone. The imsi uniquely corresponds to the SIM card, and the IMEI corresponds to the device.
Possible application scenarios: you may need a unique ID to authorize/register, or the following two lines of code for your Android-activity license will give you a unique SIM card ID imsi and a unique device id imei.
Description:
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 mobile phone and will be sent to the network through the mobile phone.
IMEI is also a unique number that identifies the only mobile phone in the GSM and UMTS networks. it is usually printed under the cell phone, dial * #06 # To See It.

 

TelephonyManager tm = (TelephonyManager)context.getSystemService(Context.TELEPHONY_SERVICE);String imei = tm.getDeviceId();String imsi = tm.getSubscriberId();

To execute the above Code, you need to add the permission androidmanifest. xml.

<! -- Read mobile phone information --> <uses-Permission Android: Name = "android. Permission. read_phone_state"> </uses-Permission>
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.