0

I have implemented CTCallCenter and getting the eventhandler call when app is in the foreground. is there any way my app gets called when its not in the memory or in the background.

Also looked at How to get a call event using CTCallCenter:setCallEventHandler: that occurred while the app was suspended?

func block (call:CTCall!) {
    NSUserDefaults.standardUserDefaults().setValue(call.callState, forKey:"state")
    NSUserDefaults.standardUserDefaults().synchronize()

    println(call.callState)
}



 func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
    // Override point for customization after application launch.
     println(NSUserDefaults.standardUserDefaults().valueForKey("state"))
    callcenter.callEventHandler = block
    return true
}

use case: i want to have a LED turn on when i get a call. just to show the status. Will not be uploading to the app store so don't have to worry about app getting rejected.

Community
  • 1
  • 1
Paragon
  • 982
  • 2
  • 10
  • 37
  • Easiest thing (as you are not submitting to the app store) would be to give you app a background mode, audio would be best, to keep the app executing in the background so that it can receive the call events. – Gruntcakes Aug 31 '15 at 22:49
  • I have added background modes. just turned them on from capabilities. Didn't add mp3 files or code. – Paragon Sep 01 '15 at 14:00

0 Answers0