views:

323

answers:

4

How can I check missed call in iPhone using Objective-C?

+2  A: 

There is no access to the iPhone phone from third party software. Luckily.

Niels Castle
I think it is unfortunate that this is not possible. I would prefer to see the Android model where a user has to confirm that an app has access to specific parts of the phone.
St3fan
It's security feature. Everything on the iPhone is configured to protect the operation of the phone because the phone must work in the case of an emergency. There are also potential privacy issues if 3rd party apps could get phone numbers or listen to phone tree codes.
TechZen
A: 

When you have an incoming call, the function

- (void)applicationWillResignActive:(UIApplication *)application;

is called and if the call gets missed, the application will be active again and the function

- (void)applicationDidBecomeActive:(UIApplication *)application;

is called.

This way, you can detect missed calls. There is no other method to do this that i am aware of.

The only drawback is that these methods are also called when you Lock/Unlock the device when your application is active so you will not be able to know whether it was a missed call or the user locked the device.

Chintan Patel
Easy way around the Lock/Unlock problem, just pop up a dialog box asking the user if they just missed a call (press yes or no)
kubi
+1  A: 

The sandbox prevents access to the phone functions from third-party apps. Thus there is no way to detect missed calls.

Jack
A: 

Using Core Telephony framework, detect for call state changes. Listen for incoming calls. Now your application will be notified when there is an incoming call.

After this, when the alert pops up, applicationWillResignActive is called.

  1. If the user accepts the call, applicationDidEnterBackground is called, and then when user switches back to your application applicationDidBecomeActive will be called.
  2. If the user rejects the call or the calling person ends the call before accept/reject, applicationDidBecomeActive will be called.

The second case indicates a missed call.

Akash Thambiran