Is it possible to stream audio over bluetooth? During my research I found that is it only possible using A2DP(Advanced Audio Distribution Profile)
. And does every android device support A2DP? If not, is it possible to stream audio between two android devices using bluetooth? Please help me understand this.
I've looked through the following links:
Is it possible to stream audio over Bluetooth?
Below sort of thread says its possibility that streaming audio over Bluetooth is possible between devices but there was question mark on its success rates till Google official announced that We have fixed the a2dp streaming stutter problem on N7. The next release should have the fix. Sorry about the problem.
Fix for poor A2DP quality on 4.2.2
Bluetooth sound quality suffer after upgrade to 4.2 with Galaxy Nexus
Android 4.3 Bluetooth Audio Quality Fix for Nexus 7 Flo
And does every android device support A2DP?
Support compatibility is mention on Android developers site that its added from API Level-11 with appropriate features.
But I came across XDA tread where OP mention problem in Android 2.1
,means its also support in previous api levels but OP facing issues.
Hope it make sense to understand and I would like to recommend to refer XDA forum to get more information about A2DP compatibility and its sucess.
I my opinion, if A2DP doesn't work properly, we'd better move to lower layer, and we can create a basic stream which can be used for sending any form of date. I succeed in sending byte stream via Bluetooth between J2ME devices.
If install an app in both devices is acceptable, I've sample codes to create a Bluetooth server and a client to communicate with each other via socket, once the socket is established, you can send you audio stream :)
here are some core codes:
1) server device:
// you can generate your own UUID and use it as an port to eatablish a socket
private static final UUID MY_UUID = UUID.fromString("20687DAD-B023-F19E-2F60-A135554CC3FD")
BluetoothServerSocket serverSocket = mBluetoothAdapter.listenUsingRfcommWithServiceRecord(NAME_INSECURE, MY_UUID);
now you have the serverSocket, just use it as an ordinary ServerSocket:
BluetoothSocket socket = serverSocket.accept();
and then you can get InputStream
and OutputStream
from this BluetoothSocket
and send audio stream just like HttpConnection
2) client device:
assume you already got the BluetoothDevice
// you should implement the method getBlutoothDevice
BluetoothDevice device = getBluetoothDevice();
BluetoothSocket socket = device.createRfcommSocketToServiceRecord(MY_UUID_SECURE);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With