twilio / audioswitch

An Android audio management library for real-time communication apps.
Apache License 2.0
170 stars 50 forks source link

Missing Bluetooth Device Classes #16

Closed cyodrew closed 4 years ago

cyodrew commented 4 years ago

Before filing an issue please check that the issue is not already addressed by the following:

Please ensure that you are not sharing any Personally Identifiable Information(PII) or sensitive account information (API keys, credentials, etc.) when reporting an issue.

Describe the bug After testing this library out with different Bluetooth headsets, I have noticed that the AudioDeviceChangeListener is not being fired upon certain headsets connecting/disconnecting. I utilized two headphones with a deviceClass of BluetoothClass.Device.AUDIO_VIDEO_HEADPHONES and BluetoothClass.Device.Major.UNCATEGORIZED, respectively. These are both wireless headphones (Bose Soundsport and Sony WH-1000MX3) that are capable of receiving call audio. The class function isHeadsetDevice in BluetoothHeadsetReceiver is the culprit as it returns true for only three deviceClass types.

To Reproduce Steps to reproduce the behavior:

  1. Connect/Disconnect various Bluetooth devices with a different deviceClass outside of AUDIO_VIDEO_HANDSFREE, AUDIO_VIDEO_WEARABLE_HEADSET, AUDIO_VIDEO_CAR_AUDIO
  2. The AudioDeviceChangeListener is not fired as expected.

Expected behavior The AudioDeviceChangeListener should be called when a device connects/disconnects.

Screenshots

Android Device (please complete the following information):

Version

Additional context This might be intended behavior and my particular Bluetooth devices have a deviceClass that may be outside of the intended use case for this project.

Alton09 commented 4 years ago

Hi @cyodrew! Thank you for reporting this issue. This indeed is a bug and will be fixed in our upcoming sprint. I'll provide updates to this issues as soon as it is resolved.

Alton09 commented 4 years ago

Hi @cyodrew . We believe we have fixed this issue in PR #20 . Please let us know if this resolves your issue with the two BT headset devices that you used, so we can cut a new release and close this issue. We currently don't have snapshot artifacts setup yet in Bintray, so you'll have to build it from source in the meantime. Thanks!

cyodrew commented 4 years ago

Hey @Alton09, I just tested with both BT headsets and it worked like a charm. Thank you!

Alton09 commented 4 years ago

Glad to hear that! I'll go ahead and close this issue and cut a new release. Thanks again for reporting the bug!