Reza
Reza

Reputation: 71

Override default system volume button function globally

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

Answers (1)

Lars
Lars

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

Related Questions