0

Possible Duplicate:
Listen to volume buttons in background service?

I really need that when hard button (VOLUME_UP) is pressed for 3 seconds it triggers actions like display a normal activity and send messages.

AFAIK, there's no such thing like listen to a button in a service. But I really need it (or something similar to it) so I'm trying to find a workaround on the internet. I've found that only some buttons (and not the one I want to use) broadcast info about their events and found something about to use a custom IME (input method editor). I'm looking for how that IME stuff works and I'm here for another (any) ideas!

Thank you all!

Community
  • 1
  • 1
Virgílio Santos
  • 412
  • 2
  • 13
  • Apparently this cannot be done. [Listen to volume buttons in background service?](http://stackoverflow.com/questions/10154118/listen-to-volume-buttons-in-background-service) – Sam Oct 29 '12 at 17:13

1 Answers1

1

You can't listen to hard buttons in a background service. You can listen to soft buttons in a foreground service, though.

This is a security feature. If you were allowed to start something with a hard button, you'd be able to get around the lock screen.

Can you elaborate on the use case? There may be other ways to tackle your problem.

Joe Malin
  • 8,621
  • 1
  • 23
  • 18