This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static String getPseudoUniqueID() { | |
/* | |
Initially we append all the information with the number "35" so all together we get | |
17 characters and the generatedId starts from 35 which makes it look like a IMEI. | |
But later I commented out DISPLAY,HOST and ID because they can be changed and | |
then the generated ID won't be unique anymore | |
*/ | |
String generatedID = "35" + Build.BOARD.length() % 10 + Build.BRAND.length() % 10 + | |
Build.CPU_ABI.length() % 10 + Build.DEVICE.length() % 10 + |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String uniqueID = UUID.randomUUID().toString(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Once you handle all the runtime permission drama for android.permission.READ_PHONE_STATE | |
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE); | |
telephonyManager.getDeviceId(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String secureId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID); |