Returns: The current ringtone mode, one of RINGER_MODE_NORMAL, RINGER_MODE_SILENT, or RINGER_MODE_VIBRATE.
1. Initialize an AudioManager Variable named myAudioManager.
2. Set an integer variable named myInteger to mAudioManager.getRingerMode. This will save the ringer mode to a variable named myInteger.
3. In the MainActivity.java file, add the following code the onCreate method.
if (myInteger == AudioManager.RINGER_MODE_NORMAL) {
// add a toast that displays "Ringer is set to normal"
} else { (if (myInteger == AudioManager.RINGER_MODE_SILENT) {
// add a toast that displays "Ringer is set to Silient"
} else {
if (myInteger == AudioManager.RINGER_MODE_VIBRATE) {
// add a toast that displays "Ringer is set to Vibrate"
}
Next Recommended Article: Set Ringer to Vibrate
Resources:
http://developer.android.com/reference/android/media/AudioManager.html#getRingerMode()