Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect which app is in foreground on iOS9 without jailbreak

I'm trying to log users individual app usage on iOS9.

I'd rather prefer that it wouldn't use jailbreak limited solutions, self explanatory. Doing the variation of this app on a jailbroken phone shouldn't be hard.

This will certainly not be released on the App Store as Apple wouldn't allow it.

I'm looking for any private API that can do this, any hidden iOS API's that can be used to do this. ANYTHING.

What I've already looked through:

  • how to determine which apps are background and which app is foreground on iOS by application id
  • How to know about app launched and details jailbreak iOS 7
  • Is there a private API to be able to detect what is current foreground app on iOS?
  • How to monitoring App running in the foreground in iOS8?use the PrivateFrameworks SpringBoardServices

which proved to be relatively helpful - we now can assume that there is some sort of additional access requirement, probably an entitlement, but we don't really know how it should look like

  • Can you find individual app usage duration using SpringBoard services framework or other private framework?
  • Find out active application or if on Springboard
  • Programmatically detect which iOS application is visible to user

However all of these proved to be unhelpful because Apple fixed this security flaw with iOS8 and the method to copy/access the currently front most app bundle identifier no longer works.

Question is: Is there someone who knows a workaround using different tools/exploits that do not require jailbreak?

Ideas:

  • inspecting the processes running on the device and devising an algorithm that would be able to recognize spikes that mean an app has been launched, which potentially could work, but it probably would be a major pain in the ass. Questions mentioning this solution:

    • Detect which app is currently running on iOS using sysctl,
    • Return a list of running background apps/processes in iOS
    • How to get Names of Background Running Apps
    • Find Background running apps in iphone
  • inspecting the phones traffic somehow?
  • not sure if there is some kernel stuff that I could do

Here is my Reddit version of this question if anyone wants to check it out. Also if it's of any value, here are the runtime headers for iOS9 and list of Apple's private API's.

like image 371
Fero Avatar asked Nov 28 '15 20:11

Fero


People also ask

How do I know if apps are running in the background iOS?

Go to Settings>General>Background App Refresh and you can see what other apps are allowed to update data in the background. iOS dynamically manages memory without any user intervention. The only apps that are really running in the background are music or navigation apps.

What is the foreground on an Iphone?

Overview. Use foreground transitions to prepare your app's UI to appear onscreen. An app's transition to the foreground is usually in response to a user action. For example, when the user taps the app's icon, the system launches the app and brings it to the foreground.


2 Answers

Unfortunately, I was looking for a similar solution and have come to the conclusion that, at least at this point in time, there are no known methods that will allow you to determine app usage on iOS. Even the MDM providers such as Good, Airwatch, MobileIron, etc. don't seem to be able to do this. If anyone is able to come up with a solution, I'd love to see it.

For now, however, I think we would have seen a solution if someone had one that worked on the latest iOS.

like image 101
wottle Avatar answered Oct 25 '22 02:10

wottle


sysctl is still open but they block certain combinations of selectors. I did this on iOS 7 and gave Apple Product Security the code. They won't patch iOS 7 but rely on App Review. iPhone 4 is wide open.

like image 44
mikep Avatar answered Oct 25 '22 01:10

mikep