Is there a way to find out if your application is used when the user is on the phone?

There are some parts of my application that will be better allocated to the user if they are on the phone.

Is there a call to check if we have a phone? Unfortunately, โ€œcallingโ€ is a terrible word for validation in API documents for obvious reasons.

+6
iphone core-telephony
source share
4 answers

CoreTelephony Framework can tell you.

The currentCalls CTCallCenter method returns the set of active cellular calls currently.

+2
source share

Take a look at the size difference between [[UIScreen mainScreen] bounds] and [[UIScreen mainScreen] applicationFrame] . If diff is 20 pixels and you are not hiding the status bar, users probably won't call. If the difference is 40 pixels, your users are likely to be on a call, because the glowing green status bar that appears during calls is about two times larger than a regular status bar.

I have not done this before, so YMMV. Good luck and let me know if this works!

+5
source share

The application does not exit, when a call arrives, it goes into an inactive state. The following method should be called on UIApplicationDelegate :

 - (void)applicationWillResignActive:(UIApplication *)application 

This method is also called in other cases, for example, when the iPhone is locked and you have no way to determine if it caused an incoming phone call.

+2
source share

When the iPhone receives a call, the application terminates. You can register a callback to handle this event gracefully, see

http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIApplicationDelegate_Protocol/Reference/Reference.html#//apple_ref/occ/intfm/UIApplicationDelegate/applicationWillTerminate :

When the call ends, your application will restart.

Applications that preserve your state during a conversation are well written :)


Arggh! I just read your real question.

I can not find and do not know any APIs to access the phone application. My only advice would be that Phone is an application, like any other, and that it can publish information through the http tunnel provided by all applications.

I wonder if you can just have the โ€œI'm on the phoneโ€ button that the user could click to achieve the same results?

0
source share

All Articles