CallKit: Launch app when screen is locked - ios

I have implemented callkit to receive the VoIP notification.
On accept the call I am managing calls through another third party ForzenMountain which has my custom screen to show the status of calls.
1) When screen is not locked: Call comes then it shows two button. On accept it goes into the app itself and I can manage all.
Problem:
2) When screen is locked: It show another transition which has multiple option like (speaker/keypad/mute/addcall) rather than to go into app.
I need to land on my app even my device is locked (if passcode enable then ask to enter it) so that I can manage FM and my custom calls screen.

Unfortunately, there's no way to go directly into your app if the phone is locked. The system will only display the native CallKit UI and from there you can tap on the bottom right button to go into your app.

Related

How to detect non-intrusive phone call

In iOS 14 you can now accept phone calls that do not take up the entire screen (the new non-intrusive phone call UI looks like a push notification). If you accept the call, but do not open up the full screen call UI, the app remains open. This is true even if you pick up the phone and put it to your ear the app remains active.
What would the best way be to detect an incoming call, or that the user began the call?
You can’t detect it. If the user just takes the call direct from the banner, your app remains active and there is nothing to detect. That is the whole point of this feature: a call need not interrupt your app in any way.

Switching from in-app UI to CallKit UI during two ongoing calls with one on hold

I'm working on a Voip app and integrated CallKit. I know the CallKit UI will not show when there's incoming Voip calls, however the problem is when there's an ongoing Voip call and phone call at the same time (one on hold). You can test the below using Whatsapp.
Start Voip call
During the call, someone calls the phone using non internet sim/phone line
CallKit UI shows up, with options to decline, end, or hold the voip call to answer the incoming phone call
Select 'hold and answer', callkit UI shows two calls, with the voip call being hold
Go back to the Voip app either by pressing the swap button and then the app icon (on the callkit UI itself), or by pressing going to home screen and click on app icon
Voip app shows, there's a green bar on top that says 'Touch to return to call', I want to be able to go back to CallKit UI screen when user taps it (same as whatsapp).
If you test this on whatsapp you will know what I mean, I want to achieve the same behaviour.
I have implemented the top green bar following this post:
How to show double height green statusbar (In-Call) in foreground app on device?
However I couldn't find a way to programmatically bring the CallKit UI back to the front, the answer in that post doesn't show how.
This post is similar but there's no answer because for that case there's no other calls on hold hence there's no requirement to bring CallKit to the front: CallKit - How to bring the CXCallController to the front
I found that the info that I got on stackoverflow on this topic were outdated. For the case where there's multiple calls on CallKit, the green bar will show even when your app is in the foreground given that your app is showing the status bar!
Previously it didn't appear on my app because I have set the status bar to be hidden on that particular page where the call is being made... so the solution is to detect when there is call being set to on hold (via callkit delegate) and show the status bar, and hide it when one of the calls ended and there's no more calls on hold.
When user clicks on the green bar while inside your app, it brings user back to the CallKit UI as expected.
First declare variables
var callKitProvider: CXProvider!
var udid = UUID()
then call this function where call will be ended
callKitProvider.reportCall(with: udid, endedAt: Date(), reason: .remoteEnded)
please make sure that same udid used in "report call" and "incoming call"

Is there a way to suggest user to unlock the device when receiving a video call?

I'm receiving an incoming video-call (the app is in background), displaying system UI. When I slide to answer - call starts and there's a button to open the app. Can I somehow programmatically press this button on answering or suggest user to unlock his device without tapping app button?
Without use of a 3rd party API or a jailbroken iPhone, this is not possible. However, it would be possible to send a notification to the user to unlock their device.

Button accesible from lock screen in iOS

I want to develop an iOS app that can have like a panic button when the screen is locked. This button can be enable or disabled within the app, but
I want to know if it is possible to add a very accessible button you can press in case of an emergency even when the screen is locked. When the button is pressed I want to execute some code in the app.
Is there a possible way of accomplishing this in iOS?
Or is there an alternative?, The only think that I required is that the button can be pressed like in maximum three seconds even if the screen is locked and the app closed.
No that is not possible in iOS. You cannot make changes outside of your app.
One suggestion i can give you is to make a extension for today view in notification center. And you can ask the users to touch the button in notification center to invoke your functionality.
Notification center can be accessed in lock screen also.

Detect if home button is pressed while the app is running in the background

I need a way for my app to know if the home button is pressed, while the app is running in the background. If the home button is pressed, something is gonna be added to a list inside the app. Is that possible somehow?
If your app is in the background, your app wont receive any updates. Furthermore, there isn't any way to hook into the home button click even if your app is in the foreground.
Perhaps there is a private api way to handle this, but your app certainly won't be able to both achieve this goal and be in the Apple App Store. Sorry!
In case you wanted some idea why Apple doesn't allow this, it's because they don't want the home button switch's default behavior to be altered. See this:
10.5 Apps that alter the functions of standard switches, such as the Volume Up/Down and Ring/Silent switches, will be rejected

Resources