Android动态壁纸好像没有退出?
我尝试过运行各种动态壁纸。当我将另一台设置为活动状态时,当我输入“ps”时,旧的仍然显示在 adb shell 中:
app_37 12107 1870 125356 16932 ffffffff afe0da04 S fishnoodle.aquarium_free
app_50 12196 1870 109620 16804 ffffffff afe0da04 S com.geekyouup.android.snowpaper
我正在构建的自己的也这样做......有什么我不明白的吗Android应用程序的生命周期?
(在我自己的代码中,服务线程完成的代码,但它仍然显示在 ps 中)。
I've tried running a variety of live wallpapers. When I set a different one to be live, the old one still shows up in the adb shell when I type 'ps':
app_37 12107 1870 125356 16932 ffffffff afe0da04 S fishnoodle.aquarium_free
app_50 12196 1870 109620 16804 ffffffff afe0da04 S com.geekyouup.android.snowpaper
My own one that I'm building also does this... is there something I'm not understanding about the lifecycle of android apps?
(In my own one, code the service thread finishes, but the it still shows in ps).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Android 会尽可能长时间地将应用程序保留在内存中,即使它们没有运行,以确保用户再次打开应用程序时能够快速响应。动态壁纸是普通的 Android 应用程序,因此它们也会受到同样的影响。
如果您不确定服务是否会终止,您可以覆盖服务的
finalize()
方法并调用Log.d("Wallpaper", "finalize()");
Log.d("Wallpaper", "finalize()"); code> 来查看它是否被垃圾收集器销毁。Android keeps applications in memory as long as possible, even if they are not running - to ensure a quick response if the user opens up the application again. Live wallpapers are normal Android applications, and because of this they are affected in the same way.
If you are unsure about your service being terminated, you might overwrite the
finalize()
method of your service and callLog.d("Wallpaper", "finalize()");
to see if it is destroyed by the garbage collector.