【问题标题】:Android: detect when the app is killedAndroid:检测应用程序何时被杀死
【发布时间】:2012-08-10 10:29:08
【问题描述】:

有没有办法检测 Android 系统何时终止我的应用程序?

【问题讨论】:

  • 如何解析日志以查看应用程序是否已被杀死?

标签: android kill


【解决方案1】:

经过调查,我想说的是,即使我们尝试使用关闭挂钩,也无法检测您的应用程序是否在应用程序内部被杀死。

【讨论】:

  • 是的。关闭挂钩在 Android 上不起作用。来自 Android 的运行时类文档 - Note that on Android, the application lifecycle does not include VM termination, so calling this method will not ensure that your code is run. Instead, you should use the most appropriate lifecycle notification (Activity.onPause, say).
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-13
  • 2018-03-18
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多