List of usage examples for android.content Context AUDIO_SERVICE
String AUDIO_SERVICE
To view the source code for android.content Context AUDIO_SERVICE.
Click Source Link
From source file:Main.java
public static void setVolume(Context context, int volume) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, AudioManager.FLAG_PLAY_SOUND); }
From source file:Main.java
public static void adjustVoiceToSystemSame(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.adjustStreamVolume(AudioManager.STREAM_MUSIC, AudioManager.ADJUST_SAME, 0); }
From source file:Main.java
public static void setMusicMute(Context context, boolean isMute) { AudioManager mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); mAudioManager.setStreamMute(AudioManager.STREAM_MUSIC, isMute); }
From source file:Main.java
public static void restoreSystemAudioSetting(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); if (audioManager != null) { audioManager.setSpeakerphoneOn(false); audioManager.setMode(AudioManager.MODE_NORMAL); }/*from ww w. j a va 2s .c om*/ }
From source file:Main.java
public static void setRingerMode(Context mContext, int x) { AudioManager am = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE); switch (x) {/* w w w .j a v a 2s. c o m*/ case 0: am.setRingerMode(AudioManager.RINGER_MODE_SILENT); break; case 1: am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE); break; case 2: am.setRingerMode(AudioManager.RINGER_MODE_NORMAL); break; /*case 3: am.setRingerMode(AudioManager.RINGER_MODE_); break;*/ } }
From source file:Main.java
public static int getVolume(Context context) { AudioManager manager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); return manager.getStreamVolume(AudioManager.STREAM_MUSIC); }
From source file:Main.java
public static int getMaxVolume(Context context) { AudioManager manager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); int max = manager.getStreamMaxVolume(AudioManager.STREAM_MUSIC); return max;/*from w ww . ja v a 2 s . c o m*/ }
From source file:Main.java
public static void enableBluetoothRouting(Context context) { AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); am.startBluetoothSco();/*from w w w. jav a2s . c om*/ am.setBluetoothScoOn(true); }
From source file:Main.java
public static void setVolume(int volume, Context context) { AudioManager manager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); manager.setStreamVolume(AudioManager.STREAM_MUSIC, volume, 0); }
From source file:Main.java
public static void setAudioManage(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true); audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true); audioManager.setStreamVolume(AudioManager.STREAM_ALARM, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_DTMF, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, 0, 0); audioManager.setStreamVolume(AudioManager.STREAM_RING, 0, 0); }