I am doing a targetVersion upgrade in my app. Now I have a problem. When I go to phone settings, I manually refused permission. When I go back to my APP, I want to restart it and return to MainActivity. Now when I go back, it just restarts the current Activity. Can you give me some advice?
I checked some programs. They confirmed whether they were modified by judging savedInstanceState != null
. I think this is wrong because I backed up the data in savedInstanceState and only judged savedInstanceState != null
is not OK, it is one-sided.
You'll need to store your data in more persistent matter (shared preferences, database, files, whatever applies) and manually restore it.
When user revokes permissions through settings app process gets killed without any callbacks to prevent unwanted behavior, for example:
onCreate
This includes killing all ongoing services as well. Regular Activity lifecycle doesn't apply in that case.