Reputation: 71
I need to override the default system volume key presses globally, for example: if I hit volume down from while in the main home launcher, it would execute the same command as it would when the application is running.
Upvotes: 3
Views: 2454
Reputation: 5799
You need to write an intent for Audio volume up, which will allow your app to intercept the broadcast message. You may then cancel the original action (of increasing the volume) and hijack the button for your own needs. Have a look in the android developer documentation on intent filters for example code and further information.
This tutorial to get you started on BroadcastRecievers should get you started.
Upvotes: 3