How to register for Win8 periodic tile notificatio

2020-06-05 05:32发布

问题:

I am working on a Win8-UI-App (previously called Metro...) and trying to implement Periodic (Documentation for different methods) Tile Updates (Live Tiles) for the first time.

I found a couple of very good resources on the internet and was able to do it. Unfortunately the question of where I should register for the notifications remained unsolved:

Do I have to register for Notifications every time the app starts (e.g. in the App.xaml.cs OnLaunched() Method)? - Or is there an other, more professional way to do so? (I could imagine to save if I already registered for the service or is there a variable I can access to see whether notifications are registered?)

thank you!

PS: For everyone who is also new to this see this StackOverflow post, this example, the tile template types and the Dev Center for quick starting :)

回答1:

Periodic updates will continue until they are explicitly stopped or your app is uninstalled. Technically, you only have to do that once. But, the Guidelines and checklist for periodic updates states

Call the StartPeriodicUpdate or StartPeriodicUpdateBatch method each time your app is launched or brought into focus. This ensures that the tile content will be updated each time the user launches or switches to the app.

According to that, App launch and App resume are good candidates for a call to StartPeriodicUpdate.