Small question. I now have a mango windows p开发者_JAVA百科hone 7 app that will upon launch contact a web service and update the tile pinned to the main screen with some status text ( I add a number on the Title text ).
I would like to schedule this, so the user doesn't need to open the app... but what would be the best choice? Background tasks?
The problem lies with the web service and the restrictions of those agents in time and memory I guess?
Any thoughts suggestions?
You have three ways to update live tile from background:
First is to use ShellTileSchedule
class. It allows you to schedule update your live tile image from remote uri. There are some restrictions for image size and loading time. Also schedule voids if system is unable to load image several times.
Second way is to use push-notifications
. There are also some similar restrictions for it.
Third way is to use background agents.
There is not a "best choice". The choice depends on many things. For example - mango is just coming and it is possible that some users will get it in several months. And if you update your application to mango version - you will loose ability to send WP7.0 updates for your app. In other way - push-notifications and tile schedules requires you to generate tile on server side. And if you decide to use schedules - you should draw text and number as part of downloadable image.
oxilumin's answer greatly details what options you have.
As for the ShellTileSchedule
solution, I've written a article on how you can generate a Live Tile directly on the phone, with the data you requested from the web-service:
How To: Generate a custom live tile directly on the phone
If you choose the push-notifications
solution, you need the generate the entire tile (a 173x173 pixels image) on your webservice, and send the new image as part of the push-notification.
精彩评论