Closed pietgk closed 1 year ago
Our team had the same problem. Explicitly asking Android permission _android.permission.BLUETOOTHCONNECT helped.
However, the permission is needed for Platform.Version >= 31 (Android version 12), and this doesn't explain why BT doesn't work for you on Android 9...
We have a work around / fix by forcing the speaker off and enabling the already connected BT headset.
import InCallManager from "react-native-incall-manager";
import BluetoothStateManager from "react-native-bluetooth-state-manager";
const handleAudioDeviceChanged = async (audioDevice: string): Promise<void> => {
// Check if Bluetooth is enabled
const isBluetoothEnabled = await BluetoothStateManager.getState();
if (isBluetoothEnabled !== "PoweredOn") {
return;
}
// Check if a Bluetooth device is connected
const isBluetoothDeviceConnected = audioDevice === "BLUETOOTH";
setHeadsetConnected(isBluetoothDeviceConnected);
if (isBluetoothDeviceConnected) {
// Prevent the call from using the speaker if a Bluetooth headset is available
InCallManager.setSpeakerphoneOn(false); // Turn off the speakerphone
InCallManager.start({ media: "video" });
} else {
// If there is no Bluetooth headset connected, allow using the speaker
InCallManager.setSpeakerphoneOn(true); // Turn on the speakerphone
}
};
please note that you might need
<uses-permission android:name="android.permission.BLUETOOTH_CONNECT" />
please note that this issue is as far as we know on all the tested android versions.
We also have an outstanding support request on this issue. also Vonage mentioned that they also looking into a BT issue that could overlap with this one.
This issue was fixed with v0.21.5 of the SDK.
Bug Report
Current behavior
Reconnecting a bleutooth headset to an android device does not work.
Steps to reproduce
Example Project
both using the latest version as of 2023-04-12.
What is the current bug behavior? After reconnecting the BT Headset it does not connect. The sound still goes to the phone speaker and the phone microphone is used. Note: The phone is connected to the BT headset, put the vonage session is not using it, it seems.
What is the expected correct behavior? That after reconnecting the BT Headset it connects and the BT Headset microphone is used and the sound goes to the BT Headset.
Relevant logs and/or screenshots
Additional info
We test with the following combinations of android devices and BT headsets:
Samsung Galaxy-S20 android 12, JBL-Pro2, Samsung Galaxy-S20 android 12, Jbl WH 5.0:, Samsung Galaxy-S20 android 12, Apple AirPods 1
Samsung Galaxy-S10E android 12, LG HBS-FN6
Samsung Galaxy-S20 FE android 12, Apple Airpods Samsung Galaxy S10e android 9, Apple Airpods Samsung Galaxy S10e android 9, Powerbeats Pro