iOS:Couchbase lite version 1.4.1 support background working?

14 views
Skip to first unread message

parvez....@decurtis.com

unread,
Feb 14, 2018, 9:29:27 AM2/14/18
to Couchbase Mobile
For an iOS application using Couchbase lite v1.4.1. Does it supports replication when application moves to background (by pressing home button on iOS device)? If it do not support background syncing then is there any way to enable it in the Couchbase lite framework? 

Thanks

Jens Alfke

unread,
Feb 15, 2018, 6:16:44 PM2/15/18
to Couchbase Mobile


On Feb 14, 2018, at 6:29 AM, parvez....@decurtis.com wrote:

For an iOS application using Couchbase lite v1.4.1. Does it supports replication when application moves to background (by pressing home button on iOS device)? If it do not support background syncing then is there any way to enable it in the Couchbase lite framework? 

If the app is backgrounded while a replication is active, CBL it will request extra time from the OS to finish up. I think it can receive about 30sec.

Apps in the background aren’t in general allowed to have open sockets or initiate activities. I think newer iOS versions will allow an app to request periodic background wake-ups, as long as it doesn’t run too long.  It can then can run a one-shot replication to pull the changes.

If you want to be able to pull new updates while the app is in the background, the best solution is to have your server send a push notification to the app; there is an invisible style of notification that just wakes the app up in the background, and it can pull changes as above.

(IIRC there’s an issue in 1.4.1 that requires you to manually set suspended=NO on a replication that’s initiated while in the background, else the replication will stay in the paused state.)

—Jens

Jens Alfke — Mobile Architect — Couchbase, Inc.

Reply all
Reply to author
Forward
0 new messages