I'm working on a Android app which needs to work with similar functionalities of Bluetooth earphones. i.e., when I connect the mobile (in which my app installed) to other bluetooth devices like pc or another mobile, i need to set the moble as a receiver and want to play audio of those source devices in this mobile speaker. As of my research to achieve this functionality, I need to set the bluetooth in mobile as sink (receiver).
But I found no way to achieve this directly in Android, but we can use some reflections to make this possible.
here are some of the resources that I referred.
- https://android.googlesource.com/platform/packages/apps/Bluetooth/+/refs/heads/main/src/com/android/bluetooth/a2dpsink/A2dpSinkService.java
- Android device as a receiver for A2DP profile
- Android 5.0 Bluetooth A2DP Sink
- How To Modify Android's Bluetooth Stack to Enable A2dp Sink
any help/suggesions would greatly appreciated.