|Windows Phone: updating your app's tile, simply (needed for DVLUP!)
||[Dec. 8th, 2012|11:54 pm]
Windows Phone Live Tiles are great, but setting up push notifications is a lot of work, and even running a background agent comes with limitations. There are two easier ways to update your live tile:
- One way is to just update it when the app runs. This is not as appealing to the user as one that updates in the background, but for some apps it might be good enough. For example, I'm going to do this in my Marriage Map app, as the data doesn't change very often.
To do this, here's some sample code:
var tileEnum = ShellTile.ActiveTiles.GetEnumerator();
var tile = tileEnum.Current;
FlipTileData ftd = new FlipTileData();
StandardTileData ftd = new StandardTileData();
// This next part is app dependent
ftd.BackContent = "back of a medium tile";
ftd.WideBackContent = "back of a wide tile";
Note that the code inside #if WP8 only works in the Windows Phone 8 SDK - I'm using the MSDN guide to share code between a WP7 and WP8 app, which has worked out great for me.
- Another way is to set up a schedule where the tile will update every hour (or so). The limitation to this technique is that you can only update the background image for the front of a tile this way, but for some apps this might not be an issue. To do this, see How to send a scheduled local Tile update for Windows Phone.
Note that the DVLUP challenges all require that your app
Include all 3 sizes of Live Tiles (must animate between at least 2 frames within the tile space with data, images, or text). so if you want to earn rewards during Pointstravaganza, you'll need to do something to make your tiles live!
See all my Windows Phone development posts.
I'm planning on writing more posts about Windows Phone development - what would you like to hear about? Reply here, on twitter at @gregstoll, or by email at email@example.com.