0

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.

MysticMagicϡ
  • 28,593
  • 16
  • 73
  • 124
ammukuttylive
  • 365
  • 2
  • 6
  • 15

1 Answers1

1

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
lokoko
  • 5,785
  • 5
  • 35
  • 68