Search code examples
androidapkreact-nativeself-signed

AndroidId changing depending on user who builds the app


We're actually working on a react native project (for android).

For our license managing, we are using the "androidId" from the device (using the package react-native-device-info).

The code is on git, but the keystore is different on each user that developp on the app. And the problem is the AndroidId is changing.

For example :

I am building the app (in dev mode) from my computer, the androidId will be XXXXXX My friend is building the app on his computer (in dev mode, with the same source code), the androidId will be YYYYY in the app...

How can i figure it out ? Is there another unique number I can use to manage license from react-native ?

Hope someone can help me out !

Thibault.


Solution

  • Quoting the documentation:

    For apps installed on a device running Android 8.0, the value of ANDROID_ID is now scoped per app signing key, as well as per user. The value of ANDROID_ID is unique for each combination of app-signing key, user, and device. As a result, apps with different signing keys running on the same device no longer see the same Android ID (even for the same user).

    Note that while the docs refer to Android 8.0, that is really "Android 8.0 or higher".

    How can i figure it out ?

    ANDROID_ID is not a particularly good value to use for much of anything. But, if you want to rely on it, standardize on your debug keystore.

    Is there another unique number I can use to manage license from react-native ?

    If you are looking for a device-specific identifier, there are few options, mostly for privacy and security reasons. Google provides recommendations for identifiers that you may wish to review.