Dynamic Feature Modules (DFMs)

Android development most powerful tool for allowing you to modularize your app by breaking it into smaller, more manageable parts that can be downloaded and installed on-demand, reducing the initial app size and improving app delivery.

There are two modes or delivery options for (DFMs):

    1. Install-time delivery: In this mode, dynamic feature modules are installed at the same time as the base app. This is suitable for modules that are essential for the app’s core functionality or modules that should always be available.
    2. On-demand delivery: Here, dynamic feature modules are not installed with the base app but are downloaded and installed when needed, based on certain conditions (e.g., user interaction, specific feature usage, or conditions set by the developer). This mode helps reduce the initial download size of the app and allows users to access additional features only when they require them.

Using dynamic feature modules requires integrating the Play Core Library and using the Dynamic Delivery features provided by Google Play. This enables the distribution, installation, and management of these modules as part of your mobile app development.

Advantage:

When a user uninstalls a dynamic feature module, the corresponding data associated with that module is removed from the device. Consequently, this action results in a reduction of the app’s total size on the user’s device.

For example, let’s say you have an app with the base module and several dynamic feature modules that users can download on demand. When a user installs one or more of these modules and later decides to uninstall one of them, the data and resources related to that particular module are deleted from the device. This deletion leads to a decrease in the app’s overall size on the user’s device, as the space occupied by the uninstalled module is freed up.

Remember, the exact reduction in size upon uninstallation depends on the size of the dynamic feature module that is uninstalled and the resources it utilized within the app.

Problem Statement:

Imagine an app originally sized at 50 MB, containing a total of 100 features. Recognizing that users typically need only a small portion immediately, let’s say around 10%, the app focuses on the crucial 10 features, totaling roughly 15 MB, for the initial download. The remaining 90 features, occupying approximately 20 MB, are set aside for download on demand. This approach condenses the initial app download to 15 MB, granting users immediate access to essential functionalities while providing additional features for later download, ensuring a lighter and more tailored initial user experience.

For Example:

  • Imagine a social media app as the primary experience, occupying the app module with a size of 15 MB. However, for users who occasionally require photo editing capabilities, a separate dynamic feature module for photo editing is developed, sized at 8 MB.
  • The core functionality of the social media platform is encapsulated within the initial 15 MB installation. For users looking to enhance their photos or apply filters, they can access the additional 8 MB dynamic feature module for photo editing. This modular approach enables users to enjoy the social media experience upfront while seamlessly accessing photo editing features only when desired, optimizing both app functionality and download size

dynamic features

How to implement?

Create a new project under the with package name “com.social.media.app”, now live on the Play Store. With developer access via the Google Play Console, the package id is crucial for testing dynamic. To proceed, ensure access to the Play Store for the specified Application ID is available for either uploading the .aab file or utilizing Google Play Internal App Sharing[https://play.google.com/console/internal-app-sharing/].”

Note: The package name for the dynamic feature module should follow the structure like com.social.media.app.photo_filter, with the first part being the base module package followed by the dynamic feature module package name

build.gradle.kts (app module)
dependencies {
// other dependencies

implementation(“com.google.android.play:feature-delivery:2.0.0”)
implementation(“com.google.android.play:feature-delivery-ktx:2.0.0”)
}

gradle.properties:
android.useAndroidX=true
android.enableJetifier=true

How to create and implement in project?

Create a new module like below:

Path – > File- > New Module – > Select List to -> Dynamic Feature

Step 1

dynamic module

Step  2

 

dynamic features setup2

In the provided configuration, I’ve opted for ‘Do not include module at Install-time (on-demand only)’ to ensure the dynamic module installs exclusively on demand. Consequently, my project structure, post the creation of the translation dynamic module, appears as follows:

Step 3
dynamic feature module

How to test it?

Upload your .aab file to Google Play Internal App Sharing[https://play.google.com/console/internal-app-sharing/] and use the URL to install the app from the Play Store.

And tester from your console account and share with this app a copy of the link After uploading the app, make sure Play Store console account login

Step 4

dfm for app development

In the app development process Dynamic Feature Module helps minimise app size and make the application development process fast, reducing coding errors. with effect on application performance. As an enterprise app development company, we make every aspect of the mobile app development process seamless.

how can we help you?

Contact us at the Consulting WP office nearest to you or submit a business inquiry online.