我想知道媒体播放器服务(在设备启动时注册到media.player )是否正在使用adb shell运行。有可能吗?
我尝试运行ps命令,但没有成功。
发布于 2012-06-05 21:22:33
尝试命令行
adb shell service list
我得到了一个服务名称和它们的包名的列表。
发布于 2016-12-20 14:23:45
如前所述,adb shell service list将只列出系统服务。
如Android Emulator: How can I get a list of services that are running中所述,您可以使用查找由应用程序创建的服务
// List all services
adb shell dumpsys activity services
// List all services containing "myservice" in its name
adb shell dumpsys activity services myservice如果它返回了什么,则表示该服务已安装。要了解服务当前是否已启动或停止,请分别查找app=ProcessRecord(...)或app=null。
你也可以用Linux风格的简单的
ps | grep myservice在你的壳里面。
发布于 2014-06-13 23:29:32
要简单地检查特定服务是否正在运行,请使用:
adb shell service check <service>例如,如果adb shell service check media.player正在运行,则返回Service media.player: found,否则返回Service media.player: not found。
如果您需要更多详细信息,请尝试dumpsys <service>。例如,adb shell dumpsys media.player返回有关media.player的客户端、打开的文件等的信息。
最后,如果你真的需要调试的详细信息,可以试试adb shell dumpsys activity services,它从ActivityManager的角度显示了正在发生的事情。这包括意图、创建时间、最后活动时间、绑定等信息。如果你想存储输出供以后查看/搜索,你可以重定向输出。它通常相当长。
https://stackoverflow.com/questions/10896629
复制相似问题