I faced problem with bluetooth SCO audio in my android app.
I registered a receiver for actions ACL_CONNECTED and ACL_DISCONNECTED to capture the bluetooth SCO device connection and disconnection. On receive of ACL_CONNECTED I am checking whether bluetooth device has Audio service (headset) or not, if has AUDIO service, I am instantiating AudioTrack (new AudioTrack(....)) and starting bluetooth SCO (startBluetoothSco(); setBluetoothScoOn(true);).
I have a button in my app to write pcm data to AudioTrack. In this app I am not able to hear sound of PCM data i written.
I tried without any receiver and in onCreate() only I instantiated AudioTrack and started bluetooth SCO. Before launching app, I connected headset to my device and tested, it is working fine.
But, why my app is not working when established bluetooth SCO connection at run-time depending on ACL_CONNECTED intent.
If anybody know the solution please reply me. I added all required permissions BLUETOOTH, BLUETOOTH_ADMIN, MODIFY_AUDIO_SETTINGS (don't report about spelling mistakes in these permissions).