
The user interface will also include a TextView object to display status information relating to the dynamic feature module. To demonstrate the use of dynamic features, the base activity will consist of a series of buttons which will allow the dynamic feature module to be installed, launched and removed. This base module will be responsible for requesting, installing and managing the dynamic feature module. By far the easiest way to achieve this is to declare the application as subclassing SplitCompatApplication in the main AndroidManifest.xml file (also referred to as the base module manifest) as follows: the Base Activity User InterfaceĪt this point, the project consists of a single activity which will serve as the entry point for the base module of the app. Fortunately, this shortcoming can be avoided by enabling the SplitCompat Library within the project. By default, however, newly installed feature modules are not available to the rest of the app until the app is restarted.

Once a dynamic feature module has been downloaded, it is most likely that immediate access to code and resource assets that comprise the feature will be required by the user. Within Android Studio, open the app level adle file ( Gradle Scripts -> adle (Module: app)), locate the dependencies section and add the Play Core Library as follows. Since the project will be making extensive use of the Play Core Library, a directive needs to be added to the build configuration to include this library. Report this ad Adding Dynamic Feature Support to the Projectīefore embarking on the implementation of the app, two changes need to be made to the project to add support for dynamic features. The chapter will also explore the use of deferred dynamic feature installation. This tutorial will include steps to create a dynamic module from within Android Studio, upload the app bundle to the Google Play Store for testing, and use the Play Core Library to download and manage dynamic features. The app created in this chapter will consist of two activities, the first of which will serve as the base module for the app while the second will be designated as a dynamic feature to be downloaded on demand from within the running app. With the basic concepts of Android Dynamic Delivery and Dynamic Features covered in the previous chapter, this chapter will put this theory into practice in the form of an example project.


Purchase the fully updated Android Studio Electric Eel Kotlin Edition of this publication in eBook ($29.99) formatĪndroid Studio Electric Eel Essentials - Kotlin Edition eBook (PDF/ePub, Kindle) edition contains 93 chapters and over 820 pages

You are reading a sample chapter from the Android Studio 4.2 Development Essentials - Kotlin Edition book.
