Xamarin.iOS App in background stops listener

.net

#1

I am starting couchbase lite listener in app start in my xamarin.forms app and when app goes to background, listener stops working,so, my other device can not sync p2p with that device. In android it works fine when app goes to background.

Thanks


#2

Hi @vivekjoshi.icreate

@borrrden managed the .NET CouchbaseLite SDK, he’s probably best suited to try and help.

Thanks


#3

Android and iOS are vastly different about what you can do in the background. iOS cannot continue running without making an explicit background task which is limited in time and so the recommendation is to shut down replication when you go into the backgound.


#4

Thank you, @borrrden,

How can I know that when the app on master device is in background,
The thing happening is, when I replicate initially from my master device i.e. iPad, after some amount of p2p replication to slave device if I push home button of iPad (that makes app go to background), no changed event fire and stays as it is. If I kill the app I get status offline and I can proceed, other case is if I again put app to foreground, it starts remaining replication.

So, my problem is, is there any way to get event on slave device when master device go to background or can I set timeout for puller on slave device so I can proceed further without making user to wait.

Thanks in advance :slight_smile:


#5

Have you tried stopping the listener when going into the background? This should let you have the same experience as going offline via killing.


#6

Hey, @borrrden,

It worked,
Thank you so much.