user2508630
user2508630

Reputation: 107

Windows Phone c# how to catch global hook

I have simple app:

public MainPage()
{
    InitializeComponent();
    CameraButtons.ShutterKeyPressed += OnButtonFullPress;           
}
private void OnButtonFullPress(object sender, EventArgs e)
{
    //camera button pressed
}

When my app is active, all is great, but, when my app is not active, i cant catch, when camera button were pressed.

Is this possible with default SDK?

Upvotes: 1

Views: 86

Answers (2)

James Croft
James Croft

Reputation: 1680

Unfortunately, this is not possible for third-party developers. You can only access the hardware buttons while your applications is running.

Upvotes: 0

Anton Sizikov
Anton Sizikov

Reputation: 9230

There is a way to set your application as a default camera app on windows phone 8, but this feature is only available for 'special' developers like Microsoft, Nokia or other hardware companies. So it's not possible for you, most probably.

http://forums.windowscentral.com/windows-phone-8/234751-changing-default-camera-app.html

Also if you look at the application lifecycle you'll see that after user minimizes your app it might be tombstoned and even unloaded from the memory. So, you loose the control over the device resources. That means that you can't get any events except the awake event.

The third option you have is to run the app under the lock screen, but it doesn't fit you as well. There is a limited set of api's you can use in this mode. (Location and Audio).

So I'm sorry, but you can't do anything so far.

Upvotes: 2

Related Questions