react-native-headphone-detection
react-native-headphone-detection copied to clipboard
Events are not detected on Android 10
On HeadphoneDetection.isAudioDeviceConnected().then(console.log);
I get bluetooth true
but no events are detected when I press on any button on the headphone.
The event listener HeadphoneDetection.addListener(console.log);
is never called
I am testing on android 10.
same issue
I found out that Android 9 & 10 ignores the media button actions if the app is not a media app. Since my app was not a media app that was the reason that this library could not detect any event
I believe this package only detects connected devices but not events when pressed on a headphone. The event listener will fire only whenever you connect with a wired/bluetooth headphone
You have might to look into react-native-incall-manager to get events when headphone buttons media is pressed but I believe it only supports android devices