I recently learned how to develop Windows Phone 7, so I was afraid to forget to copy something.
1. WP7 architecture: the WP7 architecture is based on Microsoft's. NET platform. In terms of application architecture, sliverlight and xNa work together to develop applications using sliverlight.Program, Using xNa to develop games
WP7 uses a subset of. NET and a class library of sliverlight and xNa.
2. Windows Phone 7 Lifecycle
Windows Phone is a multitasking operating system, but does not support multithreading, so I think it should be a fake multitasking.
It only has one third-party application that can run on the frontend. When the user leaves the page of the current program, the application will be terminated by the operating system.
Screen lock incoming call short message reminder function low power program switching users clicking the start button may cause application interruption
Tombstoning tombstone freezing is a major feature of the life cycle of WP7.
The deactivated state (terminated) re-activated state (activated) running state (running)
Lifecycle Processing Event application_launching when the program is started, call the program re-activation without calling it. Usually some permanent configuration data (persisted data) is loaded from isolated storage)
Application_closing is called when the program is closed. When the program is disabled, it is not called. Usually, some permanent configuration data (persisted data) is saved to isolated storage.
Application_activated is called when the program is re-activated. When the program is started, it is not called. Generally, phoneapplicationservice. State is used to save some temporary data (transient data)
Application_demo-vated is called when the program is not activated. When the program is closed, it is not called normally from phoneapplicationservice. state to read some temporary data (transient data) to restore the status when the user leaves the page, to maintain user experience consistency.
Note the following terms in WP7:
WP7 provides two methods to obtain data: isoloated storage and state. The former can store data for a long time, while the latter can only obtain data without eliminating your state in the memory.
In WP7, if an application is not loaded in 10 seconds, it will be forcibly disabled by the system.
3. launchers and Selector)
Windows Phone applications cannot directly access other storage information, such as contact information.
Windows Phone applications cannot directly call other functions, such as phones and short messages.
The initiator and Selector provide applications with indirect access to these built-in functions, and the operating system may terminate the current application when the initiator and Selector are running.
Starter: Start a built-in program and provide it to the user without returning any data to the called program.
Selector: Start a built-in program to provide users with the data returned to the called program. When the user completes the operation, the call to support blood will be re-activated and the returned data will be received, but the user may cancel the operation so that null is returned.
Built-in starter emailcomposetask marketplacedetailtask marketplacehubtask marketplacereviewtask marketplacesearchtask mediaplayerlauncher phonecalltask searchtask smscomposetask webbrowsertask
Built-in selector cameracapturetask emailaddresschoosertask phonenumberchoosertask photochoosertask saveemailaddresstask savephonenumbertask
There may be no tombstone tasks photochoosertask cameracapturetask mediaplayerlauncher emailaddresschoosertask phonenumberchoosertask phonecalltask (neither deactived event is called)
4. Push Notification Service
The Windows Phone execution model determines that only one third-party application can run third-party applications in the background. The third-party applications cannot pull data to the cloud in the background. Microsoft provides the push notification service to third-party applications for update notifications. the active communication initiated by the message server can effectively reduce battery consumption.
The current version of Windows Phone only supports a maximum of 15 third-party applications to use the push notification service.
The message types include:
Raw notification can be used to send data applications in any format. You can process notification messages related to data applications as needed. Only notifications sent when the application is running
The data sent by toast notification is in the specified XML format. If the application is running and the content is sent to the application, if the application is not running, a message is displayed in the toast message box.
Data sent by tile notification is not sent to the application in the specified XML format. If the user's application pin is the same as start,
The updated data is sent to the title of the Start Screen (including three attributes, the background, the title, and the counter. Each attribute has a fixed format and position, and the attributes can be used, it is not recommended to use three attributes together)
Push Service details andCodeHttp://www.lob.cn/jq/wp7/7491.shtml
5. location service)
Location service helps developers develop location-aware applications for Windows phones.
Location service can obtain location information from multiple data sources, such as GPS, Wi-Fi, and mobile network base stations.
Based on application requirements, location service calculates location information from one or more data
Effective balance of battery consumption and location information accuracy provides an event-driven unified interface for Applications
Try to reduce battery consumption
If possible, use the data source with lower accuracy
Enable the location service when necessary. Once the service is ready for use, it is immediately disabled.
Set the threshold of accuracy to reduce the update frequency.
Use the status update event (statuschanged) to monitor the service status and remind users to update the status.
Remind the user to wait for a period of time (15 seconds to 120 seconds) when starting the geographic location service for the first time)