Question about best practice for communicating between main app and background task

noirsoft

New member
Mar 31, 2011
73
0
0
Visit site
My "PollenWatch" app development is chugging along, and I'm currently working on the task of getting my Live Tile to update even when the app is not running. I've looked over the docs, and I think I know how I should do it, but I'm not 100% sure.

My app queries a web site to pull an Xml document (formatted like an RSS atom) which contains the information I need to display in-app and on the tile.

My first question is should I even bother with synchronization between the main app and the PeriodicTask, or is it safe to just have the app update the tile info when it runs and the PeriodicTask do the same?

If I do synchronize, it looks like the preferred way would be to write the XML document to a mutex-protected file in isolated storage, then update the tile from that. Again, it seems like I would need to have both the app and the PeriodicTask updating the live tile, and this is why I'm not sure that I even need to save the XML to a file in the simple case.

If I eventually wanted to make it only pull the information if the file was out of date (data only updates once per day) then it would make sense to want to coordinate between the two and use the file as a local cache to avoid hitting the web site too often.

Does my understanding seem correct and in line with best practices? Thanks.
 
Last edited:

Westoncreg

New member
Jan 7, 2013
141
0
0
Visit site
Sir your app will be a life saver for me (super allergic to pollen) how ever I do not know which would be better just though I'd encourage ya :)
 

noirsoft

New member
Mar 31, 2011
73
0
0
Visit site
It's a lifesaver for me as the author. :) I'm getting data from pollen.com so it only works in the US, but would be willing to use other feeds in the future once I get the app basics settled. I really want to get a good live tile, lock screen, and toast notifications working before I publish it.
 

Members online

Forum statistics

Threads
323,187
Messages
2,243,412
Members
428,038
Latest member
chuffster