Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You are somewhat constrained as to when your background tasks run on the phone. The OS will also move the scheduled time of the tasks if it can execute multiple at the same time - to avoid having to wake up the phone twice. If you're wanting to update the tile every 5 minutes then push notifications are your only option. But you should probably be considering if the user will actually look at information that regularly.</p> <p>I go for a halfway approach - I use a <code>PeriodicTask</code> to update my shell tiles as the OS allows but then when the application launches I manually refresh the tiles with the latest information. This allows the user to "force" the tile data and additionally provides more realistic data after the user has exited the application.</p> <p>To get around the 14 day expiry re-register your background task on every launch of your application. That'll keep pushing the 14 days out. It's intended to prevent unused applications from using precious resources - if your user is launching your application they probably still want the background agent to run. And if not, they can disable it through Settings > Applications > Background Tasks (or by uninstalling, obviously). To register your task execute something like the following in initialisation code;</p> <pre><code> PeriodicTask task = ScheduledActionService.Find("MyTaskName") as PeriodicTask; if ((task != null) &amp;&amp; (task.IsEnabled == true)) { ScheduledActionService.Remove("MyTaskName"); } task = new PeriodicTask("MyTaskName") { Description = "My Periodic Task", }; ScheduledActionService.Add(task); #if DEBUG if (System.Diagnostics.Debugger.IsAttached == true) { ScheduledActionService.LaunchForTest("MyTaskName", TimeSpan.FromSeconds(10)); } #endif </code></pre> <p>The <code>#if DEBUG</code> allows you to schedule the task straight after execution for testing scenarios.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload