M
M
mitaichik2019-06-14 20:34:22
Android
mitaichik, 2019-06-14 20:34:22

Does Android save app data when forced to unload?

Hey!
Everyone knows that an application in the background of Android can crash if, for example, there is not enough memory.
Question: after such a kill, when you open the application, does it try to restore its state? Or stupidly opens from scratch?
If it does, is there any way to save the state of the application (like onSaveInstanceState on an Activity)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Denis Zagaevsky, 2019-06-14
@mitaichik

In general, depending on what is considered a state. If the activity is put in the background, onSaveInstanceState will be called, if the application is killed by the system, then when restoring from the list of recently opened ones, onRestoreInstanceState will be called. Accordingly, if you save everything you need, then it will be restored. This is approximately what happens with don't keep activities.
Any singletons, statics saved in the application, generally speaking, will be lost.

G
GavriKos, 2019-06-14
@GavriKos

Android - open from scratch.
But the application itself can save the data at the time of the kill, and try to restore it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question