AgoraIO-Extensions / react-native-agora

React Native around the Agora RTC SDKs for Android and iOS agora
https://www.agora.io
MIT License
625 stars 227 forks source link

Android Bluetooth mic does not work on voice call #507

Closed hmhm2292 closed 1 year ago

hmhm2292 commented 2 years ago

We are using react-native-agora sdk v3.6.2 and our app is currently targeting sdk 31. on android 12 devices, whenever the user connects on voice call via bluetooth, the audio is captured through the device's mic and not through the bluetooth's mic. Please any help would be so helpful.

LichKing-2234 commented 2 years ago

have you config the permission of bluetooth?

GamesBond-RoyChan commented 2 years ago

We have recently upgraded to v3.6.2 from v3.5.2 and face the same problem. This happens in Android only. Our Android target sdk version is 30. Bluetooth permission is granted. Audio is output through bluetooth headset, but captured from device's mic instead of bluetooth's mic.

Any help would be appreciated!

oelerpearler commented 1 year ago

Same issue here, Microphone of Bluetooth headset not working anymore (as also mentionned in https://github.com/AgoraIO-Extensions/react-native-agora/issues/420#issuecomment-1339545433 from the other issue https://github.com/AgoraIO-Extensions/react-native-agora/issues/420).

@LichKing-2234 : Not sure whether this helps to find the root cause, but the issue only started happening on my Android 13 device (Google Pixel) after we had to change the targetSdkVersion from version 30 to version 31 (which we had to do for our release pipelines not supporting version 30 anymore). But it was working before (React Native SDK v4.0.0) ... just the change to the targetSdkVersion from 30 to 31 seems to cause this issue.

LichKing-2234 commented 1 year ago

@oelerpearler I have tested our example JoinChannelVideo with my android phone and AirPods pro, and it works fine.

alekben commented 1 year ago

@LichKing-2234 Android API 31 and higher requires BLUETOOTH_CONNECT Android permission for both mic/speaker access, not just BLUETOOTH:

https://reactnative.dev/docs/permissionsandroid

Same issue happens with Native Android SDK. Adding the additional permission fixes it in both cases.

oelerpearler commented 1 year ago

@alekben Thanks a lot, I just wanted to post the very same here; I got help from the Agora Support, and it turned out that indeed, when targeting android SDK higher than 30 in the build.gradle, BLUETOOTH_CONNECT is required ... both in the AndroidManifest.xml as well as in the React Native App by getting permission granted from the user (as also described in the link that you have shared).

@LichKing-2234 I've already asked Agora Support to highlight this bit of information in the React Native SDK Docs, but maybe if you're close to the Documentation Team (or even contributing to it), you might also want to ensure that this information is available in the Agora Docs (less people bothering you in the future)

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.