I have a problem regarding in-app bluetooth connection.
Scenario: I am connecting my Android app to a multimedia unit where you can control the multimedia unit from the app.
Working fine case: If I am connecting to the multimedia unit from Android system Settings, the phone is connecting to the unit and the unit starts working as output device for the phone media.
Not working case: If I am connecting to the multimedia unit from my application according to the Android documentation, the connection is established and I can exchange messages with the unit, so everything works apart from changing the output device for Audio to the unit, the output is still the phone after establishing the connection.
Moreover, I registered a profile proxy for A2DP devices in both cases. When i get connected via phone settings, the listener is recognizing the device as A2DP but in the case of in-app connecting the device is not recognized as being A2DP device.
I also tried to route the output device with AudioManager but nothing changes as it seem that the device is not recognized as being A2DP when the connection is made in-app.
Any idea to make it work?
I've used reflection to connect to the device for both A2DP and HFP profiles.