react-native-headphone-detection icon indicating copy to clipboard operation
react-native-headphone-detection copied to clipboard

Events are not detected on Android 10

Open Beslinda opened this issue 3 years ago • 4 comments

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.

Beslinda avatar Dec 16 '20 11:12 Beslinda

same issue

abnerluan7 avatar Jan 17 '21 04:01 abnerluan7

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

Beslinda avatar Jan 26 '21 10:01 Beslinda

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

AbdulmalickDimnang avatar Feb 07 '21 14:02 AbdulmalickDimnang

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

AbdulmalickDimnang avatar Feb 07 '21 14:02 AbdulmalickDimnang