I am learning win10 uwp and my goal is to perform an operation, for example, updating a tile when a user logs in.
I checked msdn and it seems like I need BackgroundTask. Therefore, I followed the instructions for creating and registering the background task found here https://msdn.microsoft.com/en-us/library/windows/apps/mt299100.aspx and on related pages.
BackgroundTaskBuilder taskBuilder= new BackgroundTaskBuilder();
taskBuilder.Name = "TaskClassName";
taskBuilder.TaskEntryPoint = "TaskNameSpace.TaskClassName";
taskBuilder.SetTrigger(new SystemTrigger(SystemTriggerType.SessionConnected, false));
taskBuilder.SetTrigger(new SystemTrigger(SystemTriggerType.UserPresent, false));
var registration= taskBuilder.Register();
The namespace and my class BackgroundTaskare placed in a separate project under the same solution and added to the "Declaration" tab of Package.appxmanifest with the selected property System Event.
My implementation IBackgroundTask
public void Run(IBackgroundTaskInstance taskInstance)
{
BackgroundTaskDeferral deferral = taskInstance.GetDeferral();
UpdateMyTile();
deferral.Complete();
}
, , , , .
, BackgroundTask , 15 . , .
BackgroundTaskBuilder taskBuilderT= new BackgroundTaskBuilder();
taskBuilderT.Name = "TaskClassNameTimer";
taskBuilderT.TaskEntryPoint = "TaskNameSpace.TaskClassNameTimer";
taskBuilderT.SetTrigger(new TimeTrigger(15, false));
var registration= taskBuilderT.Register();
SystemTrigger UserPresent, SessionConnected .
27/01/2016
@Jakie: no BackgroundExecutionManager.RequestAccessAsync();, https://msdn.microsoft.com/EN-US/library/windows/apps/windows.applicationmodel.background.systemtriggertype.aspx SessionConnected UserPresent
Windows 10, Windows Server 2016 Technical Preview Windows 10 Mobile: , , .
, .
BackgroundExecutionManager.RequestAccessAsync();, 10, , AllowedMayUseActiveRealTimeConnectivity, .
, , . eventID 19 100. , , ?