In some cases, we need to listen for events that the application switches to the background or switches from the background to the foreground to do the related processing. Alipay Application Lock screen (Ios,android platform) in the processing of the need to listen to this event, in the user will be applied to switch to the background after a period of time and then switch to the foreground of the situation will need to pop-up lock screen page.
The following diagram shows the life cycle diagram of the Windows Application Store application, where the front and rear switches are switched directly between running and suspending, and a detailed introduction to the lifecycle can be found in the official documentation: http://msdn.microsoft.com/zh-cn/library/ Windows/apps/hh464925.aspx#app_visibility.
The program goes into a pending state, triggering the App.suspending event, but the App.resuming event is triggered when the program cuts back to the foreground, and the following describes several scenarios where the application enters a pending state and triggers the App.suspending event.
1. In the foreground, the application enters a suspend state after approximately 10 seconds, by dragging the left side to open the other application.
2. Press the home key will apply to the background, the middle of the other applications do not open the case again press the home key will be applied to the foreground, the application will not enter the suspend state.
3. Pressing the home key will apply to the background, and then open another application, then open another application 10 seconds after the application into a suspend state.
4. Application in the foreground situation, press the power button or the system automatically into the lock screen State 10 seconds after the application into a suspended state.
5. It is necessary to note that the application lifecycle cannot be judged under debugger circumstances, and that the application will not enter a pending state in any case.
For applications running on the Visual Studio debugger, the system will not be able to determine the application state, causing events such as suspend, resume, activate to not be triggered correctly, so Visual Studio provides a debug Location the toolbar to manually trigger events such as suspend, resume, and so on. The way to turn on debug Location is to click the View menu above Visual Studio, Toobars-> Debug Location, so that you can see the specific options in the toolbar.
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/OS/home/