Android: Android ID changes on App Update. Something Unique instead?
This question already has an answer here:
Link only answers are normally discouraged but I don't see an alternative in this case as the article is quite in depth for and relates to various different API levels.
See the documentation for the correct way to handle this (according to Google):
http://developer.android.com/training/articles/user-data-ids.html
Use the hardwareID
instead, that one shouldn't change that much...
Here's the code to try out:
/**
* Returns the embedded <i>hardwareID</i>
* @param context which {@link Context} to use
* @return the hardwareID
*/
public static String getHardwareId(Context context) {
return Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);
}
Unfortunately, there is nothing that fits your requirements.
When it comes to the unique identifiers of an Android device, there are a lot of different options, but none of them is a 100% guarantee to work. And, getting most of them require requesting nasty permissions from the user.
I can suggest two options: