Open dbemke opened 7 months ago
Something similar is happening on Pixel 3a, Android 12 but only after Fresh Install
Steps to reproduce
Expected behavior The Recover dialog should be shown
Other information: It is happening on Android 12 only after Fresh install and only at the first attempt! If you'll repeat steps 1-5 then the savepoint will be created and the recovery dialog will appear
I've done some testing and it looks like this is a problem on Android 12+. It seems like it's a change in Android's "Recent Apps" (that I can't find referenced anywhere). I'll update the issue description with my findings.
We should discuss if we want to fix this as-is or change the feature so save points are created differently (i.e. on a timer on questions are answered).
ODK Collect version
the store version 2024.1.3, the master version 2a06bf580b90d75d9e7089a1066ac469eb1f1589
Android version
12+
Device used
Pixel 7a
Problem description
On Android 12+ a savepoint isn’t created if Collect is closed via going to "Latest apps” (with navigation using 3 buttons, click the square) and swiping Collect up.
The issue doesn't occur on Android 10 (Redmi 9t), other devices will be described below Pixel 7a Android 14 example: https://github.com/getodk/collect/assets/56479916/4fd5f669-2605-464b-a4b9-eed51b4a4c0f
Steps to reproduce the problem
A save point will be created if the user switches to another app using "Latest apps" (or hits the home button). This means that in reality, users will usually get save points when switching away from Collect.
Expected behavior
Depending on the version of Collect there should be:
Notes
It looks like Android 12 changes how "Recent apps" interacts with
Activity#onSaveInstanceState
which we use to trigger a save point. In Android 11 and under, opening recent apps is enough to causeonSaveInstanceState
to be called, but in later Android versions the method isn't called until another app is switched to (or the user returns to the Home Screen). We'll need to find another way to trigger a save point so that it works across API versions.