How can I manage audio volumes sanely in my Android app?
<p>I have an app that plays intermittent sounds while its activity is open, and the user is always expecting it to make these noises, but unfortunately it is constrained by the music stream volume. The options I have discovered are thus:</p>

<ol>
<li>Adjust the music stream's volume, possibly deafening the user if they happen to be playing music at the time.</li>
<li>Call MediaPlayer.setVolume() which is ineffective if the music stream's volume is 0.</li>
<li>Handle volume button presses myself which presents two issues: volume button presses adjust the ringer volume unless my audio is playing, and I have been as of yet unable to catch the onKey event for a volume button press using my OnKeyListener. If there were some way to force the adjustment to apply to the music stream while my activity has focus, or to just catch the button presses myself this would work.</li>
<li>Play a silent looping piece of audio in the background to keep the music stream in context for volume adjustments.</li>
</ol>

<p>I think the 3rd option is probably best since it cedes control of the volume to the user, but if there were some way to just override the system volume in a single mediaplayer instance that would work too.</p>
