john.k.doe
john.k.doe

Reputation: 7563

how can i tell when the phone is in a call when i return to my app without checking the status bar frame?

i am using UIApplicationWillChangeStatusBarFrameNotification to tell when the status bar will change, and this does help me figure out when the call in progress goes away, and the behavior is as i would like.

however, there is one scene in my app in which i take the full screen, and that includes hiding the status bar … except that i would like to not hide the status bar when in a call.

my understanding is that the only way this status-bar will first show up is if i (a) get a phone call, then (b) return to my app.

so … when i return to my app upon receiving a phone call … there is no green status bar. (fwiw, the green status bar does appear when i tap on my app to make the status bar and nav bar and tab bar re-appear, so it's not that it is entirely gone; just hidden because i told it to be hidden. in the simulator, performing the "Hardware -> Toggle In-Call Status Bar" works as i would like, but i don't think this behavior will ever really occur this way in the real world.)

i found the answer to How do I get notified when a user opens my iPhone app while in a phone call? … but that only works if the statusBar is visible when my app is re-opened.

i want to know how to tell that i'm in a call when i return to my app so that i can manually unhide the green status bar while the user is looking at my scene that otherwise will hide the status bar.

my question is thus: is there an interface to tell me this information that i can query when i return to the app in applicationDidBecomeActive: or via some other sort of notification?

Upvotes: 0

Views: 686

Answers (1)

dchappelle
dchappelle

Reputation: 1710

You can use CTCallCenter to find out if there is a current cell call. You and also register a handler with this class to be notified about cell state changes.

    CTCallCenter *callCenter = [[CTCallCenter alloc] init];

    // If no calls are in progress, the value of this property is nil.
    if ([callCenter currentCalls] != nil) {
        ... call present...
    }
    [callCenter release];

Upvotes: 2

Related Questions