?

Log in

No account? Create an account
Windows Phone: updating your app's tile, simply (needed for DVLUP!) - Greg [entries|archive|friends|userinfo]
Greg

[ website | gregstoll.com ]
[ userinfo | livejournal userinfo ]
[ archive | journal archive ]

Links
[Links:| * Homepage * Mobile apps (Windows Phone, Win8, Android, webOS) * Pictures * LJBackup * Same-sex marriage map * iTunesAnalysis * Where's lunch? ]

Windows Phone: updating your app's tile, simply (needed for DVLUP!) [Dec. 8th, 2012|11:54 pm]
Greg
[Tags|, ]
[Current Mood |cheerfulcheerful]

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();
    tileEnum.MoveNext();
    var tile = tileEnum.Current;
#if WP8
    FlipTileData ftd = new FlipTileData();
#else
    StandardTileData ftd = new StandardTileData();
#endif
    // This next part is app dependent
    ftd.BackContent = "back of a medium tile";
#if WP8
    ftd.WideBackContent = "back of a wide tile";
#endif
    tile.Update(ftd);

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 greg@gregstoll.com.
LinkReply