SplitInstallManager

public interface SplitInstallManager

com.google.android.play.core.splitinstall.SplitInstallManager


Manages sessions for installing dynamic splits.

Summary

Public methods

abstract Task<Void> cancelInstall(int sessionId)

Starts a request to cancel a pending split install.

abstract Task<Void> deferredInstall(List<String> moduleNames)

Defers installation of given moduleNames.

abstract Task<Void> deferredUninstall(List<String> moduleNames)

Defers uninstallation of given moduleNames.

abstract Set<String> getInstalledModules()

Returns which modules are installed (excluding the base module).

abstract Task<SplitInstallSessionState> getSessionState(int sessionId)

Returns the current state of a split install session.

abstract Task<List<SplitInstallSessionState>> getSessionStates()

Returns the state for all active sessions belonging to the app.

abstract void registerListener(SplitInstallStateUpdatedListener listener)

Registers a listener that will be alerted of state changes for install sessions for this app.

abstract Task<Integer> startInstall(SplitInstallRequest request)

Initiates a split install request.

abstract void unregisterListener(SplitInstallStateUpdatedListener listener)

Unregisters a listener previously added using registerListener(SplitInstallStateUpdatedListener).

Public methods

cancelInstall

Task<Void> cancelInstall (int sessionId)

Starts a request to cancel a pending split install.

Cancellation requests are best-effort, and success may be observed by listening to status changes for eventual CANCELED state.

Parameters
sessionId int

Returns
Task<Void>

deferredInstall

Task<Void> deferredInstall (List<String> moduleNames)

Defers installation of given moduleNames. Once called, the Play Store will try to eventually install those modules in the background.

Parameters
moduleNames List

Returns
Task<Void>

deferredUninstall

Task<Void> deferredUninstall (List<String> moduleNames)

Defers uninstallation of given moduleNames. Once called, the Play Store may uninstall these modules from the app.

Parameters
moduleNames List

Returns
Task<Void>

getInstalledModules

Set<String> getInstalledModules ()

Returns which modules are installed (excluding the base module).

Note: modules are considered installed even when they are just emulated by SplitCompat, since they are equally accessible by the app.

Returns
Set<String>

getSessionState

Task<SplitInstallSessionState> getSessionState (int sessionId)

Returns the current state of a split install session.

You should not use the session state to determine whether a module is installed. For that, please use getInstalledModules().

To learn more, read Monitor the request state.

Parameters
sessionId int

Returns
Task<SplitInstallSessionState>

getSessionStates

Task<List<SplitInstallSessionState>> getSessionStates ()

Returns the state for all active sessions belonging to the app.

You should not use the session state to determine whether a module is installed. For that, please use getInstalledModules().

To learn more, read Monitor the request state.

Returns
Task<List<SplitInstallSessionState>>

registerListener

void registerListener (SplitInstallStateUpdatedListener listener)

Registers a listener that will be alerted of state changes for install sessions for this app. Listeners should be subsequently unregistered using unregisterListener(SplitInstallStateUpdatedListener).

Parameters
listener SplitInstallStateUpdatedListener

startInstall

Task<Integer> startInstall (SplitInstallRequest request)

Initiates a split install request.

Parameters
request SplitInstallRequest

Returns
Task<Integer> session id, which can be used to subsequently interact with the session after it is created. A session id of 0 indicates that the splits are already installed; in this case no session is generated.

unregisterListener

void unregisterListener (SplitInstallStateUpdatedListener listener)

Unregisters a listener previously added using registerListener(SplitInstallStateUpdatedListener).

Parameters
listener SplitInstallStateUpdatedListener