How to set your Android phone in Silent Mode or Vibrate Mode or Normal Mode programatically?

By | July 19, 2011

First create an instance of the AudioManager Class using which you can set the phone in Normal, Silent and Vibration Mode.

AudioManager audio_mngr = (AudioManager) getBaseContext().getSystemService(Context.AUDIO_SERVICE);

For setting the phone in Silent mode..

audio_mngr .setRingerMode(AudioManager.RINGER_MODE_SILENT);

For setting the phone in Normal mode..

audio_mngr .setRingerMode(AudioManager.RINGER_MODE_NORMAL);

For setting the phone in Vibrate mode..

audio_mngr .setRingerMode(AudioManager.RINGER_MODE_VIBRATE);

One thought on “How to set your Android phone in Silent Mode or Vibrate Mode or Normal Mode programatically?

  1. Syed

    Hi,

    Is it possible to set the android phone to other user defined profiles?
    Eg: We have Outdoor, other customized profiles which user can add.

    Reply

Leave a Reply

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