I could not find much information about the state of the application.
This is because there is no “application state” in Android, more than in a web application.
but keeping it too slow every time the action clicks on Pause
So far, your entire data model may be “1-2 megabytes,” but the amount of data that will change will be a small subset of any given change. Use a background thread and only modify changed data.
which happens very often when actions come and go
It seems like you have too many activities.
I need a way to determine that my application (and with it my data model) is being destroyed
It's impossible. You will never know that you are being destroyed. Android can and will terminate your process without warning, either at the request of the user (for example, Force Close, kill), or for OS reasons (for example, it is necessary that the RAM process an incoming phone call).
You can use onUserLeaveHint() , which is called on a number of occasions when the entire application loses foreground, but I certainly won’t count on it for something as important as saving the data model.
source share