Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Background task with completion handler is not working(IOS)?

$
0
0

Hello, I'm working on a project where I want to run a long running background task (Xamarin forms ios). I used Background task with completion handler, but the problem is, it works only while debugging the application. Here is my code :

Task.Factory.StartNew(() =>
            {
                DidEnterBackgroundId = UIApplication.SharedApplication.BeginBackgroundTask(() =>
                {
                    UIApplication.SharedApplication.EndBackgroundTask(DidEnterBackgroundId);
                });
                while (!_backgroundEntryTime)
                {
                    BackgroundUpdates.UpdateCurrentStatus();
                    BackgroundUpdates.BeginLocalToServerSync();
                }
                UIApplication.SharedApplication.EndBackgroundTask(DidEnterBackgroundId);
            });

can anyone help me with this.

Viewing all articles
Browse latest Browse all 204402

Trending Articles