ASP
ASP

Reputation: 1974

Is it possible to create a service that listens for Volume key (hardware) presses?

I am trying to create a service that listens Volume key events.

Whenever the volume key presses, the service should send an sms to a number, but I can't detect volume key event.

Upvotes: 2

Views: 1744

Answers (2)

Tad
Tad

Reputation: 4784

As far as I understand, you can not listen for key presses directly in a service (see this question).

On an unrelated note, it is hard for me to think of a reason to do what you want aside from writing malware.

Upvotes: 0

keyser
keyser

Reputation: 19189

You can use an OnKeyListener which can detect keyevents (including volume keys). You can find the keycodes here. Good Luck!

Upvotes: 2

Related Questions