Which method is better for document change listeners?

There are so many methods used for document change events. Can anyone tell which method is more preferrable?
For example;


They all have their own purpose as described in their documentation. What kind of events are you interested in?

I want to know about what is a difference between document change listener, database change listener and replicator change listener. How are they internally works and which is better from these events

I want to get changes from documents.

brief information on some change listeners for getting document updates.

  • Database.addDocumentChangeListener(with: docID) for getting changes for a document with given ID. These might be the one you are looking for, when any change happens to a document in the database.

  • Database.addChangeListener can be used to observer any change that happens inside the database. It will include databaseChange(database & document-ids) which can be used to track the changes.

  • AbstractReplicator.addDocumentReplicationListener for getting the replication status for documents. if you have enabled replication, try to push/pull changes, and want to observe event when done with it.


database documentation

replication documentation

when I can use

replicator.addChangeListener { change: ReplicatorChange ->
Log.e(“CCCCCCCCCCCCCCCCCC”, “” + change.toString()

I can also get changes using above method so what is a difference between Database.addChangeListener and Replicator.addChangeListener ?

Just look at the names. Or the documentation. Have you looked at any of the docs?)

A database change listener tells you about changes to the database.

A replicator change listener tells you about changes to the replicator state.