swift: How to make a call when phone is locked or app in background

Viewed 42

I have implemented Agora call in iOS app which works perfectly fine when app is in foreground ... Actually in my case we initiate call through Bluetooth BLE iBeacon. Along with this we call an API which is also working fine.

Problem is when app in background or when phone is locked ... Even when app is in background, app listens bluetooth event and Call API but it never start Agora call until we bring app to foreground. Means call works in foreground or it waits to start call when app enter in foreground.

To handle this I implemented local notification to prompt user to tap notification and bring app to foreground. But we want to do it through Bluetooth iBeacon. That instead of user to tap notification, it press beacon button to bring app in foreground and start call. On beacon button press I can catch the event in background as well but unable to bring the app to foreground.

Could not find some solution of it. But seems like its do-able as with Car tablets which are connected with bluetooth to phone we can dial a number on tablet and through bluetooth communication with phone it makes a call to selected or dial number even when phone is locked.

Means third party bluetooth devices can send command to locked phone and initiate call.

enter image description here

1 Answers

There are two ways using that you can make calls when app is in background or in locked state even your app is in killed state.

  1. Using CallKit Framework provided by apple.
  2. You can send custom push notification to the user and on click of push notification application is wake up and call is happen.
Related