Skip to content

Instantly share code, notes, and snippets.

@gb103
Created January 2, 2021 03:43
Show Gist options
  • Save gb103/d9189615244446d2d5c8331c3f86770d to your computer and use it in GitHub Desktop.
Save gb103/d9189615244446d2d5c8331c3f86770d to your computer and use it in GitHub Desktop.
Activity code for having feature download code
// 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