Firebase permission-denied

前端 未结 4 1468
Happy的楠姐
Happy的楠姐 2021-02-20 08:59

I\'m a newbie in firebase.

How do I get through this below rule?

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document         


        
4条回答
  •  感动是毒
    2021-02-20 09:44

    Because your method query the Firebase not Cloud Firestore so you should use this method :

    FirebaseFirestore db = FirebaseFirestore.getInstance();
        db.collection("YourCollectionName").get().addOnCompleteListener(new OnCompleteListener() {
            @Override
            public void onComplete(@NonNull Task task) {
                if (task.isSuccessful()) {
                    for (QueryDocumentSnapshot document : task.getResult()) {
                        Log.d(TAG, document.getId() + " => " + document.getData());
                    }
                } else {
                    Log.w(TAG, "Error getting documents.", task.getException());
                }
            }
        });
    

    dont forget this :

    implementation 'com.google.firebase:firebase-firestore:17.0.1'
    

提交回复
热议问题