Created
October 14, 2018 15:10
-
-
Save ahmedMubarak2024/ec51e002cfd25392e319398bec877f73 to your computer and use it in GitHub Desktop.
get device id codes
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
AsyncTask.execute(()->{ | |
try { | |
AdvertisingIdClient.Info idInfo = null; | |
idInfo = AdvertisingIdClient.getAdvertisingIdInfo(getApplicationContext()); | |
System.out.println(idInfo.getId()); | |
} catch (IOException | GooglePlayServicesNotAvailableException | GooglePlayServicesRepairableException e) { | |
e.printStackTrace(); | |
} | |
} | |
); | |
//or but not secure | |
String android_id = Settings.Secure.getString(getContentResolver(), | |
Settings.Secure.ANDROID_ID); | |
System.out.println(android_id); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment