简体   繁体   中英

Get uid from multiple database firebase

I'm stuck in my project's major problem. What i want is: one user is customer, the other is driver. I have 2 databases in which customer longitude and latitude is saving and also for driver in driver's database. I want when customer request driver application get the longitude and latitude of customer database under the uid of that current user which driver accepted. How can I get the uid of that customer? I've found method to access customer database

FirebaseOptions options = new FirebaseOptions.Builder()
            .setApplicationId("<your application id>")
            .setApiKey("<your api key>")
            .setDatabaseUrl("<your DB url that ends in 'firebaseio.com/' ")
            .build();

But how can I get the uid of that current user which requested. Here is image of 2 databases

Firebase数据库客户

Firebase数据库驱动程序

Driver uid is just for suppose and I forgot to use push() method under uid.

myDatabase.child("codes")
     .addListenerForSingleValueEvent(new ValueEventListener() {
public void onDataChange(DataSnapshot dataSnapshot) {
    String clubkey = dataSnapshot.getKey();

firebase_instance.limit(100).on("child_added", function(snap) {
  var name = snap.key;
});

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