我的平板电脑运行Windows8.1pro。
它有一个后台任务,每15‘由一个时间触发器触发。很管用,很公平。
问题是,我需要在设备的每一个启动(启动应用程序)上自动启动我的后台任务。
我通过以下代码注册了我的bg:
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();我的应用程序有锁定屏幕访问
await BackgroundExecutionManager.RequestAccessAsync();我怎样才能做到这一点?我是不是遗漏了什么?
发布于 2015-09-07 09:12:27
您必须添加SystemConditionType.SessionConnected条件,此条件每次用户登录到Windows时都会发生。
在使用此触发器类型成功注册后台任务之前,应用程序必须放在锁定屏幕上。
编辑:
在这个url上,您可以找到关于您需要什么以及如何使用它的官方文档:
https://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh977056.aspx
发布于 2015-09-07 11:44:46
I think you should add SystemConditionType.SessionConnected condition,where this condition will check every time theuser log on to Windows发布于 2015-09-03 17:15:32
您是否尝试过在注册表中添加它以在启动时运行?
我没有8.1需要检查,但是如果没有从HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run更改路径,那么路径应该是win7 (或HKEY_LOCAL_MACHINE),只需创建一个新的字符串值,并在windows启动时运行
https://stackoverflow.com/questions/32229375
复制相似问题