I use couchbase lite for Android. I need to inform the user about unsynced local changes which will be lost during the log out from the app. For example, user changes the data during offline work and wants to log out.
Does anybody know a way to check that?
The
Database
object has alastSequenceNumber
property. Every new revision is assigned a new sequence number, so this property increases monotonically as changes are made to the database. It can be used to check whether the database has changed between two points in time.When a replication has successfully completed, you could store the last sequence number to a local document or in the Shared Preferences on Android and when the user logs out, compare the one saved and the one set on the database. If the database's last sequence is greater that the one you are tracking, display a popup to notify the user that X changes were saved (inserts, updates, deletes) but not synced.