All along, Android support for Bluetooth is very confusing, can be said to be a lump of shit. Each version of the protocol stack is different, the earliest use of BlueZ, into the 4.x era, replaced by Google's own bluedroid. Change it, at least wait for it to be done again, results 4.2, 4.3, 4.4 of the bluedroid are all different. This is to me and other non-professional Bluetooth developers to develop Bluetooth manufacturing a great deal of trouble.
Well, that's the end of the spit, it's time to talk. Because the company is doing smart home projects, need to implement Bluetooth A2DP sink profile on Android, so that our equipment can be used when the Bluetooth speaker. We are using the platform is all to A20, Bluetooth module is a Bt+wifi integration module, the SDK version is Android4.2. According to our understanding, Android4.x's official SDK in the Bluetooth A2DP only implemented source, that is, only as a source of music playback, the audio data out. Bo Tong has its own support for Bluetooth A2DP sink protocol stack, but only support Android4.4. Realtek in the Android4.2 protocol stack to achieve A2DP Sink, but subject to the version we have produced is the use of the Bo Tong module, Realtek This road can only forget. While we were five ways to go, the good news came, Android5.0 released, and "supposedly" is already achieved A2DP Sink. Well, then transplant it.
I will describe the entire transplant in the following sections:
1. Basic knowledge of Bluetooth audio system in Android;
2, porting Bluetooth protocol stack;
3, the realization of Bluetooth audio playback;
Implementing Bluetooth A2DP Sink (a) in Android4.2--porting Android5.0 Bluetooth protocol stack