xamarin.ios - MonoTouch running NSTimer even when app is in background -
in app want run timer when app goes in background. guess there 2 ways
- using thread
- capturing time when app goes in background , comes back
i dont know way better? if use threading, how long works? work hours in background?
thank you
if you're app entered background state, have not time stop current threads.
you run background task that:
... public partial class appdelegate : uiapplicationdelegate { ... public override void didenterbackground (uiapplication application) { int taskid = uiapplication.sharedapplication.beginbackgroundtask ( () => {}); var task = new thread (new threadstart (() => { // save application's current state. })); task.start (); }
thus you'll have 10 minutes
.
yet ios
doesn't allow run app infinite time. see backgroundexecution demo reference.
Comments
Post a Comment