Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save ahmedMubarak2024/ec51e002cfd25392e319398bec877f73 to your computer and use it in GitHub Desktop.
Save ahmedMubarak2024/ec51e002cfd25392e319398bec877f73 to your computer and use it in GitHub Desktop.
get device id codes
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