为什么我的进程总是显示在 DDMS 进程列表中?
使用 DDMS,我看到 Android 中有 3 个活动进程:Viber、logitech Harmony 和一个带有我的包名称的进程。 问题是我从未创建过任何流程。
为什么 Android 代表我打开一个进程?出于什么目的?
另外,为什么我看不到所有其他应用程序的进程,例如 gmail、地图等,即使它们位于前台?
一些想法:我确实使用 FileObserver 监听文件夹更改。也许就是这样?也许这与在开发环境中运行应用程序有关?
Using DDMS, I see 3 processes active in my Android: Viber, logitech harmony and a process with my package name.
The thing is that I never created any process.
Why have Android opened a process on my behalf? For what purpose?
Also, why can't I see all the other apps' processes, like gmail, maps, etc. even when they are found in the foreground?
Some thoughts: I do listen to folder changes using a FileObserver. Perhaps that's the thing? Perhaps it's something related to running the app in a development environment?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
因为你运行了你的应用程序。
因为它们不是在调试模式下编译的。在生产设备上,只有调试版本(或清单中
android:debuggable
设置为true
的应用)才会出现在 DDMS 中。Because you ran your application.
Because they are not compiled in debug mode. On a production device, only debug builds (or apps with
android:debuggable
set totrue
in the manifest) will appear in DDMS.每个应用程序都在单独的进程中启动。因此,您的应用程序被显示为一个进程。也许其他应用程序在您的手机上未激活,因此不会显示。
Each app is launched in a separate process. Hence your app is being shown as a process. Perhaps other apps are not active on your phone hence they are not being shown.
除非手机内存不足,否则 Android 会保持进程处于活动状态以防万一。当您关闭活动时,进程会保留。
那,或者你可能正在运行一个服务。当您的应用程序中运行服务时,Android 会更加尊重该进程,这意味着只有在所有不执行任何操作的进程都关闭后,它才会关闭。
Unless the phone is starved for memory, Android keeps processes alive just in case. When you close an activity, the process stays.
That, or you might have a service running. When a service is running in your app, Android treats the process with even more respect, meaning it gets shut down only after all the do-nothing processes are shut down.