How can I detect if a device has 'do not keep activities' set in developer options. I can't find this value in the settings-class.
I need this setting to know, because when 'do not keep activities' is activated my app gets problem with it. Example : I have a main-activity and a sub-activity. when I switch from main to sub and back from sub to main, then the main-activity will be started again. This is because the mainactivity was killed before. besause I do a lot of loading in my main-activity, the app is not usable when starting over and over.
Or is there any method to solve this problem ? Without this setting activated, there is no problem.
regards
Yes.
In API Doc, it is called Settings.System.ALWAYS_FINISH_ACTIVITIES:
If 1, the activity manager will aggressively finish activities and processes as soon as they are no longer needed. If 0, the normal extended lifetime is used.
Constant Value: "always_finish_activities"
To get the value in code:
int value = Settings.System.getInt(getContentResolver(), Settings.System.ALWAYS_FINISH_ACTIVITIES, 0);
Check out the source code to see how Settings.apk did this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With