Reputation: 4203
I just would like to know if it is possible, in any way, to know from my app that another app has been opened and if yes. Can I retrieve the name of the app.
I think that it's impossible, but maybe it exists a tricky way to do it.
Thanks
Upvotes: 0
Views: 289
Reputation: 11502
Well, you can get a list of currently running processes using sysctl
see this qn:
Get Free Mem and Running Processes
However, since your process can explicitly run in the background for 10 minutes after being backgrounded (unless you're running voip, audio, or location service), the utility of this may be limited. You will also need to find a way to determine if a process is running in the foreground (perhaps checking for the delta of running processes?)
Upvotes: 1
Reputation: 185681
Sorry, but no, there's no way to do this. You actually can get the other pids on the system via standard POSIX calls, but when you're in the background, you're not actually running, so you can't do anything.
Upvotes: 1