0

I have 2 Android phones and I have managed to convert one of them as Headset (Yes, I did root the phone for that). When an incoming call is received to the phone, the headset-emulated phone is able to take headset related actions like - pick call, disconnect call, etc. However, only functionality that's missing is the transfer of Audio from Phone to headset-emulated-device.

Does anyone have prior experience in establishing SCO connection between 2 android phones and access voice data ? (As of now, I am not concerned of Sound quality).

I came across A2DP, but it's only uni-directional. Only SCO is bidirectional voice data transfer.

Any help or pointers will be highly appreciated.

amsurana
  • 234
  • 3
  • 11

1 Answers1

1

I have done this with reflection. It only worked on certain devices though. Not all. Although I didn't root the device.

Class cls = Class.forName("android.bluetooth.BluetoothDevice");
Method method = cls.getDeclaredMethod("createScoSocket", (Class[])null);  
BluetoothSocket scoSocket = (BluetoothSocket)method.invoke(device, null);  
scoSocket.connect();

Also there is the AudioManager.startBluetoothSco() and AudioManager.setBluetoothScoOn(true) methods that you have to use when playing your audio.

David C Adams
  • 1,953
  • 12
  • 12
  • Thanks for response. I did try this mechanism. But opening SCO socket and routing the audio did not work for me. Can you please tell me which devices worked with you? I use Galaxy Nexus 3 (running 4.1.1 as it had old BT stack). – amsurana Feb 18 '14 at 04:59
  • Worked for me on a Nexus 7, but not on a Nexus 4, or Samsung Galaxy 2. So I think it may be that on a phone it doesn't work. I don't know. – David C Adams Feb 18 '14 at 05:05
  • This may not work for my use case. I am now looking at the ScoSocket implementation in GingerBread. This class was removed in future releases though. Thanks for help. – amsurana Feb 19 '14 at 04:08
  • Thank you, this works for me on LG-P870 (Android 4.0.4) – TwinPrimesAreEz May 14 '14 at 19:52