How to simulate the lock screen for Windows Phone 8
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
This topic contains the following sections.
In an ordinary app, the following events occur.
When the phone is locked, first the Obscured event is raised, and then the Deactivated event is raised. You can check the IsLocked property of the ObscuredEventArgs to determine whether the lock screen caused the deactivation.
In an app that use location services and that is specially configured to run continuously in the background, the following events occur.
The Lock Screen option buttons in the Simulation Dashboard are not synchronized with the actual screen state of the target device. For example, if you’re testing your app on a phone and you manually engage or disengage the lock screen on the phone itself, the state of the Lock Screen option buttons on the Simulation Dashboard is not updated.
To simulate locking or unlocking the phone
Run your app on the emulator or a connected device, with or without debugging.
Or, run your app with app monitoring and profiling to measure its quality and performance. For more information about app monitoring and profiling, see Windows Phone Application Analysis for Windows Phone 8.
In Visual Studio, on the Tools menu, open Simulation Dashboard. Find the Lock Screen section of the dashboard.
To engage the lock screen and lock the phone, select Locked.
Test how your app handles deactivation.
To disengage the lock screen and unlock the phone, select Unlocked.
Test how your app handles activation.