Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to tell if your app is being used while the user is on the phone?

There are certain portions of my app that would be better to highlight to the user if they're on the phone.

Is there a call to check to see if we're on the phone? Unfortunately, "call" is a horrible word to check for in API documents for obvious reasons.

like image 245
Michael Avatar asked Oct 07 '09 20:10

Michael


People also ask

Can someone track my app usage?

Even if you're cautious about what information you reveal online, it's possible someone could stalk you via apps installed on your smartphone. Stalking apps (also known as spyware and stalkerware) are apps that someone can download onto your phone to secretly track you.


2 Answers

Take a look at the difference in size between [[UIScreen mainScreen] bounds] and [[UIScreen mainScreen] applicationFrame]. If the diff is 20 pixels and you aren't hiding the status bar, then the users probably isn't on a call. If the difference is 40 pixels, your users is probably on a call, since the glowing green status bar that appears during calls is about twice as big as the normal status bar.

I haven't done this before, so YMMV. Good luck and let me know if it works!

like image 75
kubi Avatar answered Sep 20 '22 21:09

kubi


The CoreTelephony Framework can tell you.

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

like image 20
Eric Avatar answered Sep 20 '22 21:09

Eric