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)?
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.
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.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.