Advanced Article-Android system: 1. Get unique ID for Android device

Source: Internet
Author: User
Tags unique id

Whether it is PC-side software or Android software, sometimes when sold without outright buyout or purchase of copyright, then you need a set of selling, and to ensure that the software is forbidden to copy.

The software on the PC side can be added to the code to detect the hard drive serial number. In this case, it is not possible to copy to another computer because the hard drive serial number is identified incorrectly. Then in Android without a hard disk you need to get some other hardware parameters to uniquely identify the device.

1. Get IMEI ID: IMEI (International Mobile Equipment Identity) is an abbreviation for International mobile device identification.

Telephonymanager telephonymgr = (Telephonymanager) Getsystemservice (Telephony_service);
// Requires use-permision:read_phone_state

It is important to note that the use of this method requires permission to join:

<android:name= "Android.permission.READ_PHONE_STATE"/>

2. Get other Device parameters

Directly on the code:

 Public classMainactivityextendsappcompatactivity {@Overrideprotected voidonCreate (Bundle savedinstancestate) {Super. OnCreate (savedinstancestate);        Setcontentview (R.layout.activity_main); FinalTextView TV =(TextView) Findviewbyid (TextView); Findviewbyid (R.id.btn_getid). Setonclicklistener (NewView.onclicklistener () {@Override Public voidOnClick (view view) {String M_szdevidshort= "BOARD:" +build.board.touppercase () + "\ n" + "BRAND:" +build.brand.t                                                         Ouppercase () + "\ n" + "Cpu_abi:" +build.cpu_abi.touppercase () + "\ n"                                                         + "DEVICE:" +build.device.touppercase () + "\ n"                                                         + "DISPLAY:" +build.display.touppercase () + "\ n" + "HOST:" + Build.HOST.toUpperCase () + "\ n" + "ID:" +b Uild. Id.touppercase () + "\ n" + "Manufacturer:" +build.manufacturer.touppe                                                         Rcase () + "\ n" + "MODEL:" +build.model.touppercase () + "\ n"                                                 + "PRODUCT:" +build.product.touppercase () + "\ n"        + "TAGS:" +build.tags.touppercase () + "\ n" + "TYPE:" +build.   Type.touppercase () + "\ n" + "USER:" +build.user.touppercase () + "\ n";//digitsTv.settext (M_szdevidshort);    }        }); }

With these unique identities, you can make your software unique ... and cannot be copied.

Advanced Article-Android system: 1. Get unique ID for Android device

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.