Bluetooth audio streaming between android devices

40,294

Without knowing details about the mentioned Bluetooth Music Player, it seems to use simple Bluetooth data connection, otherwise you would not need to install a client on playing/sending device.

To stream audio from microphone to another device, you can record it on your sending device and send it to the receiving device. You will need to implement a protocol for that purpose.
OR
You can implement an alternative A2DP sink service. This is, what the sink is: a device with a Bluetooth Protocol Stack with an implementation of A2DP Sink.

Edit:
For the case you detailed by your comments, the sending device should be left as-is, without installing any app. That implicitly means that your solution must make use of out-of-the-box Bluetooth functionality of that Android device.
What you can use here is therefor limited to those profiles that Android typically support, which is HSP, HFP and A2DP. Since you obviously want to stream music, A2DP would be your choice.
On the device supposed to receive the audio stream and do the playback, you have to implement a service providing the A2DP sink as an self implemented BluetoothService opening a BluetoothServerSocket on RFCOMM as described in Android documentation.

You will have to spend much effort implementing this, and I am not sure if you will need a license for this.

Share:
40,294

Related videos on Youtube

Nidhin Joseph
Author by

Nidhin Joseph

I am a passionate developer! :)

Updated on July 09, 2022

Comments

  • Nidhin Joseph
    Nidhin Joseph almost 2 years

    I made a research on the same topic and found that android devices are a2dp sources and the audio can be streamed only from an a2dp source to an a2dp sink. A2dp sink can be a bluetooth headset or a bluetooth speaker.

    But my question is then how the android app named "Bluetooth Music Player" works?

    It allows streaming from one mobile to another. So in this case the listening mobile device must act as a sink. How this is possible? Are they using some other profile instead of a2dp?

    Ok, that may be a different profile what they are using. Because the application needs to be installed in the client side also. But how it becomes possible to stream voice from a bluetooth microphone to an android device?

    Please help.

    • Schlangi
      Schlangi over 10 years
      I did not understand what you need to know: sending audio from one Android to another, or sending audio from a standalone Bluetooth microphone to an Android?
    • Nidhin Joseph
      Nidhin Joseph over 10 years
      Sending audio from one android device to another without the need of a client application.
    • Hardik Joshi
      Hardik Joshi about 10 years
      Hello Sir, I need your help to steaming audio from one device to another device. Can you please give me any example code for this ? I have asked question : stackoverflow.com/questions/16789394/…
  • Nidhin Joseph
    Nidhin Joseph over 10 years
    Sorry for making you confused. Actually what i want to implement is streaming audio from one android device to another. But i came to know that its not possible due to the lack of a2dp sink implementation in android devices. But can i implement the same with any other profile other than a2dp? At the same time, i want to implement the same without a client application. Now i am not giving much priority to sound quality and all.
  • Schlangi
    Schlangi over 10 years
    You say you don't want a client application, and that you mean for which side - the receiving or the sending device?
  • Nidhin Joseph
    Nidhin Joseph over 10 years
    For the sending side i don't want an application. But an application will be there at the receiving side.
  • Nidhin Joseph
    Nidhin Joseph over 10 years
    Like in the case of an android device pairing with a bluetooth headset. Here, a custom application is not needed in the phone to send the data to the headset. But in that case, the bluetooth headset have the a2dp sink implementation. But in my case its difficult to integrate sink support to my android device. Therefore, is there any other android supported profile with which i can stream audio from one android device to another? I think now you got what my exact problem is.
  • Nidhin Joseph
    Nidhin Joseph over 10 years
    Ok, the final answer resolved all my confusions. Thank you :)
  • Hardik Joshi
    Hardik Joshi almost 10 years
    Hello, Can you please provide help for this same ? stackoverflow.com/questions/16789394/…