Example usage for android.media AudioManager RINGER_MODE_NORMAL

List of usage examples for android.media AudioManager RINGER_MODE_NORMAL

Introduction

In this page you can find the example usage for android.media AudioManager RINGER_MODE_NORMAL.

Prototype

int RINGER_MODE_NORMAL

To view the source code for android.media AudioManager RINGER_MODE_NORMAL.

Click Source Link

Document

Ringer mode that may be audible and may vibrate.

Usage

From source file:Main.java

public static void setRingOnly(AudioManager audiomanager) {
    audiomanager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
    audiomanager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
}

From source file:Main.java

public static void setRingAndVibrate(AudioManager audiomanager) {
    audiomanager.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
    audiomanager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
}

From source file:Main.java

public static boolean isSupportedMode(int ringerMode) {
    switch (ringerMode) {
    case AudioManager.RINGER_MODE_NORMAL:
    case AudioManager.RINGER_MODE_VIBRATE:
    case AudioManager.RINGER_MODE_SILENT:
        return true;
    }/*  w ww. j  av a 2 s .c o  m*/
    return false;
}

From source file:Main.java

public static void performToggle(AudioManager audioManager) {
    audioManager.setRingerMode(/*w  w w .j  a  va  2s.com*/
            isPhoneSilent(audioManager) ? AudioManager.RINGER_MODE_NORMAL : AudioManager.RINGER_MODE_SILENT);
}

From source file:Main.java

public static final void audioModeNormal(Context ctx) {
    AudioManager audio = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE);
    audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL);
}

From source file:Main.java

public static boolean isRingOnly(AudioManager mAudioManager) {
    int ringerMode = mAudioManager.getRingerMode();
    int vibrateMode = mAudioManager.getVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);
    return ringerMode == AudioManager.RINGER_MODE_NORMAL && vibrateMode == AudioManager.VIBRATE_SETTING_OFF;
}

From source file:Main.java

public static void setRingerModeBack(Context context) {
    if (currentMode == AudioManager.RINGER_MODE_NORMAL) {
        setRinger2Normal(context);/*  w  ww.  j a v a  2 s.c o m*/
        Log.i("Restored Mode normal", currentVolume + "");
    } else if (currentMode == AudioManager.RINGER_MODE_VIBRATE) {
        setRinger2Vibrate(context);
        Log.i("Restored Mode vibrate", currentVolume + "");
    } else if (currentMode == AudioManager.RINGER_MODE_SILENT) {
        setRinger2Silent(context);
        Log.i("Restored Mode Silent", currentVolume + "");
    } else {
        Log.i("Nothing ", "Matched above");
    }
}

From source file:Main.java

public static boolean isRingAndVibrate(AudioManager mAudioManager) {
    int ringerMode = mAudioManager.getRingerMode();
    int vibrateMode = mAudioManager.getVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER);
    return ringerMode == AudioManager.RINGER_MODE_NORMAL && vibrateMode == AudioManager.VIBRATE_SETTING_ON;
}

From source file:Main.java

public static boolean isRingerEnable(Context context) {
    AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    final int audioMode = am.getRingerMode();
    if (audioMode == AudioManager.RINGER_MODE_NORMAL) {
        return true;
    } else {//from   ww w  . j av a2 s. c o m
        return false;
    }
}

From source file:Main.java

public static void setCurrentRingerMode(Context context) {
    AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    if (audioManager.getRingerMode() == AudioManager.RINGER_MODE_NORMAL) {
        currentMode = AudioManager.RINGER_MODE_NORMAL;
        currentVolume = audioManager.getStreamVolume(AudioManager.STREAM_RING);
        Log.i("Current Mode Normal", currentVolume + "");
        Log.i("Vlaue of", currentMode + "");
    } else if (audioManager.getRingerMode() == AudioManager.RINGER_MODE_VIBRATE) {
        currentMode = AudioManager.RINGER_MODE_VIBRATE;
        Log.i("Current Mode Vibrate", currentVolume + "");
        Log.i("Vlaue of", currentMode + "");
    } else if (audioManager.getRingerMode() == AudioManager.RINGER_MODE_SILENT) {
        currentMode = AudioManager.RINGER_MODE_SILENT;
        Log.i("Current Mode Silent", currentVolume + "");
        Log.i("Vlaue of", currentMode + "");
    } else {/*from   w  w  w. j  ava2 s  .co m*/
        Log.i("Nothing ", "Matched above");
    }

}