Search code examples
androidcouchbase-lite

CouchBase Lite - Does my database synchronize when the screen is off?


I'm working with an Android app - a CouchBase Lite database.

My app is foreground > After 30s, the device screen turn off (by the Android system settings). Does the synchronization continue? Thanks.

Updated: Since I don't declare a new service, so I guest my app only has one service? How can I know if the library of CouchBase Lite has its own service? Do I have to read CouchBase source code?


Solution

  • That depends.

    If you use Services and Android < 26 then it will continue, unless the application is totally killed for system resources. On Android 26 theres some restrictions that I don't know to talk about.

    Your Activity will enter in onStop state, so if you using a Thread or AsyncTask and are not stoping it in that method then it will continue, and again, unless the application is totally killed for system resources.

    We would need more info about how you do that sync for more answers and cases.

    If you didnt declared a service so it doesnt have one, the application is a process (also a instantiated service is) and process can be terminated abruptily by the system.

    Probably CouchBase starts a Thread if you need to init it on a context for example.