How to get foreground running app name using a background service

Guys,


I'm working on a child protection app which can block and notify when children trying to use phone while driving. This is the functionalty of my App.


  1. My application is running in the backgroud. I'm using location based service to keep it running in background.
  2. When user trying to use an app while driving , I want to identify that app and if that's a social media app or chatting app , I want to notify user not to use that and also send an alert to parents.


To do that, I want to identify what is the app currently running in the foreground using my background app. Is there any way to get the name of the foreground app using a background service ?

Replies

I certainly hope it’s not possible. I don’t want third party apps doing analytics on what apps I use and when.


”Child protection apps” in general (ones that snoop all user activities) are fundamentally at odds with Apple’s views on privacy. You have picked a challenging task.

I agree w/JP, and as in the past, add this note. Your app, however well intentioned, is no replacement for proper parenting. Make an app that helps with that, not something that offers to offload that responsibility.