Created
January 2, 2021 04:30
-
-
Save gb103/d72751036eb79c8d7dce7fa13a115557 to your computer and use it in GitHub Desktop.
Access installed module
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
// Generate a new context as soon as a request for a new module | |
// reports as INSTALLED. | |
override fun onStateUpdate(state: SplitInstallSessionState ) { | |
if (state.sessionId() == mySessionId) { | |
when (state.status()) { | |
... | |
SplitInstallSessionStatus.INSTALLED -> { | |
val newContext = context.createPackageContext(context.packageName, 0) | |
// If you use AssetManager to access your app’s raw asset files, you’ll need | |
// to generate a new AssetManager instance from the updated context. | |
val am = newContext.assets | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment