How to start background task at boot - Windows Store app

坚强是说给别人听的谎言 提交于 2019-12-01 15:07:42

You have to add the SystemConditionType.SessionConnected condition, this condition happen every time the user log on to Windows.

An app must be placed on the lock screen before it can successfully register background tasks using this trigger type.

Edit:

On this url you can find the official documentation about what you need, and how to use it:

https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh977056.aspx

https://msdn.microsoft.com/en-us/library/windows/apps/xaml/windows.applicationmodel.background.systemtriggertype.aspx

I think you should add SystemConditionType.SessionConnected condition,where this condition will check every time theuser log on to Windows

Have you tried adding it to run on startup in the registry?

I dont have 8.1 to check but if hasnt changed from win7 the path should be HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run (or HKEY_LOCAL_MACHINE) just create a new string value with the path to your app and it will be run when windows starts

result of this await BackgroundExecutionManager.RequestAccessAsync(); should be like AllowedWithAlwaysOnRealTimeConnectivity.

Which means : The user chose "allow" in the dialog box. The app is added to the lock screen, can set up background tasks.

And this BackgroundTaskRegistration taskRegistration = builder.Register(); you sholud call after await BackgroundExecutionManager.RequestAccessAsync();

Have you tried adding your application to Windows Task Scheduler as part of the installation process?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!