App RTCBluetooth Manager
AppRTCProximitySensor manages functions related to Bluetooth devices in the AppRTC demo.
Types
Functions
Activates components required to detect Bluetooth devices and to enable BT SCO (audio is routed via BT SCO) for the headset profile. The end state will be HEADSET_UNAVAILABLE but a state machine has started which will start a state change sequence where the final outcome depends on if/when the BT headset is enabled. Example of state change sequence when start() is called while BT device is connected and enabled: UNINITIALIZED --> HEADSET_UNAVAILABLE --> HEADSET_AVAILABLE --> SCO_CONNECTING --> SCO_CONNECTED <==> audio is now routed via BT SCO. Note that the AppRTCAudioManager is also involved in driving this state change.
Starts Bluetooth SCO connection with remote device. Note that the phone application always has the priority on the usage of the SCO connection for telephony. If this method is called while the phone is in call it will be ignored. Similarly, if a call is received or sent while an application is using the SCO connection, the connection will be lost for the application and NOT returned automatically when the call ends. Also note that: up to and including API version JELLY_BEAN_MR1, this method initiates a virtual voice call to the Bluetooth headset. After API version JELLY_BEAN_MR2 only a raw SCO audio connection is established.
Stops Bluetooth SCO connection with remote device.
Use the BluetoothHeadset proxy object (controls the Bluetooth Headset Service via IPC) to update the list of connected devices for the HEADSET profile. The internal state will change to HEADSET_UNAVAILABLE or to HEADSET_AVAILABLE and bluetoothDevice
will be mapped to the connected device if available.