How to check missed call on iPhone using Objective-C?

How to check missed call on iPhone using Objective-C?

+4
source share
4 answers

No access to iPhone phone from third-party software. Fortunately.

+2
source

The sandbox prevents access to phone functions from third-party applications. Therefore, missed calls cannot be detected.

+1
source

Using the Core Telephony framework, identify call state changes. Listen to incoming calls. Now your application will be notified when an incoming call arrives.

After that, when a warning appears, applicationWillResignActive is called.

  • If the user accepts the call, applicationDidEnterBackground is called, and then when the user switches back to your application , the DidBecomeActive application will be called.
  • If the user rejects the call or the caller ends the call before accepting / rejecting, applicationDidBecomeActive will be called.

The second case indicates a missed call.

+1
source

When you have an incoming call, function

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

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

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

.

This way you can detect missed calls. I do not know any other way to do this.

The only drawback is that these methods also cause when you lock / unlock the device, when your application is active, so you won’t be able to find out if it was a missed call or the user blocked the device.

0
source

Source: https://habr.com/ru/post/1300051/


All Articles