Friday, February 10, 2012

How to enable and disable the silent mode of android through code?

You can use the AudioManager to enable and disable silent mode. 
mAudio = (AudioManager) getSystemService(Activity.AUDIO_SERVICE);
mAudio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
// or...
mAudio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);

1 comment: