Android gets the phone serial number

Source: Internet
Author: User

Today, I am discussing how to use a mobile phone to work in the Organization. I suddenly think of the serial number of the mobile phone card. As long as the serial number of the mobile phone card is used, I can uniquely identify a mobile phone card, when you log on to the system, do not log on. You only need to use the serial number, and it will not be mixed with other network mobile phones. When you come back at night, you will write it all at once, an error was reported at the beginning. Later I remembered that it was caused by permission settings. DetailsCodeHow:

Context context = getwindow (). getcontext ();

Telephonymanager telephonemanage = (telephonymanager) Context. getsystemservice (context. telephony_service );

Try {

Toast. maketext (this, "miei Code:" + telephonemanage. getdeviceid (), 1000). Show ();

}

Catch (exception e ){

Log. I ("error", E. getmessage ());

}

In addition, the permission must be added to androidmanifest. xml. The content is:

<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.