In my android app I need to know, whenever the user is in Phone options mode (the one that appears when you hold down the power button for a while), and pushes the \'Silent mode
The AudioManager
provides a getRingerMode()
method which can be used to determine the current state.
In your case you have to query the returned value for AudioManager.RINGER_MODE_SILENT
, so something like
AudioManager am = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
if (am.getRingerMode() == AudioManager.RINGER_MODE_SILENT) {
// do something neat here
}
In combination with AudioManager's RINGER_MODE_CHANGED_ACTION
this should work for you