答案 0 :(得分:0)
如果我对您的理解正确,请尝试以下操作:
FirebaseFirestore fireStore = FirebaseFirestore.getInstance();
final String[] requiredMobile = {""}; //this is up to how you want to use the mobile number acquired
fireStore.collection("users").get().addOnSuccessListener(new OnSuccessListener<QuerySnapshot>() {
@Override
public void onSuccess(QuerySnapshot documentSnapshot) {
for (DocumentSnapshot document: documentSnapshot.getDocuments()
) {
if(document.getString("flat")== ("desired Flat") && document.getString("block") =="desired blockNumber"){
requiredMobile[0] = document.getString("mobile"); //do something with phone number
}
}
}
});