Search code examples
couchbasecouchbase-liteandroid-database

Unable to restore couchbase lite database in android


I have implemented backup/restore local couchbase lite database with google drive. I done database file upload and download process, When this download completed means then i need to restoring to mobile. After that how to implement?


Solution

  • You should be able to just close out the database, replace it with the backup, then reopen it. See this github repo for an example of using a pre-packaged database, which does essentially the same thing: https://github.com/couchbaselabs/mobile-training-todo

    Backing up may be a little more involved than you're expecting. Couchbase Lite has a main database, but there are also two other database related files that are transient. Most likely you want to be sure to stop operations for the backup, then copy the one main file.

    The easier thing might be to not back up the database yourself, but to use the Couchbase Mobile stack sync capabilities.