From android app How to identify the volume button is pressed from service.
Getting from the volume level from a service from settings provider is right way to get it ?
Is their any right API exposed by android to identify ?
From android app How to identify the volume button is pressed from service.
Getting from the volume level from a service from settings provider is right way to get it ?
Is their any right API exposed by android to identify ?
This type of question was already made, but the answer is quick and I have no problem to give it here:
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP)){
// Code
}
else if ((keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)){
// Code
}
return true;
}