android-maps-compose icon indicating copy to clipboard operation
android-maps-compose copied to clipboard

Add ability to persist/cache map tiles and render state when map Composable goes out of scope

Open matejdro opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

When a screen with a map goes to the backstack, GoogleMap composable and all tiles/render state that it has, is destroyed. When user comes back to the map, it needs to reload all tiles and render everything from scratch, resulting in a bad user experience, since opening something over map and then going back will cause the map to spend a second or two reloading (especially on slower devices)

Describe the solution you'd like

Ability to provide a render state object to the map, where all render status would be saved/cached. That object can then be saved somewhere, where it would survive going to the backstack (for example, in a ViewModel). When user goes back to the map, that saved object would be provided to the map, resulting in a map instantly rendering to the exact state it was before.

Describe alternatives you've considered I don't see any good alternatives to that. One possible alternative is to not ever remove map Composable from the screen and show every subsequent screen as a dialog or an Activity, which is pretty limiting (and goes against single activity principle).

matejdro avatar Sep 11 '24 08:09 matejdro

I would love a solution to this issue as well, it's a big UX downgrade from good old Activity navigation, when all Views are immediately visible after navigating back. Especially for apps like car sharing, where the map is a root screen, and all other screen navigation happens over the map screen.

Here is a sample with Jetpack Navigation and Compose Google Map

https://github.com/user-attachments/assets/70dbe5a2-254d-4751-9304-c03efca8a435

alaershov avatar Oct 18 '24 06:10 alaershov

Related #155

geworfener avatar Oct 22 '24 09:10 geworfener

I think your link is broken.

Here is a working one: https://github.com/googlemaps/android-maps-compose/issues/155

matejdro avatar Oct 22 '24 09:10 matejdro