-->

How to make a VOIP app use a carkit like the nativ

2019-08-04 12:52发布

问题:

I've been searching for over a week now with no clear solutions.

We are building an ap that can make VOIP calls. The current implementation uses AudioManager.requestAudioFocus to tunnel a voice call over a bluetooth headset or carkit, and can uses the AudioManager state to accept incomming calls or hangup ongoing calls when the accept/hangup button on a headset is pressed. This all works fine.

However, when connected with a carkit that has both an accept and hangup button, the current implementation does nothing when the accept button on the carkit is pressed for an incoming voip call and accepts the call when the reject button is pressed. The carkit display also shows no incoming call.

I want to make the carkit react to our voip app identical as how it reacts to an incoming native call but I can't find anywhere how to do that. From what I've found I believe I need to implement a Bluetooth HFP server on the phone side, and use reflection to access hidden Android API's for that.

Can anyone point me to an example of how to do that? All implementations I can find already do what we do or even less (I looked at the Signal code).