Search code examples
androidkeyunique

How to get the unique details from android application?


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.


Solution

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