How long to keep the UI state of an app, when app is in background? (Android)
I'm designing an Android app that lets people observe medical data. Besides seeing live data, users can scroll back to inspect earlier data.
I'm trying to decide if, when a user scrolls back to see older data, then puts the app to the background, and again to the foreground, the app should keep the scrolled-back state or show the latest data.
There are two conflicting goals: One, the UI should keep the state the user left it in, so that they can resume their tasks even after, say, taking a phone call. Two, the most recent data (live data) is quickly visible upon reopening the app.
I see 3 options:
Whenever the app regains focus, scroll to the latest (live) data. Disadvantage: When a user looks at past data, takes a call and comes back to the app, the UI state has changed and he has to navigate to the previous state again.
Always keep the scrolled state, even after days of not opening the app. Disadvantage: The scrolled state is probably not interesting to the user after a while.
Define a time limit after which the app will forget the scrolled state and, when it regains focus, shows the latest data. A reasonable time limit would be 30 or 60 minutes I think.
Let the Android app lifecycle handle it. Basically, when Android decides to kill the app process, forget about scroll state. My problem here is that I don't know how fast this usually happens, and it might vary depending on the phone performance.
Comparable problems I considered:
In messaging apps like WhatsApp, when in a conversation, putting the app in the background and again to the foreground, the conversation is still open (not the overview over all conversation).
In Google Calendar, when scrolling back to an earlier date, putting the app to the background and again to the foreground, the calendar is still scrolled back.
In both cases the app maker decided to keep the state, but I don't know for how long.
What's the best option? Do you know more about how Android's app lifecycle plays into this?