在不运行应用程序的情况下以固定间隔更新动态磁贴间隔、应用程序、情况下、动态

2023-09-06 06:53:45 作者:霸剑横空

如何使用 JavaScript 以固定的时间间隔(例如半天)更新应用的动态磁贴?

How can I update my app's live tile at a fixed interval, for example half a day, using JavaScript?

此外,即使应用程序本身没有运行,它也必须能够更新(例如天气应用程序)

Moreover, it has to be able to update even though the app itself is not running (like the weather app for example)

我想在本地更新它而无需连接到互联网.请在 JavaScript 中给出一些示例,而不是 C#!

I want to update it locally without having to connect to the internet. And please give some example in JavaScript, not C# please!

更具体地说,例如,如何将磁贴设置为每天更新一次,显示当前日期?

To be more specific, for example, how can I set the tile to update once per day, showing the current date?

推荐答案

您可以按计划使用后台任务,间隔时间超过 15 分钟.这些任务被设计为由与您的应用程序分开的操作系统运行,因此如果它不活动或未打开,则会执行.这是一篇关于后台任务入门的详细博客文章:http://www.silverlightshow.net/items/Windows-8-metro-make-your-app-alive-with-background-tasks.aspx

You can use a background task on a schedule for an interval for anything greater than 15 mins. The tasks are designed to be run by the OS separate to your application, so will be executed if it is not active or open. Here is a detailed blog post on getting started with background tasks: http://www.silverlightshow.net/items/Windows-8-metro-make-your-app-alive-with-background-tasks.aspx