I am having an activity in which there is a button get uid, I am registering users and it is creating unique id for each user in Firebase database. What I want is when i click the button it will choose the Uid from the available Uids in firebase database and show that id , but the ids must be random and it must be from the database of users who register themselves in the app. How to get random UId everytime?
0
votes
Do you want to fetch the UID that Firebase generates for that particular user?
- Saurabh Thorat
Yes ..bt i want to fetch random uid everytime , like the pointer goes through each id and give me random uid everytime like shuffling
- ShUbHaM raWat
i want to make chat app to connect randomly using uids , is there any better way to do it ?
- ShUbHaM raWat
Firebase has a codelab to make a chat app here: codelabs.developers.google.com/codelabs/firebase-android/#0
- Saurabh Thorat
See stackoverflow.com/questions/40853157/firebase-random-query/…, stackoverflow.com/questions/40765613/…, stackoverflow.com/questions/43035087/… and more from this list: stackoverflow.com/search?q=%5Bfirebase%5D+random+child
- Frank van Puffelen
1 Answers
1
votes
I don't think it is possible . Since Firebase will return a UID that is associated with a particular user.
I read the docs getIDToken
Unless you have stored the passwords & emails of all the users who registered, then you can request the UID one by one and store them in an array.Then you can do a Random function based of the length of the array.