How to update a visually live fragment every minute of a Windows Store application in JS / HTML / CSS?

I would like the live panel of my application to be updated every time the user opens the Start screen, since its live function is โ€œonlyโ€ visual (it is not necessary to be on a locked screen or execute certain logic in the background, for example)

In the Windows Store you can find the โ€œclockโ€ application, which will show you the time on the start screen through its live tile application, usually with a granularity of every minute no more. That would be perfect for me.

Watch in live tile. http://img812.imageshack.us/img812/8143/watchtile.png

These applications seem to have a much more accurate time interval than those known in 15 minutes and they run in the background (these applications request permission).

So what happens every 15 minutes? Why are these tiles not limited to this interval of 15 minutes? I heard that they can use the notification queue, but they still need to be updated for 1 minute ...

Thank you for help!

+4
source share
3 answers

You can use TileUpdater.addToSchedule to schedule up to 4096 notifications . So, I assume that one of the approaches:

  • Set up the maintenance task for a certain period of time (not necessary on the lock screen for this).
  • When performing a task:

    2a. Empty the notification queue.

    2b. Schedule a bunch of notifications, one for the moment + 1 minute, one for the moment + 2 minutes, etc. (register less than 4096 and do not register more than you really need.)

Your maintenance task can be scheduled daily, but you can schedule notifications in 2 days in case it does not start on time.

The main drawback is that if the user has been running on battery power for more than two days (or, apart from what you are planning), your notifications stop until they connect and your maintenance task will not work.

If you do not need an update every minute, you can plan them further into the future (i.e. a week or more if you do it every 5 minutes).

+2
source

Pay attention to the types of notifications found here .

The 15-minute limit you specify is discussed in the periodic notifications found here .

Local, scheduled, and push notifications can probably all do what you need, although I'm less sure about scheduled notifications, since I think there is a limit to the number of them that you can queue at a time.

(I think I have not tested this). A local notification can be used to send style updates from a background task, but there is a restriction for this that your application must meet in order to work.

Push notifications come from a cloud service and can happen while your application is not running. Unfortunately, this requires a cloud service.

+1
source

My team member here at Microsoft, Michael Palermo (blog here ) has a similar app called Time Tile

This seems to be a very simple application, but the trick here, as I understood it from it, was to schedule a background job for the next fifteen minutes for each update and ensure there were no duplicates. This seems like a lot, but to eliminate time constraints for background tasks.

+1
source

All Articles