| java.lang.Object | |
| ↳ | com.nexmo.sdk.conversation.client.audio.AppRTCBluetoothManager |
AppRTCProximitySensor manages functions related to Bluetoth devices in the AppRTC demo.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| enum | AppRTCBluetoothManager.State | ||||||||||
| Protected Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| AppRTCBluetoothManager(Context context, AppRTCAudioManager audioManager) | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| AppRTCBluetoothManager.State |
getState()
Returns the internal state.
| ||||||||||
| void |
start()
Activates components required to detect Bluetooth devices and to enable
BT SCO (audio is routed via BT SCO) for the headset profile.
| ||||||||||
| boolean |
startScoAudio()
Starts Bluetooth SCO connection with remote device.
| ||||||||||
| void |
stop()
Stops and closes all components related to Bluetooth audio.
| ||||||||||
| void |
stopScoAudio()
Stops Bluetooth SCO connection with remote device.
| ||||||||||
| void |
updateDevice()
Use the BluetoothHeadset proxy object (controls the Bluetooth Headset
Service via IPC) to update the list of connected devices for the HEADSET
profile.
| ||||||||||
| Protected Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| AudioManager |
getAudioManager(Context context)
Stubs for test mocks.
| ||||||||||
| boolean | getBluetoothProfileProxy(Context context, BluetoothProfile.ServiceListener listener, int profile) | ||||||||||
| boolean | hasPermission(Context context, String permission) | ||||||||||
| void |
logBluetoothAdapterInfo(BluetoothAdapter localAdapter)
Logs the state of the local Bluetooth adapter.
| ||||||||||
| void | registerReceiver(BroadcastReceiver receiver, IntentFilter filter) | ||||||||||
| void | unregisterReceiver(BroadcastReceiver receiver) | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
| |||||||||||
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. TODO(henrika): should we add support for virtual voice call to BT headset also for JBMR2 and higher. It might be required to initiates a virtual voice call since many devices do not accept SCO audio without a "call".
Stops and closes all components related to Bluetooth audio.
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.
Stubs for test mocks.
Logs the state of the local Bluetooth adapter.