The Android Developer Challenge is back! Submit your idea before December 2.

FakeSplitInstallManager

public class FakeSplitInstallManager
extends Object implements SplitInstallManager

java.lang.Object
   ↳ com.google.android.play.core.splitinstall.testing.FakeSplitInstallManager


A fake implementation of the SplitInstallManager. See SplitInstallManagerFactory.

Summary

Constants

String TAG

Public methods

Task<Void> cancelInstall(int sessionId)

Starts a request to cancel a pending split install.

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

The next functions are not implemented!

Task<Void> deferredLanguageInstall(List<Locale> languages)

The next functions are not implemented!

Task<Void> deferredLanguageUninstall(List<Locale> languages)

The next functions are not implemented!

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

The next functions are not implemented!

Set<String> getInstalledLanguages()

Returns the languages that are currently installed.

Set<String> getInstalledModules()

Returns the modules that are currently installed (excluding the base module).

Task<SplitInstallSessionState> getSessionState(int sessionId)

Returns the current state of a split install session.

Task<List<SplitInstallSessionState>> getSessionStates()

This fake implementation just support one session state.

void registerListener(SplitInstallStateUpdatedListener listener)

Registers a listener for your app that is alerted of state changes for module install requests.

void setShouldNetworkError(boolean shouldNetworkError)

Sets whether the next split install should terminate in a network error.

boolean startConfirmationDialogForResult(SplitInstallSessionState sessionState, Activity activity, int requestCode)

The next functions are not implemented!

Task<Integer> startInstall(SplitInstallRequest request)

Initiates a request to download and install split APKs for additional features or language resources.

void unregisterListener(SplitInstallStateUpdatedListener listener)

Unregisters a listener you previously registered using registerListener(SplitInstallStateUpdatedListener).

Inherited methods

From class java.lang.Object
From interface com.google.android.play.core.splitinstall.SplitInstallManager

Constants

TAG

String TAG

Constant Value: "FakeSplitInstallManager"

Public methods

cancelInstall

Task<Void> cancelInstall (int sessionId)

Starts a request to cancel a pending split install.

Cancelling requests are best-effort. You can monitor the request state to listening for the CANCELED state.

Parameters
sessionId int: the sessionId of the request you would like to cancel.

Returns
Task<Void>

deferredInstall

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

The next functions are not implemented!

Parameters
moduleNames List: the names of the modules you want to install in the background.

Returns
Task<Void>

deferredLanguageInstall

Task<Void> deferredLanguageInstall (List<Locale> languages)

The next functions are not implemented!

Parameters
languages List: the languages you want to install in the background.

Returns
Task<Void>

deferredLanguageUninstall

Task<Void> deferredLanguageUninstall (List<Locale> languages)

The next functions are not implemented!

Parameters
languages List: the languages you want to uninstall in the background.

Returns
Task<Void>

deferredUninstall

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

The next functions are not implemented!

Parameters
moduleNames List: the names of the modules you want to uninstall in the background.

Returns
Task<Void>

getInstalledLanguages

Set<String> getInstalledLanguages ()

Returns the languages that are currently installed.

The app's default language is not included in the returned set.

Returns an empty set if an error occurs.

For Instant Apps, this API is not supported and the return value is undefined.

Note: Languages are considered installed even when they are emulated by ERROR(/SplitCompat) because they are accessible to the app.

Returns
Set<String> the languages that are currently installed.

getInstalledModules

Set<String> getInstalledModules ()

Returns the modules that are currently installed (excluding the base module).

To learn more, read Manage installed modules.

Note: Modules are considered installed even when they are emulated by ERROR(/SplitCompat) because they are accessible to 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. Instead, please use getInstalledModules().

To learn more, read Monitor the request state.

Parameters
sessionId int: the Id for the session you want to status for.

Returns
Task<SplitInstallSessionState>

getSessionStates

Task<List<SplitInstallSessionState>> getSessionStates ()

This fake implementation just support one session state.

Returns
Task<List<SplitInstallSessionState>>

registerListener

void registerListener (SplitInstallStateUpdatedListener listener)

Registers a listener for your app that is alerted of state changes for module install requests.

You should unregister the listener using unregisterListener(SplitInstallStateUpdatedListener) when the request is resolved. To learn more, read Monitor the request state.

Parameters
listener SplitInstallStateUpdatedListener: the SplitInstallStateUpdatedListener you want to register for your app.

setShouldNetworkError

void setShouldNetworkError (boolean shouldNetworkError)

Sets whether the next split install should terminate in a network error.

Parameters
shouldNetworkError boolean

startConfirmationDialogForResult

boolean startConfirmationDialogForResult (SplitInstallSessionState sessionState, 
                Activity activity, 
                int requestCode)

The next functions are not implemented!

Parameters
sessionState SplitInstallSessionState: a SplitInstallSessionState with status REQUIRES_USER_CONFIRMATION

activity Activity: the Activity that will be used for ERROR(/Activity#onActivityResult)

requestCode int: the request code that will be used for ERROR(/Activity#onActivityResult)

Returns
boolean whether the session state is a valid and the dialog has been started

Throws
IntentSender.SendIntentException

startInstall

Task<Integer> startInstall (SplitInstallRequest request)

Initiates a request to download and install split APKs for additional features or language resources.

To learn more, read Request an on demand module or Download additional language resources.

Parameters
request SplitInstallRequest: the SplitInstallRequest you built for the install request.

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 you previously registered using registerListener(SplitInstallStateUpdatedListener).

Parameters
listener SplitInstallStateUpdatedListener