Example usage for android.media AudioManager setRouting

List of usage examples for android.media AudioManager setRouting

Introduction

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

Prototype

@Deprecated
public void setRouting(int mode, int routes, int mask) 

Source Link

Document

Sets the audio routing for a specified mode

Usage

From source file:com.phonegap.AudioHandler.java

/**
 * Set the audio device to be used for playback.
 * /*  w w  w .j  a va2 s .c  o m*/
 * @param output         1=earpiece, 2=speaker
 */
public void setAudioOutputDevice(int output) {
    AudioManager audiMgr = (AudioManager) this.ctx.getSystemService(Context.AUDIO_SERVICE);
    if (output == 2) {
        audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL);
    } else if (output == 1) {
        audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL);
    } else {
        System.out.println("AudioHandler.setAudioOutputDevice() Error: Unknown output device.");
    }
}

From source file:org.skt.runtime.additionalapis.AudioHandler.java

/**
 * Set the audio device to be used for playback.
 *
 * @param output         1=earpiece, 2=speaker
 *//*from www .j  a v  a2  s. co m*/
@SuppressWarnings("deprecation")
public void setAudioOutputDevice(int output) {
    AudioManager audiMgr = (AudioManager) this.ctx.getSystemService(Context.AUDIO_SERVICE);
    if (output == 2) {
        audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL);
    } else if (output == 1) {
        audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL);
    } else {
        System.out.println("AudioHandler.setAudioOutputDevice() Error: Unknown output device.");
    }
}

From source file:com.commontime.cordova.audio.AudioHandler.java

/**
 * Set the audio device to be used for playback.
 *
 * @param output         1=earpiece, 2=speaker
 *//* w  ww .j a  v a 2s.  co m*/
@SuppressWarnings("deprecation")
public void setAudioOutputDevice(int output) {
    AudioManager audiMgr = (AudioManager) this.cordova.getActivity().getSystemService(Context.AUDIO_SERVICE);
    if (output == 2) {
        audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_SPEAKER, AudioManager.ROUTE_ALL);
    } else if (output == 1) {
        audiMgr.setRouting(AudioManager.MODE_NORMAL, AudioManager.ROUTE_EARPIECE, AudioManager.ROUTE_ALL);
    } else {
        System.out.println("AudioHandler.setAudioOutputDevice() Error: Unknown output device.");
    }
}