Nelson T Joseph
Nelson T Joseph

Reputation: 2763

Identify the screen is locked in WindlowsPhone

In my application I need to know when device is locked. How to detect when the screen is locked, also when unlocked.

Upvotes: 0

Views: 163

Answers (2)

Anton Sizikov
Anton Sizikov

Reputation: 9250

You can use Obscured/Unobscured events. But there are some limitations:

This event is raised when the lock screen is engaged or when some other action obscures the running application’s frame, such as an incoming phone call.

  • there is a delay. You got the Obscured event after screen locks. So, if you try to check the state and navigate to other page, your app may be killed by OS.

Upvotes: 1

Diana Mikhasyova
Diana Mikhasyova

Reputation: 1660

public App()  
{  
RootFrame.Obscured += Obscured;    
RootFrame.Unobscured += Unobscured;    
}  

Upvotes: 1

Related Questions