0

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?

Community
  • 1
  • 1
john.k.doe
  • 7,533
  • 2
  • 37
  • 64

1 Answers1

2

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];
dchappelle
  • 1,580
  • 2
  • 13
  • 22
  • ok, this is basically the answer i was looking for. of course, it has the disadvantage of being harder to test on the simulator … and of requiring the need to pull in the CoreTelephony.framework just for this one check. but it really is much more to the point of checking if a call is in progress. thanks. – john.k.doe Jun 27 '12 at 01:59
  • a follow-up question: will this work for VoIP apps that keep the status bar at 40 for themselves? i.e. will they be registering with CTCallCenter ? – john.k.doe Jun 27 '12 at 02:05
  • Sorry, not sure what's meant by status bar at 40 but I can tell you the CTCallCenter won't convey VoIP status. Also, the VoIP application will get it's own in-call status bar when it sets the audio session to record and play – dchappelle Jun 28 '12 at 16:04
  • 40 == 40 pixels, the current passed height of the in-call status bar on iPhone. and you answered my question … as did some VoIP testing that i did which did not trigger the CTCall center. – john.k.doe Jun 28 '12 at 19:01