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

  1. using thread
  2. 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

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -