Reputation: 3076
My WP8 app is set to run underneath the lock screen because it needs to continue to run even while the screen is locked, but I want to be able to detect when the user unlocks their screen, how do I do this?
What methods, if any, are called when the phone is unlocked?
Upvotes: 2
Views: 1890
Reputation: 9604
The frame's Unobscured
event will fire when the user unlocks (it will also fire Obscured
when the phone is being locked).
However these events will also fire for a MessageBox, a Reminder and the like so you will get other false positive. However it should be possible to detect the scenario you are after pretty easily.
See this MSDN link for more details.
Upvotes: 4
Reputation: 125610
There are two proper events on PhoneApplicationFrame
class for lock/unlock:
PhoneApplicationFrame.Unobscured Event
PhoneApplicationFrame.Obscured Event
There is a bit more description about that on MSDN: How to simulate the lock screen for Windows Phone
Upvotes: 3