c# - Windows store app 8.1 - Background Task not triggered -


i new windows store app , trying use background task.

i register on button click event way: var builder = new backgroundtaskbuilder();

         builder.name = "bikepositionupdate";          builder.taskentrypoint = "backgroundtaskgps.bikegpspositionupdatebackgroundtask";          builder.settrigger(new timetrigger(15, false)); //            backgroundtaskregistration taskregistration = builder.register(); 

so supposed launched within 15'.

here task:

namespace backgroundtaskgps {     public sealed class bikegpspositionupdatebackgroundtask : ibackgroundtask     {         public void run(ibackgroundtaskinstance taskinstance)         {              debug.writeline("run run run");         }     } }  

and here manifest

...       <extensions>         <extension category="windows.backgroundtasks" entrypoint="backgroundtaskgps.bikegpspositionupdatebackgroundtask">           <backgroundtasks>             <task type="timer" />           </backgroundtasks>         </extension>       </extensions> ... 

but run method never hit.

please problem?

ps: testing app on local machine (the same development pc).

please consider not talking windows phone app windows app

for windows phone must need call this

await backgroundexecutionmanager.requestaccessasync(); 

so complete code is

await backgroundexecutionmanager.requestaccessasync();  builder.name = "bikepositionupdate";          builder.taskentrypoint = "backgroundtaskgps.bikegpspositionupdatebackgroundtask";          builder.settrigger(new timetrigger(15, false)); //for windows phone 8.1 minimum 15 minutes           backgroundtaskregistration taskregistration = builder.register(); 

Comments