Search code examples
iosobjective-cvoipsinch

Showing in-call status bar (double height) for a custom VoIP app in iOS


I have created a VoIP app in iOS using the Sinch library. I am able to make calls successfully, but am having trouble creating the double-height in-call status bar. By this I mean, my call window appears, and on that window I have a button to leave the view and go somewhere else (WITHOUT hanging up the call) and I would like a green double height in-call status bar to be displayed so that I may tap it and return me to call view.

When I send the app to the background, I see the double-height red bar to return to my app on springboard, so the background mode & voip mode seems to be set correctly. I know for sure WhatsApp manage to get the green bar (as seen here).

I've searched for a while now and the best I could find is to use AVAudioSession as answered on this question.

However even after following the instructions there and trying to add some other ideas, I can't get the green in-call status bar to popup. It feels like I would have to tell iOS which view my call is being handled on? So that it knows when to show the green bar?

The code I've tried:

[[AVAudioSession sharedInstance] setCategory:AVAudioSessionModeVoiceChat error:nil];
[[AVAudioSession sharedInstance] setActive:YES error:nil];

This is apparently already handled by Sinch however, as mentioned in their documentation so really I'm at a loss.

The Sinch SDK applies the audio session category mode AVAudioSessionModeVoiceChat for improved voice quality.


Solution

  • Thanks to @cjensen from Sinch for his help, was useful. Posting my own answer as I don't feel that his response fully answers my question.

    Basically iOS has no inbuilt functionality to display an in-app status bar, you need to create your own. @cjensen's response led me to this article explaining this.

    If you need an in-app call status bar, you need to create it yourself or use a library like KrauseFx's TSMessages to do it for you. Using a UILocalNotification as @cjensen suggested is simply one way to provide an entry point to decide when to create this banner.