There was another question a long time ago that asked the same thing. Essentially, the answer: do not override the onKeyDown and onKeyUp buttons. It is much better to just use this single line setVolumeControlStream(AudioManager.STREAM_MUSIC); in your onCreate () method. This tells the operating system that the volume buttons should affect the volume of the "media" when your application is visible, and the one that it uses for your application.
As for managing the volume of multimedia, no matter which application is visible, I'm not sure if this can be done - or, if possible, whether it will be good.
Steve Haley Mar 29 '10 at 16:02 2010-03-29 16:02
source share