0

My app plays sounds, but the volume buttons only seem to work if the sound is playing. Otherwise if you hit the volume buttons they change the ringer volume instead of the media volume. How can I make it so that while the app is running, hitting the volume buttons always change the media volume? Or is this considered bad practice?

clayton33
  • 4,176
  • 10
  • 45
  • 64
  • 1
    [This answer](http://stackoverflow.com/a/674207/1454048) is probably what you're looking for. – admdrew Dec 17 '13 at 18:18

1 Answers1

1

Call this within your activities onCreate().

    setVolumeControlStream (AudioManager.STREAM_MUSIC);
VishalKale
  • 758
  • 7
  • 22