This component houses code to install and load Android dynamice feature modules. See the onboarding guide for how to create such a feature module in Chrome. Broadly, this component offers two APIs
The install engine is a wrapper around Play Core's split install API that performs extra setup such as SplitCompat, and collects metrics. You can install a module by name with the following code snippet:
InstallEngine installEngine = new EngineFactory().getEngine(); installEngine.install("foo", success -> { // Module installed successfully if |success| is true. });
You can use the install engine on its own but will have to take care of module setup such as loading native code and resources. To simplify that you can use the module builder API.
The module builder simplifies module set up by loading native code and resources on first module access and determines whether a module is installed. The module builder uses the install engine in the back. It primarily provides the following building blocks:
@ModuleInterface
to annotate the entry point of your module. Using this with the module_interface_processor
will create a module class such as FooModule
that lets you install and load a module. See Module
for its interface.
Module
needs to be able to retrieve a ModuleDescriptor
implementation for each module via reflection. You can create such an implementation with the module_desc_java
template.