Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check if phone is mute, vibrate or loud in android

Tags:

android

This is my code to mute/unmute phone. But I would like to check if phone is alreay on mute and if is not then i will mute it. If is in vibrate then i will make it normal.

Can i check this states somehow?

public void changeRingerMode(Context context){  AudioManager audio = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);      /**     * To Enable silent mode.....     */     audio.setRingerMode(AudioManager.RINGER_MODE_SILENT);      /**     * To Enable Ringer mode.....     */     audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);  } 
like image 203
senzacionale Avatar asked Aug 16 '12 10:08

senzacionale


People also ask

How do I know if my Android phone is on mute?

The Silent Mode icon looks like a speaker with a line through it or a speaker with circle and a line superimposed over it. When the Silent Mode is disabled, only a speaker icon appears.

How do I get my Android phone off of mute?

To turn off silent mode: Tap the upper part of the Volume key to select the required ring volume. If vibration is turned on, silent mode isn't turned on when you tap the Volume key. See how to turn vibration on or off.


1 Answers

try this:

switch( audio.getRingerMode() ){ case AudioManager.RINGER_MODE_NORMAL:    break; case AudioManager.RINGER_MODE_SILENT:    break; case AudioManager.RINGER_MODE_VIBRATE:    break; } 
like image 77
Vineet Shukla Avatar answered Oct 30 '22 04:10

Vineet Shukla