Unable to increase volume for music stream in Honeycomb and up
<p>I have code that allows a user to issue an audible alert on their device. In Android 2.3 and below, I am able to issue the alert even if the sound is turned all the way down by programatically increasing the volume via <code>AudioManager.setStreamVolume</code>. However now in Android 3.x and up when I attempt to do this the native volume adjustment widget appears on the screen for a moment but the current volume still stays at zero. The code is below:</p>

<pre><code>int currentVolume = audioMgr.getStreamVolume(AudioManager.STREAM_MUSIC);
int maxVolume = audioMgr.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
audioMgr.setStreamMute(AudioManager.STREAM_MUSIC, false);

// If the current volume is not set to the maximum level
if (currentVolume &lt; maxVolume) {
    // Set the current volume to the maximum level
    audioMgr.setStreamVolume(AudioManager.STREAM_MUSIC, maxVolume, AudioManager.ADJUST_RAISE);
}
</code></pre>

<p>My question is...what has changed in <em>Honeycomb</em> that makes this no longer work? I set a breakpoint after <code>setStreamVolume</code> and ran <code>getStreamVolume</code> by hand. It was still set to zero. Thoughts?</p>
