Integrate Android's Connection (from ConnectionService) with OpenTok Audio stream

Viewed 234

We have an Android application which implements a SelfManaged ConnectionService to interact with the built-in telephony. We use OpenTok as the VOIP provider.

So far, when we receive a call, we call telecomManager.AddNewIncomingCall() to alert the system for an incoming call, and then on onShowIncomingCallUI() we display the notification. When our user accept the call, we call SetActive() on the current Connection and start the call.

We experience a problem with the above setup, which is that our user cannot hear the other side. Video is OK and the other side does hear us.

After debugging the issue we came to a temporary solution which is to not call SetActive() on the Connection, but rather call SetDisconnected() and Destroy(). We suspect that the active Connection gets a higher audio focus from the OS, which explains why we cannot hear while the Connection is active and not destroyed.

How can we still keep the Connection active while the call is active, and use the Connection's audio focus that it receives from the OS?

We have tried calling audioManager.RequestAudioFocus with GAIN or GAIN_TRANSIENT with no success so far.

Thank you.

0 Answers
Related