How to tell android which volume (media/ringtone etc.) should be controlled by your app

In my android apps I was getting annoying problems that whilst playing sound the volume buttons would control the media volume, but when no sound was playing they would control the ringtone volume. I found the following by trial and error, hopefully this post will help people with the same problem.

This is done by placing a call of setVolumeControlStream in the onCreate part of your activity which takes on of the following values

  • AudioManager.STREAM_MUSIC
  • AudioManager.STREAM_RING
  • AudioManager.STREAM_ALARM
  • AudioManager.STREAM_SYSTEM

Below shows the code required to set your applications default volume control to any of the above values:

Media Volume (Music/Video etc…)


Ringtone Volume


Alarm Volume


Notification Volume


System Volume


Voicecall Volume


I imagine this is also possible via and XML settings, if anyone knows of this I’d be very grateful to know how!


  1. scheich


  2. OC

    Thanks. That’s been bugging me for a while. Play testers kept saying “It doesn’t make sense!!!! Volume this, volume that.”
    Not much on-line to help with this issue either.

  3. Tom

    Cheers for this tip, I was looking for something this simply explained in the android SDK!

  4. Jarcikon

    If you need to reset the volume control back to the default, there is one other value you can use:


  5. mat

    @Jarcikon, good tip, thanks

  6. Cameron

    Thanks so much! This has also been bugging me and there isn’t anything online I could find!

  7. David Shellabarger

    Wow that’s easy.
    Thanks for the tip.
    First hit on Google.

  8. Sonja

    Thanks! And if you want to just have maximum media volume when your application is started, use

    AudioManager audioManager = (AudioManager) this.getSystemService(Context.AUDIO_SERVICE);
    audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, audioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC), 0);

    in your onResume() (and good practie would be to turn it down in onPause()), where the last param “flags” (here 0) sets how this change should be indicated, 0 means “not”, AudioManager.FLAG_PLAY_SOUND for example plays some beep at the new volume level!

  9. Sonja

    Forgot to say, AudioManager.STREAM_MUSIC is the one that sets”Music/video volume”, might be helpful

  10. Miguel

    Just wanted to say thanks for this, just what I was searching for 🙂

  11. […] found this website here and took a look at the java […]

  12. Rob

    Thanks. Exactly what I was looking for.

  13. Andy

    i’ve been looking for this for a while, thx

  14. Maj.

    That really helped. Thanks!

  15. Diego


    It would be useful if this was possible through xml too… but didn’t found anything.

    Anyone knows if it’s possible?

  16. zas


  17. Xeelix

    Thanks, really useful!

  18. Jose Diaz

    I have a HTC Android (MyTouch) and when i tabbed the screen ad press the volume up the media volume came up….and every time i got a call it was making a noise….

    The Solution if anybody need it IS::::::::::>>>>>>>Go to settings >>>when you’re in settings go to Accessibility>>>>>>>>>When you’re in there all you have to do is UN CLICK the SOUND BACK……>>>>>and the problem would be resolved……

  19. Jose Diaz

    Hope Works for other people cause it worked for me……!!!!!!!!

  20. […] #split {}#single {}#splitalign {margin-left: auto; margin-right: auto;}#singlealign {margin-left: auto; margin-right: auto;}#splittitlebox {text-align: center;}#singletitlebox {text-align: center;}.linkboxtext {line-height: 1.4em;}.linkboxcontainer {padding: 7px 7px 7px 7px;background-color:#eeeeee;border-color:#000000;border-width:0px; border-style:solid;}.linkboxdisplay {padding: 7px 7px 7px 7px;}.linkboxdisplay td {text-align: center;}.linkboxdisplay a:link {text-decoration: none;}.linkboxdisplay a:hover {text-decoration: underline;} function opensingledropdown() { document.getElementById(‘singletablelinks’).style.display = ”; document.getElementById(‘singlemouse’).style.display = ‘none’; } function closesingledropdown() { document.getElementById(‘singletablelinks’).style.display = ‘none’; document.getElementById(‘singlemouse’).style.display = ”; } iPhone Volume Control Sensitivity Hack – Hacked Gadgets – DIY Tech BlogUse Fine Volume Control to Enhance Your Music ExperienceAmplifier Mounting CaseToo Cheap To Buy A Multi-Zone Amplifier, Use A Speaker SelectorThe strategy to Use Many Speakers On An individual Property Theater Or Stereo AmplifierRecommendations on the way to Use A variety of Speakers On Just one Residence Theater Or Stereo AmplifierReverse Telephone Number Searchmaternity leave pay californiaClayframes 2.7 – APKTOPHow to tell android which volume (media/ringtone etc.) should be controlled by your app […]

  21. Fumba Chibaka

    Thanks for the post… now off to the next problem!!!

  22. カヲル

    Nice tip! It really helped me a lot, thank you!

  23. Laura

    Thank you!!! I don’t know why I hadn’t searched for this before.

  24. John

    And on the 8th day he posted about media volumes…….damn this is good, explains what I was missing, simply. Damn awesome.

    PS You should have a paypal donate button for appreciation, people want to show their thanks when you do things like this

  25. David M.

    Thanks a lot.
    “hopefully this post will help people with the same problem” –> YES IT IS!!

  26. PFFB


Leave a Comment

Your email address will not be published. Required fields are marked *