1 Reply
      Latest reply on Jun 27, 2019 8:03 PM by CrabbInnovationsLLC
      jayden Level 1 Level 1 (10 points)

        Hi,

         

        I need to monitor in my app which interacts with BLE when a user is on the phone or not due to a limitation with some devices and BLE. I've written a basic call observer to test - but when the application is backgrounded it is not receiving any updates. I was wondering if anyone knew how to get call status notifications in the background?

         

         

        
        class ViewController: UIViewController{
          @IBOutlet weak var callStatusLabel: UILabel!
          var callObs : CXCallObserver!
        
          override func viewDidLoad() {
            super.viewDidLoad()
            /
            callObs = CXCallObserver()
            callObs.setDelegate(self, queue: nil)
            print("Monitoring Calls")
            callStatusLabel.text = "Monitoring..."
            self.view.backgroundColor = UIColor.yellow
          }
          override func didReceiveMemoryWarning() {
            super.didReceiveMemoryWarning()
            /
          }
        
        }
        extension ViewController : CXCallObserverDelegate
        {
          func callObserver(_: CXCallObserver, callChanged: CXCall)
          {
            if(callChanged.hasEnded)
            {
              print("Call Ended")
              callStatusLabel.text = "Call Ended"
              self.view.backgroundColor = UIColor.green
            }
            else if(callChanged.hasConnected)
            {
              print("Call Connected")
              callStatusLabel.text = "Call Connected"
              self.view.backgroundColor = UIColor.red
            }
          }
        }
        

         

        I currently have the following Background modes enabled:

        • Audio, AirPlay & PIP
        • Loc Updates
        • VOIP
        • External accessory comm
        • Uses BLE
        • Background Fetch

        • Re: CallKit - Call Detection
          CrabbInnovationsLLC Level 1 Level 1 (0 points)

          I've also been trying to figure out how to get the call status when my app is in the background. I realize I'm replying to this 2 years later, but I'm still shocked that Apple hasn't made this functionality possible. CallKit needs to be geared toward more than just VoIP.