Use Instance ID as unique identifier for my Android app

I want to create a unique ID for my application. As below link

I want to use InstanceID as a unique identifier.

String uniqueID = InstanceID.getInstance(context).getId();

      

Due to some configuration tweak, my server expects the unique ID to be in lowercase only. Upper and lower case characters are displayed as the instance identifier. I was thinking of converting each character of the instance to the corresponding ASCII value and sending it as my unique identifier. Would this be the right approach?

Also, I read about FirebaseInstaceId

https://firebase.google.com/docs/reference/android/com/google/firebase/iid/FirebaseInstanceId

Is it recommended to use FirebaseInstanceId by Instance ID? I haven't found it anywhere in the documentation. Please suggest.

Thank.

+3


source to share


1 answer


Using InstanceID as a unique identifier for your application should be fine, however, depending on your use case, you should note that the InstanceID changes whenever the application is uninstalled, since it represents every instance of the application (hence the naming InstanceId), and it is different for each device.

How you process your data is entirely up to you. For now, you can use it appropriately.



InstanceId and FirebaseInstanceId call the same service behind the scenes, only the same FirebaseInstanceId object used when using FCM. Didn't try to use both at the same time, but the call getId

should return the same value for the same instance (unless something else is in the library).

Also see this maybe helpful post .

+2


source







All Articles