1

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.

Community
  • 1
  • 1
ed'
  • 1,815
  • 16
  • 30
  • Are you asking about why the statusbar is red instead of green, or why it does not show in your app? Red statusbar is for audio background mode, so maybe remove it and use voip only. Showing the status bar in your app is something you have to do yourself. – Mats Jun 01 '16 at 15:14
  • The red status bar when I am outside of the app is fine. But when I am inside the app, I want the green one, i.e. I want both. If its something I do myself, how do I create a double height status bar? – ed' Jun 01 '16 at 15:15

2 Answers2

1

So IOS automatically displays the red bar as you describe when you are recording in the background. To display your own custom you are on the right track, you need to have your own notification on every view, I would implement a base controller and make sure its visible if needed. check this SO Displaying a stock iOS notification banner when your app is open and in the foreground? for one way of doing this

Community
  • 1
  • 1
cjensen
  • 2,703
  • 1
  • 16
  • 15
  • Are you sure about this...? And I can style it to be green and look like the status bar...? I don't want a notification on every view, I want this [green bar](http://www.imore.com/sites/imore.com/files/styles/larger/public/field/image/2016/02/WhatsApp-calloptions-iphone-screens.jpeg?itok=0V80dTC1), the second picture. Please explain further if this is somehow related. – ed' Jun 02 '16 at 05:54
  • 1
    Yes, I am not using whats app my self, but in iOS you don't have the *warning* that you are using the mic in the app, the Green in call banner is only for the phone, so if whats app have one they have built it on their own. Its just a view that you place where ever you want. – cjensen Jun 02 '16 at 06:32
0

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.

ed'
  • 1,815
  • 16
  • 30
  • I managed to create my own in-app call status bar, but what's the code to return to the native call view when user taps on it? – Bruce Oct 19 '20 at 06:09