SplitCompat
public
class
SplitCompat
extends Object
java.lang.Object | |
↳ | com.google.android.play.core.splitcompat.SplitCompat |
Enables immediate access to code and resources of split APKs installed through SplitInstallManager
.
To learn more, read Immediately access modules.
Summary
Public methods | |
---|---|
static
boolean
|
install(Context context)
Emulates installation of split APKs to allow immediate access to their code and resources. |
static
boolean
|
installActivity(Context context)
Emulates installation of a split APK to allow immediate access to a given activity. |
Inherited methods | |
---|---|
Public methods
install
public static boolean install (Context context)
Emulates installation of split APKs to allow immediate access to their code and resources.
To use this method, you must invoke it at app startup with the app context (see SplitCompatApplication
). If you call this method, you should also call installActivity(Context)
on any activities inside the dynamic feature module you've installed.
To learn more, read Invoke SplitCompat at runtime. Additionally, to learn how to gain immediate access to language resources your app has downloaded, read Access downloaded language resources.
Parameters | |
---|---|
context |
Context |
Returns | |
---|---|
boolean |
whether the split install was successful. This method returns false on platform
versions lower than Android 5.0 (API level 21), which do not support split APKs.
|
installActivity
public static boolean installActivity (Context context)
Emulates installation of a split APK to allow immediate access to a given activity.
To use this API, use the following pattern:
protected void attachBaseContext(Context base) { super.attachBaseContext(base); SplitCompat.installActivity(this); }
To use this API, you also need to first call install(Context)
with the application context
at app startup.
Parameters | |
---|---|
context |
Context |
Returns | |
---|---|
boolean |
whether split install was successful. This method returns false on platform
versions lower than Android 5.0 (API level 21), which do not support split APKs. |
Throws | |
---|---|
IllegalStateException |
if SplitCompat was not called at startup on application context |