WP7 does not support multitasking? Analysis of Application Running Mechanism

Source: Internet
Author: User

Still released by Microsoft on TuesdayDevelopment tools for Windows Phone 7 BetaWhen hackers crack and extractBuilt-in ringtones and wallpapersAfter that, Microsoft officially started a more in-depth explanation of new features. Among them, the most important concern is whether Windows Phone 7 supports multitasking. The Microsoft development blog analyzes the application switching mechanism of WP7.

First, let's talk about some basic rules for WP7 system program running,Microsoft does not allow any third-party applications to run in the background of WP7, Within a specific period of timeOnly one application is running on the frontend.,If your application is not displayed on the foreground, it indicates that these programs are not running.In this way, the running memory and processor resources are not consumed. In this way, the main purpose is to prolong the battery life and ensure a consistent user experience.

However, all WP7 mobile phones will be equipped with the return button hardware. In addition to the return navigation function, this button also supports switching between applications, for example, when you click a webpage link in an application and then call the built-in browser to view the link, you can press the return key to return to the application.

Now the problem arises. When the current application is switched back to the previous application, will it recover an application or re-open the application? As we have already said, WP7 does not allow programs to run in the background, but the difference between the two is that it does not keep the usage status when it is re-opened, and the recovery can continue to use, let's talk about Microsoft'sTombstone Mechanism.

The tombstone is a processing mechanism that Microsoft uses to switch the application status for WP7. Taking the process as an example, when a user is using an application, such as a game or news reading, a call is called in, the incoming call prompt and call page will be displayed on the front-end. Running games will disappear, but WP7 does not allow applications to run in the background. In this case, the tombstone mechanism will be triggered,The running status of the game, including the screen, progress, and other data, will be frozen and saved.It is equivalent to a pause, but the game does not run. This is also the meaning of the tombstone name: The application is dead, but the tombstone records all the statuses before the death. After the call ends, the game OS restarts the application process and passes the status data to the application for recovery. This is equivalent to crawling the application from the cemetery, restore the data according to the recorded status on the tombstone.

In the program code example, Microsoft provides the running status code of a single application. There are four apps in total. xaml. cs files. The Code directly related to the execution mode are Application _ Launching, Application _ Activated, Application _ Deactivated, and Application _ Closing, which are startup and resurrection (the Activation Program is restored) disable (record the tombstone data) and close (close permanently ). Developers need to note that they need to use tools and related code provided by Microsoft during the development process to allow their applications to support the tombstone mechanism, otherwise, when the user is in use, suddenly a call will have to manually open the program and re-start again, which will make the user very uncomfortable.

In the early WP7 system, Microsoft did not completely kill the process when the program was not running, but paused it. However, this caused chaos in the background running stack, API and event triggers often encounter problems, so Microsoft decided to use the tombstone mechanism.

However, the complete implementation of the tombstone mechanism will affect some telephone functions, such as text messages, instant messaging, weather, and other applications that require constant operation and updates. Microsoft also providesPush Notification Services APIsAllows applications to call this interface to maintain real-time updates.

If you want to learn more about Microsoft's Application Execution Mode and Beta development kit, go to windowsteamblog.com/windows_phone/ B /wpdev/ "target = _ blank>Microsoft official blog.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.