From the Android Reference page:
"public static final String ANDROID_ID
The Android ID (a unique 64-bit value) as a hex string. Identical to that obtained by calling GoogleLoginService.getAndroidId(); it is also placed here so you can get it without binding to a service."
It took me awhile to figure out how to use this since all the code on the net regarding this issue is only compatible with 1.1 and most of the things the code utilizes has since been deprecated in 1.5 of the SDK.
Using java Syntax Highlighting
- import android.provider.Settings.Secure;
- private String android_id = Secure.getString(getContext().getContentResolver(), Secure.ANDROID_ID);
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
This is perfect for storing high scores for a game for each individual user without the need for user registration.
NOTE: The emulator will return a null value so if you try to use this value in the emulator environment your application will crash.





