Skip to content

Instantly share code, notes, and snippets.

View Koronaa's full-sized avatar
🏠
Working from home

Koronä Koronaa

🏠
Working from home
View GitHub Profile
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 +
@Koronaa
Koronaa / GUID.java
Created April 13, 2018 06:52
Generates a random GUID in Android
String uniqueID = UUID.randomUUID().toString();
@Koronaa
Koronaa / TelephonyNumber.java
Created April 13, 2018 06:40
Unique Telephony Number (IMEI, MEID, ESN, IMSI)
//Once you handle all the runtime permission drama for android.permission.READ_PHONE_STATE
TelephonyManager telephonyManager = (TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
telephonyManager.getDeviceId();
@Koronaa
Koronaa / AndroidID.java
Created April 1, 2018 11:10
Android Secure ID (SSAID)
String secureId = Settings.Secure.getString(getContentResolver(), Settings.Secure.ANDROID_ID);