• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Forcing Android ID same in all builds of same app

Is there way to force that at least debug APK, and release bundle/AAB (app installed from Play store) would have same Android ID in same phone.

Even if I'd sign debug and release build with same keys, debug APK and release bundle still have different Android IDs.
 
What do you mean by Android ID? Package ID of an Android App?
The Android system identifies and distinguishes apps by package id.
 
String androidID = Settings.Secure.getString(context.getContentResolver(), Settings.Secure.ANDROID_ID);

I can build
- debug APK
- release APK
- debug bundle
- release bundle

Only first one and last one are interesting.

Even if in build.gradle reads

buildTypes {
debug {
signingConfig signingConfigs.release
...
}
release {
signingConfig signingConfigs.release
...
}
}


debug APK and release bundle (after installing from Google Play Store) have different Android IDs in same phone.
Google Play state (internal testing, closed testing, open testing, production) doesn't matter, does it?
 
I see now.
The Android ID is related to developer signing key.
As we know, Google Play Store will re-sign uploaded release apks/bundles. So the app you installed from Google Play Store will have a different signing key from which you used to sign the debug apk.
As a result, debug APK and release bundle (after installing from Google Play Store) have different Android IDs in same phone.
 
Back
Top Bottom