Created
January 2, 2021 03:43
-
-
Save gb103/d9189615244446d2d5c8331c3f86770d to your computer and use it in GitHub Desktop.
Activity code for having feature download code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Creates an instance of SplitInstallManager. | |
val splitInstallManager = SplitInstallManagerFactory.create(context) | |
// Creates a request to install a module. | |
val request = | |
SplitInstallRequest | |
.newBuilder() | |
// You can download multiple on demand modules per | |
// request by invoking the following method for each | |
// module you want to install. | |
.addModule("pictureMessages") | |
.addModule("promotionalFilters") | |
.build() | |
splitInstallManager | |
// Submits the request to install the module through the | |
// asynchronous startInstall() task. Your app needs to be | |
// in the foreground to submit the request. | |
.startInstall(request) | |
// You should also be able to gracefully handle | |
// request state changes and errors. To learn more, go to | |
// the section about how to Monitor the request state. | |
.addOnSuccessListener { sessionId -> ... } | |
.addOnFailureListener { exception -> ... } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment