Nokia Windows Phone: Question 9

Yep. we’re still running a challenge wherein you can Win a Nokia Windows Phone. The rules are detailed in the aforelinked post. We missed a night, to keep you on your toes, here is question 9, our third last as we have Friday and Monday remaining.

Question 9

One of the topics that can be challenging for developers is the application lifecycle model for Windows Phone. There are a number of aspects that you need to consider when developing your application to correctly handle fast application switching and tombstoning.

Give an example of an issue that you’ve faced that relates to the lifecycle of a Windows Phone application and how you have addressed it?

Free book: Jump Start HTML5 Basics

Grab a free copy of one our latest ebooks! Packed with hints and tips on HTML5's most powerful new features.

  • Craig Naumann

    I thought I was pretty comfortable saving and restoring states using the PhoneApplicationService State dictionary, until I added more and more pages. Trying to track that and restore when resuming from tombstone was a nightmare. It wasn’t until Nick (thanks, by the way) educated me in the fact that there was also the page State dictionary I could use in OnNavigatedFrom to save and OnNavigatedTo to restore page state. Now my tombstone code is much simplier.

  • Garth Bacon

    My app was being terminated before all the state data was being saved, and when it was reactivated it was missing data. I found this extract on MSDN which solved the probelm:

    “All of the application events have a limit of 10 seconds for the application to complete the tasks in the event handler. If an application exceeds this limit, it will be immediately terminated. For this reason, you should avoid performing resource-intensive tasks, such as reading from and writing to isolated storage within the handlers for the application events. These tasks should be performed on background threads while the application is running, whenever possible. Saving application data as it changes, throughout the lifetime of the application, reduces the amount of state management you need to perform during the application events.”

  • http://nicksnettravels.builttoroam.com Nick

    The competition is now closed for entries. The following entries have been recorded for this question. If, for whatever reason, your entry is not in this list, please feel free to respond
    Craig Naumann (2 entries as first answer)
    Garth Bacon

  • http://www.sadececicek.com/ çiçek gönder

    ye My app was being terminated before all the state data was being saved, I had this problem,