Skip to content Skip to sidebar Skip to footer

How To Get The Push Id Of Current User In Firebase Android?

I have generated the push id of the user who have sign up. String id=databaseUser.push().getKey(); How I can get this id when the user signs in? Please help me on this.

Solution 1:

You can store that id in the database as a property of your User object but a more elegant way would be to use the uid and not that random key provided by the push() method. So once you are authenticated, you can get the uid, using the following line of code:

String uid = FirebaseAuth.getInstance().getCurrentUser().getUid();

Post a Comment for "How To Get The Push Id Of Current User In Firebase Android?"