How to download dynamic feature modules

Learn how to show a custom loading screen while downloading the modules

Siva Ganesh Kantamani
Level Up Coding
Published in
3 min readJun 8, 2020

--

Screenshot from Google IO 2018

Take away from the article

The easiest way to download a dynamic feature module is through Dynamic Navigator; it’s simple and effective. But there is one problem — you can’t show custom loading because it’s under navigation component control.

There is another way to download dynamic feature modules — using SplitInstallManager listener. Through this listener, we can show our custom loading while downloading.

Introduction

SplitInstallStateUpdatedListener is used to download the on-demand module; the plus side of using this listener is that we can get callbacks on state changes like when it started the download, after completion of the download, or in some cases when the download failed.

Now, let’s see some of the callback states from SplitInstallStateUpdatedListener that play a crucial role, such as:

  • DOWNLOADING - On-demand module is currently downloading.
  • REQUIRES_USER_CONFIRMATION - This may occur when trying to download a significantly large module.
  • INSTALLED - The requested on-demand module has been installed.

--

--