win universal app - Background Task does not run in UWP -


i have uwp application want add background task support doing things while application in background. doing mentioned here: https://msdn.microsoft.com/en-us/windows/uwp/launch-resume/create-and-register-a-background-task

i have 1 separate project background tasks , in package manifest file have declared app uses background tasks (but "timer" task since using timertrigger). code:

backgroundtaskbuilder backgroundtaskbuilder = new backgroundtaskbuilder { name = "notificationupdater", taskentrypoint = "namespaceofmybackgroundtaskinterfaceimplementation.backgroundtask"};  backgroundtaskbuilder.settrigger(new timetrigger(15, false));  backgroundtaskregistration backgroundtaskregistration = backgroundtaskbuilder.register(); 

now, when launch app (via visual studio), , use lifecycle events dropdown suspend app, never executes run() method in backgroundtask class (implementation of ibackgroundtask interface). code inside backgroundtask class:

namespace namespaceofmybackgroundtaskinterfaceimplementation {     public sealed class backgroundtask : ibackgroundtask     {         public async void run(ibackgroundtaskinstance taskinstance)         {             //code run in background         }     } } 

as turned out in conversation, problem in wrong declaration of project type. in should windows runtime component.

for followers, please take at answer, describes steps. answers silverlight 8.1, process , steps same in winrt , uwp.


Comments

Popular posts from this blog

javascript - How to get current YouTube IDs via iMacros? -

c# - Maintaining a program folder in program files out of date? -

emulation - Android map show my location didn't work -