Over a million developers have joined DZone.

Simulating tombstone (suspended state) on Windows Phone 7 emulator

· Mobile Zone

Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud, brought to you in partnership with IBM.

Since Windows Phone 7 doesn’t have multitask, at least for now, Microsoft implemented a Tombstone notion in WP7 apps.
It’s basically a suspended state where you receive a notification that it’s going to suspend but there is no guarantee that it will resume, it might be terminated so you must treat this as an exit and a might start again state.

So depending on you app you might want to save the current state just in case the app really closes.

Simulating this on the emulator took me awhile to get it right.

Press F5 on Visual Studio do start debugging your App.
Press the Start button and your app received a Deactivated event. Save what you need. Now, and here is the tricky part, the debugger also exited.
This took me awhile because pressing the back button wouldn’t do anything and pressing F5 again would just restart.

So you have to Press F5 and keep an eye on the compiler. When you receive a “Deploy Success” message

quickly press the Back button on the simulator

You app should now start and receive the Activated event.
Basically the debugger has to start between you pressing the Back button and before the black screen disappears otherwise the emulator while assume the app is closed and get back to home.

The Mobile Zone is brought to you in partnership with Strongloop and IBM.  Visually compose APIs with easy-to-use tooling. Learn how IBM API Connect provides near-universal access to data and services both on-premises and in the cloud.


Published at DZone with permission of David Amador, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}