For background task with timers to launch you must ensure that your app is added to the lock screen. You can request to be added as a lock screen application by adding the following code to your project:
var Background = Windows.ApplicationModel.Background;
var promise = Background.BackgroundExecutionManager.requestAccessAsync().then(
function(result) {
switch (result) {
case Background.BackgroundAccessStatus.denied:
// Background activity and updates for this app are disabled by the user.
break;
case Background.BackgroundAccessStatus.allowedWithAlwaysOnRealTimeConnectivity:
// Added to list of background apps.
// Set up background tasks; can use the network connectivity broker.
break;
case Background.BackgroundAccessStatus.allowedMayUseActiveRealTimeConnectivity:
// Added to list of background apps.
// Set up background tasks; cannot use the network connectivity broker.
break;
case Background.BackgroundAccessStatus.unspecified:
// The user didn't explicitly disable or enable access and updates.
break;
}
});
You can also check to see if your app is a lock screen app by using the following code:
var Background = Windows.ApplicationModel.Background;
var result = Background.BackgroundApplications.getAccessStatus();
switch (result) {
case Background.BackgroundAccessStatus.denied:
// Disabled by the user.
// Cannot display on the lock screen.
break;
case Background.BackgroundAccessStatus.allowedWithAlwaysOnRealTimeConnectivity:
// Added to list of background applications.
// Can display on the lock screen.
// Can set up background tasks and use the network connectivity broker.
break;
case Background.BackgroundAccessStatus.allowedMayUseActiveRealTimeConnectivity:
// Added to list of background applications.
// Can display on the lock screen.
// Can set up background tasks but cannot use the network connectivity broker.
break;
case Background.BackgroundAccessStatus.unspecified:
// The user didn't explicitly disable or enable.
break;
}