My tablet runs Windows 8.1 pro.
It has a background task which is triggered by a Time Trigger every 15'. It works, fair enough.
The problem is that I need to auto-launch my background task at every single boot (start app) of my device.
I registered my bg by this code:
builder.Name = "bikePositionUpdate";
builder.TaskEntryPoint = "BackgroundTaskGps.BikeGPSPositionUpdateBackgroundTask";
builder.SetTrigger(new TimeTrigger(15, false)); //
// adding condition
SystemCondition internetCondition = new SystemCondition(SystemConditionType.InternetAvailable);
SystemCondition userPresentCondition = new SystemCondition(SystemConditionType.UserPresent);
builder.AddCondition(internetCondition);
builder.AddCondition(userPresentCondition);
BackgroundTaskRegistration taskRegistration = builder.Register();
my app has lock screen access
await BackgroundExecutionManager.RequestAccessAsync();
How can I achieve this? Am I missing something?
Select Start , then select Settings > Privacy > Background apps. Under Background Apps, make sure Let apps run in the background is turned On. Under Choose which apps can run in the background, turn individual apps and services settings On or Off.
You can access the Task Manager by pressing the Ctrl + Alt + Del shortcut keys on your keyboard, then select Task Manager. You can also right-click with your mouse on the Windows Taskbar and select Task Manager.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With