twilio / audioswitch

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

Use AudioManager.registerAudioDeviceCallback to avoid BLUETOOTH related permissions #134

Open davidliu opened 1 year ago

davidliu commented 1 year ago

The bluetooth permissions are currently only used to get information about Bluetooth devices, and aren't actually needed to connect/route audio to the bluetooth device.

This information can be gotten through AudioManager.registerAudioDeviceCallback since API 23, avoiding the need for these permissions. This is particularly important on API 31 and up, where the BLUETOOTH_CONNECT is a runtime permission (with a rather confusing permission message).