Is there a way to tell when my android app will terminate? In iOS there is a method in the AppDelegate
- (void)applicationWillTerminate:(UIApplication *)application
{
// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}
I need this because I want to do something only when the application will be finished running, and not when it enters the background or a specific activity is ended.
Thanks in advance!
Is there a way to tell when my android app will terminate?
No. Your process can go away at any time, for any reason, once it is in the background. You are not notified that your process is about to be terminated.
I want to do something only when the application will be finished running
There isn't really a concept in Android of "finished running".