Identify a Device in Native App

1
Is there a way to uniquely identify a device?   I wanted to identify a device with a unique variable, but the value returned from get device info unique id changes every time the app is updated. The device id does not work for me because it is the same in other devices of the same model, and I have tried to obtain the mac address and the serial number (unknown, android version 11.0) with the instructions on this website (https://www.npmjs.com/package/react-native-device-info#getmacaddress) but it is not working.   The idea of getting the IMEI number seems outdated as of android 11.0
asked
1 answers
1

Can entirely be wrong about this, but here is a thought. 

 

Add a OnLoad or Onstartup event on the login page of your native device. Have an entity called DeviceID and trigger a GetOrCreate nanoflow. Either grab the DeviceUniqueID or generate a random string. Choice is yours.  In the GetOrCreate, just Retrieve First, no constraints. Upon Create, just create. Commit, no events.

 

Here is the thing I believe is possible, but can’t remember for sure: In the navigation, configure the entity to stay on the device, do not sync. Do this to prevent the object to leave the device and persist through updates. There should only be one object per device. As long as there is an object per device, you have a unique identifier (though, only for while the database of the user remains in tact. Upon reinstall of app, you’ll lose it). Since there should only be one object per device, a retrieve without constraints is sufficient.

 

You could associate the DeviceID objects to Accounts, if you want to keep a list of devices per user  (and ways to force logout sessions). It may offer features to the user as well.

 

Not a solution, but it’s a (temporary) fix if it works. 

 

With the recent changes in privacy in general, such as you somewhat mention in regard to IMEI and Android 11, getting unique device IDs are getting more difficult. This would help.

 

answered