I'm trying to develop an iOS app that monitors whether a specific app is running and then sends a local notification after a certain period.
On Android, I can achieve this using UsageStatsManager or AccessibilityService, which allows me to detect foreground apps and trigger a notification.
However, in iOS, it seems there are strict limitations on detecting which apps are running. After researching, I found that:
UIApplication.shared.canOpenURL() requires explicit whitelisting in Info.plist, but it only checks if an app can be opened, not whether it's currently running. Screen Time API (Family Controls) may allow tracking app usage, but it's only available for parental control apps and requires special entitlements. Background App Refresh cannot track other apps.
What I want to achieve: Detect when a specific app is running in iOS. After a certain period (e.g., 5 minutes), send a local notification reminding the user to stop using the app.
Questions: Is there any way to detect when a specific app is running in iOS?
Are there any workarounds (e.g., via Screen Time API or other system features) to track app usage for this purpose?
If direct detection is impossible, what alternative solutions could achieve a similar user experience?
Any guidance or alternative approaches would be greatly appreciated! Thanks in advance.