I am working on an application where I need to transfer call from one device to another through Bluetooth protocol (i.e. I want the way like device transfer the call to hands-free). Any ideas?
Generally you can't. Android Bluetooth stack implements several Bluetooth profiles including HFP and A2DP. Android is an audio source for both profiles and it streams audio to the connected headset. The headset should implement Hands-Free Unit (HF) functionality and Android - Audio Gateway (AG) - as described on Bluetooth.org.
Now you want HF functionality on Android devices, which by design supports AG. You would need to implement HFP profile (HF side) for the device, which you want in fact to act as a headset. Take a look at the profile model. HFP is based on RFCOMM (supported by Android API) and SDP (which is not present in API). You won't be able to access some parts from BlueDroid (modifying SDP etc.) which are on the stack layer. Therefore your mobile phone can't pretend to be headset with HF functionality.
Of course you can send everything over RFCOMM (which is asynchronous as far as I know) but there is no direct support from Android Bluetooth API for this. Implementation with RFCOMM would require SCO link (SCO socket) and it may also be hidden in Android OS stack layer (couldn't find the way to create such socket via API).
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