boolder-org / boolder-android

Boolder Android app https://www.boolder.com/en/app
MIT License
23 stars 12 forks source link

Restore map location when process is recreated #130

Closed wang-li closed 1 month ago

wang-li commented 1 month ago

When the app was put in background and the system killed its process to free up some resources, bringing the app in foreground was triggering a process recreation, leading to the loss of the current position on the map.

https://github.com/boolder-org/boolder-android/assets/8343416/b5bb48fc-4489-437a-9c5f-59c70d0fcac2

Saving the state of the camera fixes the issue:

https://github.com/boolder-org/boolder-android/assets/8343416/772afac5-9cee-4691-aebf-8f91352f63a3

nmondollot commented 1 month ago

🤩

nmondollot commented 1 month ago

How long does this behavior last?

I think we should differentiate 2 cases:

  1. the user goes back to the app during the same "climbing session"
  2. the user goes back to the app after a few days

In the second case we should launch the app on the default viewport.

Question is, how should we define a "climbing session" 🤔

wang-li commented 1 month ago

How long does this behavior last?

As long as the app is kept in the recent apps stack.

I think we should differentiate 2 cases: the user goes back to the app during the same "climbing session" the user goes back to the app after a few days

Not sure this is really a big issue if the user is still at the last visited spot if he/she comes back a few days later. If the app is removed from the recent apps stack or killed by the user in the meantime, it will show the default viewport.

I feel like implementing a kind of "climbing session" in the apps is adding a bit of unnecessary complexity, especially as the state restoration mechanism is just tied to the system which chooses which resources to release, and which apps are not being used for a long enough period so that they can be removed from the recent apps stack.

nmondollot commented 1 month ago

If the app is removed from the recent apps stack or killed by the user in the meantime, it will show the default viewport.

Ok, that sounds like a good behavior!

I feel like implementing a kind of "climbing session" in the apps is adding a bit of unnecessary complexity,

I agree.

I'll try do do the same on iOS!