I am building a firebase based android application which involves multiple user who authenticate and login to app. I want to provide a Unique to each users who authenticate&login and which will not be changed even if user reinstall the application so that I can use and rely on that key to make a separate json branch for that specific user in database based on that id.
I have searched the docs I found user.getUid()
and user.getToken()
. I am confused about these two which one will help me considering my situation.
Definitely use user.getUid()
. It's a standard Firebase practice to use this UID to create a dedicated JSON branch for that user (on the database), just like you described.
This UID will remain the same even if the user deletes your app. As soon as he logins back again, he will be assigned this exact same UID.