Firestore - Binding to Service Failed

I am attempting to retrieve and display two String values from a Firestore database. The structure of the database is a collection (called “UserNotes”) containing documents which I let Firestore auto-assign identifiers. Each document has two key value pairs, one titled “ID” and the other titled “Note”.

For example, one entry would have a structure of:

 Collection -> “UserNotes”

            Document -> “FmFGR45FG477T769”

                         Key-> “ID”, Value -> “1234” <String>

                         Key-> “Note”, Value -> “Test Note” <String>

In my app I’ve built a data class:

        data class ListItem (val _id: String?, val note: String?) {

        constructor() : this(_id = "", note = "")

I’ve populated the database directly from within Firestore and the app has no authentication.

I’m using a custom object (as above), a RecyclerView, a RecyclerAdapter and a SnapshotListener. I’ve tested these components separately and they all work fine.

In my snapshot listener I attempt to get the two Strings from a particular document by setting a docRef then calling:

 val displayID =!!.getValue("ID").toString()
 val displayNote =!!.getValue("Note").toString()

then creating an instance of the ListItem class as in:

 var anotherNote = ListItem(displayID, displayNote)

then adding the instance to an ArrayList and submitting that list to the adapter for display on screen.

This doesn’t work, the app successfully builds and runs but displays nothing.

When I add log statements to the code:

val displayID =!!.getValue("ID").toString()
Log.v("Simple", "DisplayId extracted as $displayID")

val displayNote =!!.getValue("Note").toString()
Log.v("Simple", "DisplayNote extracted as $displayNote")

var anotherNote = ListItem(displayID, displayNote)
Log.v("Simple", "anotherNote extracted as $anotherNote")

the Logcat shows the String literals from Firestore so I can see the program has successfully connected to Firestore and can get data. However, nothing displays on the phone screen besides an empty RecylerView. The error message I can see in Log is: BINDING TO THE SERVICE FAILED.

I’m obviously only targeting one document in the collection here but I have also tried setting a snapshot listener on a collection reference then looping through each document and calling

val myID = doc.getData().toObject<ListItem>()

then building an ArrayList and submitting to the adapter as before. The same thing happens as in I can display all data from the collection of documents in the Log but nothing shows on screen for the same reason: BINDING TO THE SERVICE FAILED.

I’ve tried a bunch of other get calls on both document and collection references and also experimented with adding a few annotations to my Data Class. I’m not confident I’m using the right annotations or even if they’re appropriate here at all. The ones I’ve tried don’t seem to change anything.

Any help or ideas well appreciated!