Is it possible to change the function of the physical button even with the app in the background?

1

Would you like to change the function of a physical button, for example the volume, when clicking the button, down or up, is it possible to perform some function, other than changing the volume of the device? It is possible? If yes, is there an example?

/ em>.

    
asked by anonymous 14.06.2017 / 23:13

1 answer

2

I do not think it's possible, however, for some specific cases like Google Play Music (music stream service), it uses KEYCODE_VOLUME_DOWN and KEYCODE_VOLUME_UP to decrease and increase volume of the music being played, regardless of whether the app is open or not. However, wanting or not, does not escape the question of volume, which in itself, is in relation to music. You can do a little research on the VolumeProviderCompat added to the SDK by Google to from the API 22. Perhaps one limitation is the Android version. But you can be sure, maybe you have a long way to go to get there.

See these questions:

15.06.2017 / 01:02