Example usage for android.media AudioManager setRingerMode

List of usage examples for android.media AudioManager setRingerMode

Introduction

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

Prototype

public void setRingerMode(int ringerMode) 

Source Link

Document

Sets the ringer mode.

Usage

From source file:Main.java

public static void setSilent(AudioManager audiomanager) {
    audiomanager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
}

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 void setVibrateOnly(AudioManager audiomanager) {
    audiomanager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
    audiomanager.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
}

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 performToggle(AudioManager audioManager) {
    audioManager.setRingerMode(
            isPhoneSilent(audioManager) ? AudioManager.RINGER_MODE_NORMAL : AudioManager.RINGER_MODE_SILENT);
}

From source file:Main.java

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

From source file:Main.java

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

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 void setRinger2Vibrate(Context context) {
    AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
    Log.i("HelperFunctions ", "Vibrate method called");
}

From source file:Main.java

public static void setRinger2Silent(Context context) {
    AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
    audioManager.setRingerMode(AudioManager.RINGER_MODE_SILENT);
    Log.i("HelperFunctions ", "Silent method called");
}