Forum Cross Platform with Xamarin
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

How to get continuous data in Apple watch companion app even when app in iphone is in background

ajeetsri2006ajeetsri2006 USMember

I am developing apple watch companion app in for xamarin forms project. There when iPhone app or parent app is in background I am not able to get continuous data from parent app to my companion app. I used below peace of code inside the app delegate but that also get stop sending data after certain time due to iOS backgrounding time restriction of 10 min.
Can some body suggest what will be the proper way to get data continuously from the parent app to companion app even when parent app is in background.

public override void DidEnterBackground(UIApplication application)
{
var taskID = UIApplication.SharedApplication.BeginBackgroundTask(() => {
if(SessionManager.session.Paired && SessionManager.session.Reachable)
{
Console.WriteLine("Start the background task.......");
timer = NSTimer.CreateRepeatingScheduledTimer(20, UpdateUserInterface);
UpdateUserInterface(timer);
Console.WriteLine("Running out of time to complete you background task!");
UIApplication.SharedApplication.EndBackgroundTask(taskID);
}
});
}

Sign In or Register to comment.