UsAaR33
UsAaR33

Reputation: 3686

Android evicting task history when background processes constrained to 1

Scenario:

My application does the following:

I expect that if I click back within that new activity, I'd be returned to my application. This happens under standard operation.

However, if I set "Background process limit" to "1 process", this stops working; hitting back just returns to the task launcher. Android makes no attempt to recreate the (destroyed) activities earlier in my task stack. (their onCreate method is never called)

I've tried placing android:alwaysRetainTaskState="true" in the root activity (and in every activity the user interacts with), but this seemingly incorrect behavior remains.

Is this intentional behavior in Android? Could a user in the real-world ever encounter my app behaving this way?

Upvotes: 0

Views: 128

Answers (1)

Jim
Jim

Reputation: 10278

Going to another application will start another process. If the background process limit is "1" then your application will be destroyed. Unless you are running services that are not in the foreground. Read this post:

https://android.stackexchange.com/questions/62387/are-there-any-downsides-or-risks-to-limiting-background-processes

So, yes a user could experience this. However, that user is likely to know that they limited the background process to something unusual and will likely change it to "fix" any behavior they do not want.

Upvotes: 1

Related Questions