Listen to volume buttons in background service?
android, listen, volume
Solution
Judging by the couple of other questions about this topic, no.
Other question 1, Other question 2
Services simply do not receive KeyEvent callbacks.
Problem
I know how to listen to volume buttons in an activity. But can I do that in a background service? If yes, how to do that?
Related problems
- Is it possible to create an Android Service that listens for hardware key presses?
- Cannot resolve symbol 'MediaSessionCompat'
- onKeyDown in a service? (Global Hot Keys)
- How can I launch an android app on upon pressing the volume up or volume down button?
- How to receive volume changed events for the voice (in-call) stream type?
- How to capture key events inside a service?