I have the same problem as this guy over here: UWP Timetrigger not working but I can\'t comment the question because my reputation is not high enough, so I\'m creating a new
I had exactly same problem with TimeTrigger (Application trigger was working without any issues) and I followed every step from MSDN regarding BackgroundTask in UWP. But ONLY below "magic line" helped me to solve - BIG THANKS to @Canol Gökel for his reply in comments (I think it deserve separate answer):
BackgroundExecutionManager.RemoveAccess(); // This is the magic line!
var backgroundAccessStatus = await BackgroundExecutionManager.RequestAccessAsync();
Time trigger is part of UWP background task sample (Scenario 4) which was working for me. But this line is not used there at all. Instead it is used in NFC sample during check if application was updated:
private static async Task<bool> DoBackgroundRequestAccess()
{
String appVersion = String.Format("{0}.{1}.{2}.{3}",
Package.Current.Id.Version.Build,
Package.Current.Id.Version.Major,
Package.Current.Id.Version.Minor,
Package.Current.Id.Version.Revision);
if ((string)Windows.Storage.ApplicationData.Current.LocalSettings.Values["AppVersion"] != appVersion)
{
// Our app has been updated
Windows.Storage.ApplicationData.Current.LocalSettings.Values["AppVersion"] = appVersion;
// Call RemoveAccess
BackgroundExecutionManager.RemoveAccess();
}
BackgroundAccessStatus status = await BackgroundExecutionManager.RequestAccessAsync();
return status == BackgroundAccessStatus.AlwaysAllowed
|| status == BackgroundAccessStatus.AllowedSubjectToSystemPolicy;
}
You can confirm that the your task is registered or not by using powershell. Open powershell with administrative rights, and run 'Get-AppBackgroundTask'. All of registered tasks are listed. If you can't find your task from the list, there are some problems at registration.
Have you add the background task project as a reference to your main app?
Have you call the BackgroundExecutionManager.RequestAccessAsync()? You should call it before registering, from UI thread.
https://www.microsoft.com/store/p/ddlgbgtasktrial/9nblggh4s785
This app regist a simple background task with 15min interval timetrigger. This task just output the debugmessage to the logfile. The app shows a log. If it works well, you can see the debug output with about 15min intervals.
I've confirmed that the app works with Win10 desktop 10586.494 and mobile 14393.0.