Android Question Volume changed

Almog

Active Member
Licensed User
hello,

It is possible for action to happen when the volume is changed not by (my) app?
for example, when the user click on volume up button, a message box will pop up? (whether the app is open or closed)?

Thanks in advance.
 

ronell

Well-Known Member
Licensed User
Longtime User
when you're in the app. yes it is simple
without the app in foreground.. try using service to intercept and consume the event ( dont know if it is possible )
 
Upvote 0

Computersmith64

Well-Known Member
Licensed User
Longtime User
You should be able to do it with a Broadcast Receiver that handles the ACTION_MEDIA_BUTTON intent. There is a Broadcast Receiver tutorial here. You should be able to find out more about ACTION_MEDIA_BUTTON intents by asking Mr Google.

- Colin.
 
Upvote 0

Almog

Active Member
Licensed User
when you're in the app. yes it is simple
without the app in foreground.. try using service to intercept and consume the event ( dont know if it is possible )
You should be able to do it with a Broadcast Receiver that handles the ACTION_MEDIA_BUTTON intent. There is a Broadcast Receiver tutorial here. You should be able to find out more about ACTION_MEDIA_BUTTON intents by asking Mr Google.

- Colin.
Thank you
 
Upvote 0
Top