Reputation: 399
As you can see below, I'm getting contradicting results. All help is appreciated.
Firebase Console Query
Firebase Console Query result
Code
db.collection("Jobs")
.whereEqualTo("stationA", "Clacton-on-Sea")
.get()
.addOnCompleteListener(new OnCompleteListener<QuerySnapshot>() {
@Override
public void onComplete(@NonNull Task<QuerySnapshot> task) {
if (task.isSuccessful()) {
if (!task.getResult().isEmpty()) {
Log.d(tag, "Query snapshot not empty, size is " + task.getResult().size());
} else {
Log.d(tag, "Query snapshot empty");
}
} else {
Log.d(tag, "Error getting documents: ", task.getException());
}
}
});
Code Logs
Upvotes: 0
Views: 256
Reputation: 399
I found this log, and realised my phone was logged out of wifi. I fixed it by logging into wifi, however I have a strong 4g connection that didnt work on any app. I fixed the 4g issue by restarting my phone
W/Firestore: (21.3.1) [OnlineStateTracker]: Could not reach Cloud Firestore backend. Backend didn't respond within 10 seconds
This typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.
Upvotes: 1
Reputation: 17566
Editing but leaving the below for reference
In your query, you are looking for a lower case "s" in "Clacton-on-sea" and your database has an upper case "S"
This codelab shows you how to create a Firestore index from an error displayed in Logcat.
If you ever run a query that doesn't currently have an existing index, a URL will be displayed in Logcat that you can use to generate the new index. This generally needs to be done anytime you run a query that orders data or combines various operators (ex. "==" and "<").
Upvotes: 0