Is it possible to get the profile of the phone, whether it is in silent mode or general mode? I want to check it in a broadcast receiver.
The thing is I don't want to switch the profile. I just want to get the state.
Is it possible to get the profile of the phone, whether it is in silent mode or general mode? I want to check it in a broadcast receiver.
The thing is I don't want to switch the profile. I just want to get the state.
You would just have to get a handle to the AudioManager Service and switch case through the results. Something like this :
AudioManager profileCheck = (AudioManager)getSystemService(Context.AUDIO_SERVICE);
if (profileCheck.getRingerMode() == AudioManager.RINGER_MODE_NORMAL)
// Do something
else if (profileCheck.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE)
// Do something
else if (profileCheck.getRingerMode() == AudioManager.RINGER_MODE_SILENT)
// Do something