机器人如何检查的目的服务仍在运行或停止运行 [英] Android how to check if the intent service is still running or has stopped running
本文介绍了机器人如何检查的目的服务仍在运行或停止运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要知道,如果队列中的所有intentservices被消费或另一种方式是看看它仍然做的事情,这样我就不会继续下去,直到所有的服务都停止运行。任何想法?
I need to know if all intentservices in the queue are "consumed" or the other way is to find out if it is still doing something so that I don't continue until all services have stopped running. Any ideas?
推荐答案
试试这可能是ü有用
private boolean isMyServiceRunning() {
ActivityManager manager = (ActivityManager) getSystemService(ACTIVITY_SERVICE);
for (RunningServiceInfo service : manager.getRunningServices(Integer.MAX_VALUE)) {
if ("com.example.MyService".equals(service.service.getClassName())) {
return true;
}
}
return false;
}
这篇关于机器人如何检查的目的服务仍在运行或停止运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文