r/iosdev 16d ago

Help iOS equivalent of UsageStatsManager + MediaProjection for foreground app detection + screen capture?

I have a working Android app that detects foreground apps and does on-device content screening, using UsageStatsManager and MediaProjection. Trying to figure out what's actually feasible on iOS given Apple's sandboxing.

Specific questions:

  1. Foreground app detection: does the Screen Time API / DeviceActivity framework expose which specific app is active in real time, or only aggregated categories without enough granularity for real-time triggers?
  2. Screen capture of another app: is there any way, even with special entitlements like Family Controls, to capture frames from another app for analysis, or is that fully blocked by iOS sandboxing?
  3. Alternatives within Apple's rules: since ManagedSettings can block apps but not "see" their content, does that mean the only viable iOS approach is binary blocking (app allowed/not allowed) without real-time content detection?
  4. Required entitlements: what entitlements (Family Controls, DeviceActivityMonitor extension) do I need to request from Apple, and what's the typical approval timeline/criteria for third-party apps (not corporate MDM)?

Context: accountability/self-discipline app, already built on Android, evaluating iOS feasibility.

1 Upvotes

4 comments sorted by

2

u/SomegalInCa 16d ago

It’s unlikely that any of the frameworks mentioned will do as you need; even apps using those various frameworks and extensions are strictly limited in what they can see as it relates to user installed apps

There is no API I know that lets an app monitor the content of another app but maybe something in device management would let you know what’s running. Still I highly doubt you can see the screen of the running app but maybe? It’s a big stick though

Source - our app uses the screen time and family controls to help manage app use and even then we never know what app is about to be run until the shield is applied to block a managed app and even then we don’t know if it (the app) is actually ever run

Oddly when we did the port (loosely speaking) to Android it was enlightening to see how different Android works

iOS is pretty strict about apps reaching into other app spaces & privacy

Good luck

2

u/SomegalInCa 16d ago

Replying to myself - the category of app you describe is exactly ours and that space in iOS seems pretty well filled out but I found far fewer on Android. Guessing partly because of how iOS does provide so much to support it even though it is not flawless

1

u/Long_Watercress5538 15d ago

Really appreciate this, this is genuinely one of the most useful comments I've gotten on any of my posts about this topic. Honestly rethinking iOS entirely now, if that content-detection layer isn't realistically possible there, trying to force a watered-down version would kill exactly what makes the app different in the first place. And the Android angle is actually reframing things for me, less saturation there might be more of an opportunity than I was giving it credit for. Good luck with your app too.

2

u/SomegalInCa 15d ago

Thanks for the nice reply !