简体   繁体   中英

How do you create another unique user id in firebase?

Im building an app that will have multiple users that are going to be sharing data with about 3-5 other users. So I will need to assign each user to a unique group ID so that they will only be able to access the data associated with their groups. What is the best way to generate unique group ID/keys that can be shared among 3-5 different users.

You can try using push().getKey() to get the unique key.

FirebaseDatabase database = FirebaseDatabase.getInstance();
String key = database.getReference("quiz").push().getKey();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM