I want to store the data exactly when Application.Quit() method get called. Basically I want one callback method that get called one time during application life cycle, just when application killed by operating system of the device.
With iOS, I managed to work with following line of code:
void OnApplicationQuit()
{
//if (pauseStatus)
//{
DataStorage.StoreLastOpenedDay(DateTime.Now.Day);
DataStorage.StoreLastOpenedMonth(DateTime.Now.Month);
DataStorage.StoreLastOpenedYear(DateTime.Now.Year);
//}
}
But I got information that in Android, OnApplicationQuit method didn't get called by the running activity.
So what is alternative exist in Android for implementing same thing as like iOS? I can't use OnApplicationPause method because it get called multiple times when any external process happen when your application is running for ex. phone call, in app purchase related popups etc... I want code to be executed only once when application get killed.
Please share your side suggestions about this.