Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Dynamic Feature Modules (DFMs)

Avatar for ken_kentan ken_kentan
February 18, 2020

Dynamic Feature Modules (DFMs)

Avatar for ken_kentan

ken_kentan

February 18, 2020
Tweet

Other Decks in Programming

Transcript

  1. Dynamic Delivery Google Play’s app serving model. • Generate and

    serve optimized APKs for each user’s device configuration. • Can reduce download APK size.
  2. Split APK mechanism of Dynamic Delivery • Base APK ◦

    All other split APKs can access this. • Configuration APKs ◦ Includes native libraries and resources for a specific screen etc.. ◦ Automatically generate by Google Play. • Dynamic feature APKs ◦ Modularized feature.
  3. Split APK mechanism of Dynamic Delivery • Base APK ◦

    All other split APKs can access this. • Configuration APKs ◦ Includes native libraries and resources for a specific screen etc.. ◦ Automatically generate by Google Play • Dynamic feature APKs ← Dynamic Feature Modules ◦ Modularized feature.
  4. Pros • Develop in parallel ◦ Can take ownership of

    each module. (e.g. Fewer merge conflicts to other teams.) • Improve build times⏱ ◦ Gradle are able to build multiple modules in parallel and reduce build times. • Customize feature delivery ◦ Can use Dynamic Delivery such as at install, on demand, conditional and instant delivery. https://developer.android.com/guide/app-bundle/dynamic-delivery
  5. Cons • Reverse dependencies ◦ Main module (e.g. app) can

    not reference to DFMs directly. • Difficult to migrate from Android Library Module ◦ Require to reverse module dependency direction if needed. • Limited reference ◦ A DFM can not reference to another DFMs. ◦ Resolved in Android Gradle plugin 4.0.0. ▪ https://developer.android.com/studio/preview/features#feature-on-feature https://developer.android.com/guide/app-bundle/dynamic-delivery
  6. AndroidManifest.xml • dist:instant ◦ Google Play Instant option • dist:title

    ◦ User-facing module title • dist:delivery ◦ Select delivery option (at-install or on-demand) • dist:fusing ◦ Include this module if Android 4.4 and lower.
  7. On-demand Download and install packages using Play Core Library via

    internet. • Immediate ◦ Install immediately. • Deferred ◦ Add install request to a queue. ◦ Will be executed in up to a maximum of 24 hours. Send request Download Check https://developer.android.com/guide/app-bundle/on-demand-delivery
  8. Conditional Download automatically during app install if meeted all the

    requirements. (Can also be installed on-demand) • Available requirements ◦ Device hardware and software features (Constants of PackageManager.FEATURE_*) ◦ User country ◦ API level https://developer.android.com/guide/app-bundle/conditional-delivery
  9. Instant Users can interact app without needing to install APK(s).

    • The combined size must be at most 10 MB. • Can not use background service. https://developer.android.com/guide/app-bundle/instant-delivery
  10. Summary • Dynamic Feature Module is modularize method for Dynamic

    Delivery. • Dynamic Delivery is app serving model. • Dynamic Delivery has 4 delivery option. ◦ At-install, on-demand, conditional and instant. • DFM will improve build times⏱. • Main module can not reference DFMs directly. ◦ E.g. pass class name as string.