How to set your Android phone in Silent Mode or Vibrate Mode or Normal Mode programatically?
First create an instance of the AudioManager Classusing 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);
No comments:
Post a Comment