如何从计划的代理检查前台应用程序是否正在运行 [英] How to check from scheduled agent if the foreground app is running
本文介绍了如何从计划的代理检查前台应用程序是否正在运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以检查前台应用程序是否正在按计划的任务运行?就我而言,它复制了应用程序的功能-因此,我可以跳过代理中的该部分以保留资源.
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.
谢谢
推荐答案
如果您的应用正在运行,您将无法访问进程列表或任何类似的可以提供信息的列表.
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.
这篇关于如何从计划的代理检查前台应用程序是否正在运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文