android / codelab-android-dynamic-features

Apache License 2.0
121 stars 47 forks source link

When trying to load a dynamic feature without internet, app gets "stucked" #1

Closed ruimendesM closed 5 years ago

ruimendesM commented 5 years ago

Steps to reproduce

  1. Do a fresh install from the Play Store.
  2. Open the app
  3. Remove internet connection from the device
  4. Click on "Show Assets" (device still does not have the module installed)

Result User will get stuck on "Starting install for assets". There is no actual feedback on the listener: SplitInstallStateUpdatedListener

Expectation SplitInstallStateUpdatedListener should have a state for this maybe? It could put as a pending installation, and then when internet was back it would proceed with the installation. It might be good to have some kind of timeout for this is as well.

Note If you add addOnFailureListener to startInstall method on the function loadAndLaunchModule, that listener will get triggered with an error.

pfmaggi commented 5 years ago

Thanks for reporting this.

This codelab/sample is intended to showcase how the API works, trying to ignore the "real world", like the fact that on a mobile device you may happen to not have connectivity (or that you may want to ask the user a confirmation before starting the download if they are using a metered network).

For this reason we don't plan to add this logic to this small sample.

You can find a more comprehensive sample on how to handle this situation in https://github.com/google/santa-tracker-android

More informations are available on this blog that describe how this particular topic has been handled in Santa Tracker.