AppRTCBluetoothManager

AppRTCProximitySensor manages functions related to Bluetooth devices in the AppRTC demo.

Types

Link copied to clipboard
object Companion
Link copied to clipboard

Properties

Link copied to clipboard

Returns the internal state.

Functions

Link copied to clipboard
fun start()

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.

Link copied to clipboard

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.

Link copied to clipboard
fun stop()

Stops and closes all components related to Bluetooth audio.

Link copied to clipboard

Stops Bluetooth SCO connection with remote device.

Link copied to clipboard

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.