Active Bluetooth speaker detection

We are working on developing an app that needs to detect the active connected Bluetooth speaker if there are two or more connected Bluetooth speakers. To detect the active speaker, I need to fetch the speaker’s MAC address. The MAC address can be fetched from AudioDeviceInfo, which can be obtained using AudioManager.getDevices() or by subscribing to audio device additions/removals using AudioDeviceCallback. This approach works well on Xiaomi, OnePlus, and Pixel phones, but there is an issue with Samsung phones. According to the Android documentation:

In that case, if there are multiple audio devices with the same device type connected to the Android device, only the last reported device will be known by the Android audio framework and returned by this API.

So, the AudioManager.getDevices() method should return only one device for each type, and in my case, the type is AudioDeviceInfo.TYPE_BLUETOOTH_A2DP (I believe the AudioDeviceCallback should also receive only one device for each type). However, Samsung phones do not work according to the above description. When two devices of type AudioDeviceInfo.TYPE_BLUETOOTH_A2DP are connected to a Samsung phone, the AudioManager.getDevices() method returns two AudioDeviceInfo.TYPE_BLUETOOTH_A2DP devices, and I have not found a way to detect which one is the active device.

How can I get the MAC address of the active AudioDeviceInfo.TYPE_BLUETOOTH_A2DP device when there are two connected AudioDeviceInfo.TYPE_BLUETOOTH_A2DP devices on the Samsung phone?

Please note, the AudioDeviceCallback also receives two devices of type AudioDeviceInfo.TYPE_BLUETOOTH_A2DP.

Tested on Samsung Galaxy A71, Android 13; Samsung Galaxy Note 20, Android 13; Galaxy S20 FE Android 13.

Hello @serhii,

Welcome to the Samsung Developers Forum.

Could you please create a support ticket in the developer support portal so that we can take a better look at the issue?

Thank You & Best Regards,
Samsung Developer Relations