Reputation: 622
Is it safe to use a react-native-device-info unique ID? From what I can understand it will always remain unique for both iOS and android no matter how many times the app will be uninstalled.
If not kindly suggest what else we can use to uniquely identify the device since I want to make sure every user login with a separate device.
const uniqueId = DeviceInfo.getUniqueID();
// iOS: "FCDBD8EF-62FC-4ECB-B2F5-92C9E79AC7F9"
// Android: "dd96dec43fb81c97"
Notes
iOS: This is IDFV so it will change if all apps from the current apps vendor have been previously uninstalled. android: Prior to Oreo, this id (ANDROID_ID) will always be the same once you set up your phone.
Upvotes: 3
Views: 6418
Reputation: 129
I was doing SDK for analysts, which generates billions of events every day and I can find the following.
For iOS:
IDFV - changes after user re-install app(if user had only one your app).
I recommend to use next form: currentTimeInMilliseconds_IDFV and save this to KeyChain. KeyChain is updated only after user reset the device to the factory settings.
For Android:
Android don't have a cool version.
I recommend to use form: android.os.Build.SERIAL_Settings.Secure.ANDROID_ID.
Each argument aren't unique and one million devices have about 100 repeats.
But sorry, I don't have example for react native, if you need an example I can search later.
Upvotes: 2