开发者

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

How can I check missed开发者_如何学C call in iPhone using Objective-C?


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


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


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜