Details
-
Improvement
-
Resolution: Unresolved
-
Major
-
None
-
None
Description
Backgrounding support on mobile apps varies drastically by platform. In fact, on certain platforms such as Android, the concept of “backgrounded apps” is quite nebulous/complicated.
Couchbase Lite continuous replications will continue running until the app terminates, unless the remote system, or the application, terminates the connection.
Android OS may kill an application without warning.
So the recommendation we provide is that
You should explicitly stop replication processes when they are no longer useful (for example, when they are {{suspended or idle) to avoid socket connections being closed by the OS, which may interfere with the replication process.}}
There are couple of options available if apps have to be run tasks in the background
- Use Foreground Service for long running replications in the background
- Use Work Manager to schedule one-shot replications to run asynchronously in the background or use Remote Firebase Cloud Messaging(FCM) to kick off a work request to run a one-shot replication
This ticket is to track interest in building this capability into the Couchbase Lite platform and take advantage of Android lifecycle owner events
Forums:
https://github.com/couchbase/couchbase-lite-java-ce-root/issues/18
This has been a frequently pain point by several of our customers who have to jump through hoops to align replicator life cycle with Android app life cycle
Attachments
Issue Links
- relates to
-
CBL-80 Android specific replication using WorkManager
- Closed