iPhone background app to update the screen when a phone call is received

We are in the process of writing an iPhone app (that will be in the background) that would be notified when an incoming phone call comes. The app does some background work - going to a server retrieving some data while the phone session is ongoing and then notifies the user.

After searching, I found that I can use the Private Telephony Headers/Framework to actually know who is calling in my app. However, I am unable to update the dialer screen with information retrieved from server. Also I found that the application has to be running when the phone call arrives. Yak!!

I know that this won't approved in the apple store , however I am looking for 2 things:

  • How do I put this app in the background.
  • How do I show some information while the call is going on. Local notification is fine but it has to show immediately.
  • Even if we have to jailbreak, I would like to know how to get this done. This app is for law enforcement officials - proof of concept.


    As YllierDev said, you could look into a MobileSubstrate tweak to display the information. But, for something that's maybe a little less daunting for someone new, you could try this:

  • First, create a launch daemon . This can run in the background and do whatever you like. It'll be started when the phone boots, so the user doesn't need to first run some app, and then put it into the background. I found this to be a good example of building a LaunchDaemon

  • It sounds like you already know how to use undocumented features of the Core Telephony framework to get notified of a new call. This will be your daemon's responsibility. For completeness, see this answer, or this other answer on how the daemon can listen for calls with Darwin notifications.

  • When the call is intercepted, your daemon can contact your server.

  • Then, you can create a simple popup with something like this:

  • CFOptionFlags responseFlags = 0;
    CFUserNotificationDisplayAlert(20.0, 3, NULL, NULL, NULL, 
         CFSTR("Hello"), CFSTR("Hello World"), CFSTR("OK"), 
         NULL, NULL, &responseFlags);
    

    Here's some Apple docs on CFUserNotifications

    You'll probably have to link with the CoreFoundation framework, and maybe include this header in your project, for CFUserNotificationDisplayAlert() to be available.

    But, that should give you a popup with your dynamic call data.

    链接地址: http://www.djcxy.com/p/10774.html

    上一篇: 在WinForms WebBrowser控件中禁用JavaScript?

    下一篇: iPhone后台应用程序在接到电话时更新屏幕