I have a PC (where java program is running), Bluetooth dongle (which supports A2DP) and Android device (2.3.6, which also supports A2DP).
I want to:
- Send real time voice data from PC's microphone to android device via bluetooth
- Send real time voice data from Android device's microphone to PC via bluetooth
I found this question, where Dennis says that "Phones are typically only Source devices (Source of the stream that can stream to sink devices), Sinks are Headsets or Bluetooth speakers.". So it seems it is possible to implement case 2? Or not? And what about case 1, is it impossible to implement?
It is true that Android phone are uniquely A2DP
source devices.
Sadly, your first case is impossible to realize if you decide to rely on the A2DP
profile for streaming audio, because Android does not implement the required callbacks supposed to be handling BlueZ's advertisings when a remote device wants to stream audio to your phone.
The second use case is possible, given that you have a bluetooth enabled PC and some awesome apps that will decode and route the sound from the Bluetooth stack to the speakers. I managed once to reproduce this use case using PulseAudio
and pulseaudio-module-bluetooth
on Ubuntu 12.10
.
Here is a working example showing how to manage the routing of the sound once a connected BT device begins to stream. Here is another one. They both take place on Linux and I never did this on Windows though.
For the sake of completeness, here is another SO answer written by me, giving details about how to implement A2DP
sink capabilities on Android.
EDIT :
Nothing forbids you to implement your own protocol for audio streaming via Bluetooth on an Android device, this will work, but as it will not be a standard, it will never comply with the system built-in Bluetooth profiles (A2DP, HFP ...).
来源:https://stackoverflow.com/questions/15818704/is-it-possible-to-send-receive-voice-from-pc-to-android-device-over-bluetooth