有没有办法判断我的 Android 应用程序何时终止?在 iOS 中,AppDelegate 中有一个方法
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
我需要这个,因为我只想在应用程序结束运行时做一些事情,而不是在它进入后台或特定 Activity 结束时做。
提前致谢!
最佳答案
Is there a way to tell when my android app will terminate?
没有。一旦处于后台,您的进程可以随时出于任何原因消失。您不会收到进程即将终止的通知。
I want to do something only when the application will be finished running
Android 中并没有真正的“完成运行”的概念。
关于Android - applicationWillTerminate 等效,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24091227/