I need the active audio source id
or MAC address
to compare it with my own list of Bluetooth devices
. MediaRouter.getSelectedRoute
gives very basic information like the name
, type of the device
. I see there is a getAddress()
API which is hidden in MediaRouter
class. Is there any other unique id to identify and compare the BT
devices with my own list. Name
field is not reliable as there can be multiple devices with same name.
Also, Samsung
devices can have multiple Bluetooth
devices active at the same time. Didn't find any API which can give the correct information.
val mediaRouter = applicationContext.getSystemService(Context.MEDIA_ROUTER_SERVICE) as MediaRouter
val selectedRoute = mediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_AUDIO)
Log.e("MainActivity", "route:" + selectedRoute)
Also, tried the below for Samsung
devices. This gives the connected device list but not the active device.
List<BluetoothDevice> a2dpList = bluetoothProfileProxy.getConnectedDevices();