[英]How to turn on the Scheduled Task Agent after it is off by battery saver in WP7?
我在WP7应用程序中添加了Scheduled Task Agent以定期提醒。 在2-3天后测试时,代理将关闭,即使我打开应用程序并再次启动任务,它也不会再次返回。 以下是我在ScheduledTaskAgent中尝试过的内容:
protected override void OnInvoke(ScheduledTask task)
{
DateTime time = DateTime.Now;
if (time.Hour > 6 && time.Hour < 23)
{
getContent();
if (task.Name.Equals("PeriodicTaskDemo", StringComparison.OrdinalIgnoreCase))
{
ShellToast toast = new ShellToast();
Mutex mutex = new Mutex(true, "ScheduledAgentData");
mutex.WaitOne();
IsolatedStorageSettings setting = IsolatedStorageSettings.ApplicationSettings;
toast.Title = setting["ScheduledAgentData"].ToString();
mutex.ReleaseMutex();
toast.Content = "You are being notified!!";
toast.Show();
}
NotifyComplete();
}
}
省电模式不会禁用后台任务再次启动。 禁用代理的唯一原因:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.