Search code examples
androidandroid-audiomanager

How to set ring volume to minimum?


Following code set phone to vibrate state, I want silent mode without vibration.

AudioManager am = (AudioManager) getSystemService(getApplicationContext().AUDIO_SERVICE);
am.setStreamVolume(AudioManager.STREAM_RING, 0, 0);

Thanks in advance!


Solution

  • You need to use an additional AudioManager method to silence the vibration. Add this after your original code:

    am.setRingerMode(AudioManager.RINGER_MODE_SILENT);
    

    Full list of ringer modes can be found here: http://developer.android.com/reference/android/media/AudioManager.html#setRingerMode(int)