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 stopExtraMusic(Context context) { AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); am.requestAudioFocus(null, AudioManager.STREAM_MUSIC, AudioManager.AUDIOFOCUS_GAIN_TRANSIENT); }
From source file:Main.java
public static int getVolumn(Context context) { AudioManager audioManger = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); return audioManger.getStreamVolume(AudioManager.STREAM_MUSIC); }
From source file:Main.java
public static void resumeExtraMusic(Context context) { AudioManager am = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); am.abandonAudioFocus(null); }
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 audioModeNormal(Context ctx) { AudioManager audio = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE); audio.setRingerMode(AudioManager.RINGER_MODE_NORMAL); }
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 audioVolumeRaise(Context ctx) { AudioManager audio = (AudioManager) ctx.getSystemService(Context.AUDIO_SERVICE); audio.adjustVolume(AudioManager.ADJUST_RAISE, 0); }
From source file:Main.java
public static int getVolumeMax(Context context) { AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); return audioManager.getStreamMaxVolume(AudioManager.STREAM_VOICE_CALL); }
From source file:Main.java
public static void setCurrentVolume(int percent, Context mc) { AudioManager am = (AudioManager) mc.getSystemService(Context.AUDIO_SERVICE); int maxvolume = am.getStreamMaxVolume(AudioManager.STREAM_MUSIC); am.setStreamVolume(AudioManager.STREAM_MUSIC, (maxvolume * percent) / 100, AudioManager.FLAG_PLAY_SOUND | AudioManager.FLAG_SHOW_UI); am.setMode(AudioManager.MODE_INVALID); }
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 w w w .ja v a 2 s. co m return false; } }