-1

I need to create a unique key for each user by using the unique key's from the application. I already fetch the device id, if there anything else as unique?. If yes, please help me.

Anu Roy
  • 369
  • 1
  • 2
  • 11
  • http://stackoverflow.com/questions/6509951/android-application-unique-license-key – sachithkn Jul 27 '15 at 04:43
  • possible duplicate of [Is there a unique Android device ID?](http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id) – Seshu Vinay Jul 27 '15 at 04:50

3 Answers3

1

You can also get IMEI number

TelephonyManager TM = (TelephonyManager)    getSystemService(Context.TELEPHONY_SERVICE);

// IMEI No.
String imeiNo = TM.getDeviceId();

// IMSI No.
String imsiNo = TM.getSubscriberId();

// SIM Serial No.
String simSerialNo  = TM.getSimSerialNumber();

// Android Unique ID
String androidId =    System.getString(this.getContentResolver(),Settings.Secure.ANDROID_ID);

Don't forget to add

<uses-permission android:name="android.permission.READ_PHONE_STATE" />

to your manifest file.

Vinay Jayaram
  • 1,030
  • 9
  • 29
0

Settings.Secure#ANDROID_ID returns the Android ID as an unique 64-bit hex string private String android_id = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID); But this is known to change on factoru reset and sometimes may return null. It can also be easily changed on a rooted device.

Some other options are:

1.IMEI

2.IMSI

String ts = Context.TELEPHONY_SERVICE;
TelephonyManager mTelephonyMgr = (TelephonyManager) getSystemService(ts);
String imsi = mTelephonyMgr.getSubscriberId();
String imei = mTelephonyMgr.getDeviceId();
Domain
  • 11,562
  • 3
  • 23
  • 44
0

String android_id = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);

Nithin Np
  • 180
  • 1
  • 10