I am trying to make an android app which sends a message automatically when you get a miss call but only when the mobile is silent . I know how to send message when there is a miss call but i don't know to check whether the state of mobile is Silent or not .
Is it even possible to check the state of the mobile and if so how ??
Thank you in advance .
Asked
Active
Viewed 52 times
0

Nawed Shaikh
- 419
- 5
- 22
1 Answers
1
You can do that with AudioManager
like this:
AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
switch(audioManager.getRingerMode()){
case AudioManager.RINGER_MODE_NORMAL:
// Phone is loud
break;
case AudioManager.RINGER_MODE_SILENT:
// Phone is silent
break;
case AudioManager.RINGER_MODE_VIBRATE:
// Phone is vibrating
break;
}

Xaver Kapeller
- 49,491
- 11
- 98
- 86