With Google Play’s Dynamic Delivery, your app can download dynamic feature modules on demand to devices running Android 5.0 (API level 21) and higher. This helps reducing initial apk size that user need to down first time.
It has been observed that not all user uses all features of an mobile application. Hence this make sense that only the bare minimum functional feature to be present in initial apk which can be described as core funcitionality of your application.
Note : For every 6 MB increase to an apk size, it has been observed that install rate deduces by 1 %.
Considering this, we should use dynamic feature delivery aproach to reduce initial apk size, and if need those features can be downloaded on demand.
Initially, the Google Play Store pushes only the code and resources needed for base module to the device, which is app module. For the rest of the modules, Your app simply needs to call APIs in the Play Core Library to download and install those modules as required, on demand for your Android Apps.
The benefit of split APKs is the ability to break up a monolithic APK—that is, an APK that includes code and resources for all features and device configurations your app supports—into smaller, discrete packages that are installed on a user’s device as required.
In an order to implement dyanmic feature delivery, you might need to update your application structure to extract out code of an existing feature.
If you are setting up a new project then, you can start right away.
Add below mentioned dependency in app/build.gradle file
Create a new dynamic feature module from menu. Let’s name it New_Feature.
This “New Feature” just like your “app module” containing activities, resources and other library in it’s build.gradle file. The only different is, it uses “dynamic feature as plugin” and has “app” as module dependency. Meaning it inherits everything from app module.
Before you try to open up any activity or try to call any utility function or code from New_Feature, you need download by executing below mentioned code from calling calling activity.
To launch any activity from New_Feature, need to pass full class name prefixed with package name like
// Launching Test activity of New Feature module from App module
As you can see, implementing dynamic feature for a new project is quiet easy and simple. You should try it out for your next project. Also If you want to try out for one of your existing projects, you can but there is an effort involved in decoupling of your features.
Read here to know more about Android Testing Strategy
Checkout To integrate Paytm Gateway Integration