Is there a way to find out if the user is working while using my application?

Is it possible to determine whether the user uses a phone call when using the application.

Here is the scenario:

  • I get a call
  • I accept the call
  • Press the home button
  • Launch the application

At this point, can I tell this application that the call is in the background?

Getting to know the screen is not a complete option. Because it makes life difficult when connected to the Internet.

+4
source share
3 answers

You can check the height of the status bar. If it is more than 20 pixels, you either make a call or get attached (which is not supported by AT & T, so it should be on call if you are in the USA).

[UIApplication sharedApplication].statusBarFrame 
+1
source

There is no public API for any state or functionality of the phone, so you have to rely on the side effects of the call.

You can check the status bar, as suggested by Ben Gottlieb, or you can try to initialize the audio recording , if it doesn’t work with the error already in use, you can be sure that the microphone is used for the call.

+1
source

To clarify what Ben said, you'll want to subtract [UIApplication sharedApplication] .statusBarFrame from the height at which you set your view.

+1
source

All Articles