开发者

windows phone 7 keep application running on back button

I'm implementing an application t开发者_Go百科hat should not stop running on clicking any button on the device. Is this possible and how can I achieve this?

Regards


Windows Phone 7 does not support multitasking (running applications in the background). Read more about application lifecycle from documentation. Mango the next version of Windows Phone 7 will support running some code in the background.

Currently the best you can do is save the application state when the app is quit or sent to the background. For simple settings (key-value pairs) you can use IsolatedStorageSettings and for more complicated stuff you'd use IsolatedStorage file system.

This is a really great article about application life cycle and state saving. And here is an overview of IsolatedStorage.


Your app will be tombstoned. You will need to do a little research on that.

There are a number of options that folks in the community have built that can help. It all depends on what you want to do. If your model is complex you will most definitely be serializing to Isolated Storage (but there are some projects out there that can do this.

A pretty simple one to use is this one: http://tombstonehelper.codeplex.com/


There is a whole set of updates expected to drop next week (2011-05-24) and background tasks are posited to be one of the things affected.

With publicly available tools the best you can have is "runs under lock" which you achieve by following these instructions.

Be aware that there are strictly limited scenarios under which this behaviour will pass compliance testing, because you will severely hammer the battery.

Your question about isolated storage is a good one. This is one of only two ways to preserve state. The other is to use a web service to store state on a server (cloud computing).

To directly answer one of your questions, no, it is not possible to create a process that cannot be interrupted by any of the buttons. This is all about resource management and preserving the user experience. The architecture of a WP7 app is entirely UI driven. Only one user process is ever running and the user may pre-empt this at any time by invoking another application. This makes it almost impossible to write logging services, but imminent updates may change the game.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜