androidgetmediavolumeandroid-audiomanager

How do you get/set media volume (not ringtone volume) in Android?


Is there a way to get/set media volume? I have tried the following:

AudioManager audio = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
int currentVolume = audio.getStreamVolume(AudioManager.STREAM_RING);

but it returns the ringtone volume.


Solution

  • Instead of AudioManager.STREAM_RING you shoul use AudioManager.STREAM_MUSIC This question has already discussed here.