Skip to content

Helper for dynamic feature modules installation of App bundle

License

Notifications You must be signed in to change notification settings

yangweigbh/ModuleInstaller

Repository files navigation

ModuleInstaller

Helper for dynamic feature modules installation of App bundle

Setup:

add it in your root build.gradle

allprojects {
    repositories {
        ...
        maven { url 'https://jitpack.io' }
    }
}

in your app build.gradle

dependencies {
        implementation 'com.github.yangweigbh:ModuleInstaller:0.1'
}

Usage:

in your Application class

public class MyApplication extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);

        ModuleInstaller.init(this);
    }
}

in your Activity clas that will use dynamic module:

@Override
protected void attachBaseContext(Context newBase) {
    super.attachBaseContext(newBase);

    ModuleInstaller.initActivity(this);
}

to install a dynamic module, usually when your app in foreground:

ModuleInstaller.install("test_module", new OnModuleInstallFinishedListener() {
        @Override
        public void onFinished(boolean success) {
            Log.d(TAG, "onFinished() called with: success = [" + success + "]");
        }
    });

to install a module when your app in background

ModuleInstaller.installDeferred("test_module");

to get all installed modules:

Set<String> installedModules = ModuleInstaller.getInstalledModules();

to uninstall modules:

ModuleInstaller.unInstallDeferred(Arrays.asList("test_module1", "test_module2"));

About

Helper for dynamic feature modules installation of App bundle

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages