Updating the live tiles when the exits: WP8 weirdness

While working on the next version of my todo-list Windows Phone app 2Day, I encountered a strange issue with live tiles management I’m sharing in this blog post…



You can manage tiles of a Windows Phone application in several ways. You can setup the tile with a remote image URI that will be fetched and updated by the system. This is useful for example when the same tile is pushed to many users (for example in a news reader app). You can also setup the tile with a local image. In that case, you can generate the image dynamically on the phone based on specific user’s information.

This is what the later option that is used in 2Day:

2Day tiles

The workflow to do that is the following:

  • the user exits the app
  • an image is generated using the WritableBitmap class
  • the image is saved in the local storage of the app
  • the tile is updated using the ShellTile API

Upgrading 2Day to Windows Phone 8

While upgrading 2Day to Windows Phone 8, I decided to leverage fast-resume. Fast-resume is a new capability that can be used by Windows Phone applications. It allows to reuse the latest instance of the app when the user presses the tile instead of creating a new instance each time. All you have to do is to set the ActivationPolicy attribute to Resume in the WMAppManifest.xml file:

The issue

The problem I had was that after my app was suspended, it wasn’t able to start over with fast-resume.

The app was stuck in a “Resuming…” dialog. After several hours tweaking the code, I found out the issue disappeared when I removed the code which updated the live tile… Strange isn’t it ? Tweaking more the code, I found out it was the use of the WritableBitmap that was the cause of this issue. I searched over the Internet for a couple of days, asked in new dedicated topics on MSDN forums but no one had a solution.

My workaround

I finally decided to move the code which updates the tiles from the Deactivated event of the Application to the OnNavigatedFrom method of the main page of my app.

And that did the trick ! It’s working like a charm now 🙂


If you have a Windows Phone app and you’re updating tiles locally on the phone… Make sure to update your tiles when you’re navigating away from the main page and not in the Deactivated event 🙂

I’m not sure what is causing the problem… but it looks like I’m not the only one facing it as I was contacted on Twitter about the problem.



3 thoughts on “Updating the live tiles when the exits: WP8 weirdness

  1. I recently ran into the same problem. I think that the Application_Deactivated is not running in the correct thread. The following change fixed this for me:

    // rendering must be done on the UI thread
    // do livetile stuff here.

Leave a Reply

Your email address will not be published. Required fields are marked *