Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

  1. How do I put this app in the background.
  2. 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.

like image 401
R K Avatar asked May 17 '12 02:05

R K


1 Answers

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:

  1. 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

  2. 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.

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

  4. 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.

like image 95
Nate Avatar answered Nov 15 '22 07:11

Nate