Reputation: 1677
I am completely new to bluetooth app development. what exactly is a bluetooth profile? is it a hardware specification for the device? can an android mobile phone with bluetooth act as sender and receiver in A2DP profile?
Upvotes: 4
Views: 6274
Reputation: 43
There are two A2DP profiles: A2DP source (the device that sends audio) and A2DP Sink (the device that receives and plays the audio) like a Bluetooth headset.
Your phone hardware supports both profiles, but A2DP Sink isn't implemented in Android so you cant just write an app to use it. You need to modify Android source code and build your own ROM.
If you want to do so you need a device with an available source code (a Nexus or a device supported by CyanogenMod).
If you use Android 5 or up it wont be very hard to enable the A2DP Sink as it's already included in the source but disabled.
If you use Android 4.2 -4.4 you need to port the A2DP Sink classes from Android 5.
As for Android prior to 4.2 things are different as they used a different Bluetooth stack called BlueZ (now they use Bluedroid) you can activate A2DP Sink by rooting your device and editing "audio.conf" file but unfortunately even though your phone will be advertising itself as a A2DP Sink you will hear no sound as it's not routed to speakers and to route it you will have to build a modified ROM.
Building a ROM might seem complicated but it is not, specially if you're using Android 5 or up as, like i said before, the SINK profile is already there all you need to do is type 6 lines in the terminal (you need a Linux OS) and edit 3 lines of code to enable the A2SP Sink and build your own ROM. If you are interested in this I can give more details.
Upvotes: 1
Reputation: 458
A bluetooth profile is a specification on the protocol and functionality of a bluetooth device. It is not just a hardware specification, because implementing a profile will often depend on both the software stack and the hardware chip. You can find more information from the wikipedia page.
And in the case of A2DP, it is specifically designed for music streaming. It cannot be used for arbitrary data communication (if that's what you mean by "sender and receiver"). If you are looking for a generic data communication mechanism over bluetooth transport, the Serial Port Profile (SPP) is what you need (some people also call it RFCOMM). Android SDK user guide has quite detailed information on how to use RFCOMM API: http://developer.android.com/guide/topics/wireless/bluetooth.html
Upvotes: 4