The picture below shows the data structure for the simple chat application. A channel is created between two users when they want to communicate. Member string array field lists the usernames.
I want to notify the user when any of the channels of logged in user receive a message. Not sure how this can be done.
I tried below query with no success. Any ideas?
listenerRegistration2 =
firebaseFirestore.collection(COLLECTION_CHANNELS)
.whereEqualTo("members.0", username)
.addSnapshotListener((queryDocumentSnapshots, e) -> {
Log.d("myApp", "queryDocumentSnapshots = ");
});