问题
Is it possible to check if the foreground app is running from a scheduled task? In my case, it duplicates a functionality of the app - so I could skip that part in the agent to preserve resources.
Thanks
回答1:
You cannot access a list of processes or anything similiar that would give you the info if your app is running.
You can do smething like storing a flag to the settings when your app starts and erasing it when your app exists and check this flag in the background agent.
来源:https://stackoverflow.com/questions/18342640/how-to-check-from-scheduled-agent-if-the-foreground-app-is-running