Couchbase data sync background


#1

Hi,

I am new to use of Couchbase lite iOS. I wonder to know how Couchbase lite can be able to sync data even when the iOS app pushed to background. Awaiting to appreciate your explanation.


#2

iOS limits app activity in the background. You can either have your app request periodic wake-ups, or set up push notifications that will wake up the app and let it sync (without becoming visible.) Push notifications require work on the server side to deliver them to Apple’s servers.


#3

Hi @jens can you give a tips or assist, how to request a periodic wake-ups in app side?


#4

Apple has lots of documentation about background activity in apps.


#5

Actually, I am looking Couchbase Lite work in background. Where I use continue replication but still our CBL not working in the background. There is a lack of documentation i guess. i didn’t find any related to this. If you find it. please share with us.


#6

You asked about “periodic wake-ups”. That’s not something CBL can do; you ask iOS for that. Either periodic wakes, or you can set up your server to send push notifications through Apple’s push notification service when a client should wake up and sync.

If you’re trying to keep the replicator running after the app goes into the background, you need to set the config’s allowReplicatingInBackground property to true, and also listen for iOS backgrounding notifications and start a “background session” to give the app time to run so the replicator can finish. See Apple’s docs about that.


#7

I will check “Periodic Wake-Ups” in Apple Docs.

For CBL work in the background, I am working as like in this link But this is in Objective - C and not working. Do you have any links which are in Swift?


#8

ok agree with let app take its run-time. but Approx howmuch time it will take?? As it takes so long time and result gives nun. blank.

thanks.
vidmate kissanime


#9

@itssrinadh: You would make the same API calls, just in Swift instead of Obj-C. I don’t know if we have a sample that does the same thing but in Swift.

@DyraSan: You start an iOS “background session”. When the replicator stops, you end the session. If this takes longer than the OS likes, it’ll call you back telling you to stop your session, and at that point you should stop the replicator.


#10

You may want to check out this blog . Provides an overview and points to a tutorial on our samples page. - @jongladwin : FYI.


#11

Thank you i will check it.