List of usage examples for android.media AudioManager isBluetoothScoOn
public boolean isBluetoothScoOn()
From source file:com.ferdi2005.secondgram.voip.VoIPService.java
@SuppressLint("NewApi") @Override//from w w w.j a v a2 s. c o m public void onSensorChanged(SensorEvent event) { if (event.sensor.getType() == Sensor.TYPE_PROXIMITY) { AudioManager am = (AudioManager) getSystemService(AUDIO_SERVICE); if (isHeadsetPlugged || am.isSpeakerphoneOn() || (isBluetoothHeadsetConnected() && am.isBluetoothScoOn())) { return; } boolean newIsNear = event.values[0] < Math.min(event.sensor.getMaximumRange(), 3); if (newIsNear != isProximityNear) { FileLog.d("proximity " + newIsNear); isProximityNear = newIsNear; try { if (isProximityNear) { proximityWakelock.acquire(); } else { proximityWakelock.release(1); // this is non-public API before L } } catch (Exception x) { FileLog.e(x); } } } }