List of usage examples for android.media AudioManager MODE_RINGTONE
int MODE_RINGTONE
To view the source code for android.media AudioManager MODE_RINGTONE.
Click Source Link
From source file:fr.inria.ucn.collectors.SysStateCollector.java
@SuppressWarnings("deprecation") private JSONObject getAudioState(Context c) throws JSONException { AudioManager am = (AudioManager) c.getSystemService(Context.AUDIO_SERVICE); JSONObject data = new JSONObject(); data.put("is_bluetooth_a2dp_on", am.isBluetoothA2dpOn()); data.put("is_microphone_mute", am.isMicrophoneMute()); data.put("is_music_active", am.isMusicActive()); data.put("is_speaker_phone_on", am.isSpeakerphoneOn()); data.put("is_wired_headset_on", am.isWiredHeadsetOn()); switch (am.getMode()) { case AudioManager.MODE_IN_CALL: data.put("mode", "in_call"); break;/* w w w . j av a 2s .c o m*/ case AudioManager.MODE_IN_COMMUNICATION: data.put("mode", "in_comm"); break; case AudioManager.MODE_NORMAL: data.put("mode", "normal"); break; case AudioManager.MODE_RINGTONE: data.put("mode", "ringtone"); break; case AudioManager.MODE_INVALID: default: data.put("mode", "invalid"); break; } switch (am.getRingerMode()) { case AudioManager.RINGER_MODE_VIBRATE: data.put("ringer_mode", "vibrate"); break; case AudioManager.RINGER_MODE_SILENT: data.put("ringer_mode", "silent"); break; case AudioManager.RINGER_MODE_NORMAL: data.put("ringer_mode", "normal"); break; default: data.put("ringer_mode", "invalid"); break; } return data; }
From source file:cx.ring.service.LocalService.java
private void updateAudioState() { boolean current = false; Conference ringing = null;/*from w w w . j a v a 2 s .c o m*/ for (Conversation c : conversations.values()) { Conference conf = c.getCurrentCall(); if (conf != null) { current = true; if (conf.isRinging()) { ringing = conf; break; } } } if (current) mediaManager.obtainAudioFocus(ringing != null); if (ringing != null) { //Log.w(TAG, "updateAudioState Ringing "); mediaManager.audioManager.setMode(AudioManager.MODE_RINGTONE); mediaManager.startRing(null); } else if (current) { //Log.w(TAG, "updateAudioState communication "); mediaManager.stopRing(); mediaManager.audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION); } else { //Log.w(TAG, "updateAudioState normal "); mediaManager.stopRing(); mediaManager.abandonAudioFocus(); } }