ModuleInstallClient

public interface ModuleInstallClient extends HasApiKey


Interface for module install APIs.

Summary

Public methods

abstract Task<ModuleAvailabilityResponse>
areModulesAvailable(OptionalModuleApi[] apis)

Checks if the optional modules required by the OptionalModuleApi are already present on device.

abstract Task<Void>
deferredInstall(OptionalModuleApi[] apis)

Defers installation of optional modules required by the OptionalModuleApi.

abstract Task<ModuleInstallIntentResponse>
getInstallModulesIntent(OptionalModuleApi[] apis)

Gets the ModuleInstallIntentResponse that includes a android.app.PendingIntent to initiate the optional module download and installation flow.

abstract Task<ModuleInstallResponse>

Triggers an immediate installation request from a ModuleInstallRequest.

abstract Task<Void>
releaseModules(OptionalModuleApi[] apis)

Initiates a request to release optional modules required by OptionalModuleApi when they are no longer needed.

abstract Task<Boolean>

Unregisters a listener you previously set in ModuleInstallRequest.

Public methods

areModulesAvailable

abstract Task<ModuleAvailabilityResponseareModulesAvailable(OptionalModuleApi[] apis)

Checks if the optional modules required by the OptionalModuleApi are already present on device.

This method is intended to be used in cases where you don't want to unconditionally trigger an immediate installation if the modules aren't available already. If you need to trigger an immediate installation, use installModules instead.

Parameters
OptionalModuleApi[] apis

the OptionalModuleApis that require optional modules.

Returns
Task<ModuleAvailabilityResponse>

a Task with value ModuleAvailabilityResponse indicating whether the requested modules are already present.

deferredInstall

abstract Task<VoiddeferredInstall(OptionalModuleApi[] apis)

Defers installation of optional modules required by the OptionalModuleApi. When called, Google Play services will optimize the best time to install those modules in the background.

If your app requires immediate access to those modules, use installModules to install the optional modules right away.

Parameters
OptionalModuleApi[] apis

the OptionalModuleApis that require optional modules.

Returns
Task<Void>

a successful Task if the deferred install request is received.

getInstallModulesIntent

abstract Task<ModuleInstallIntentResponsegetInstallModulesIntent(OptionalModuleApi[] apis)

Gets the ModuleInstallIntentResponse that includes a android.app.PendingIntent to initiate the optional module download and installation flow.

Parameters
OptionalModuleApi[] apis

the OptionalModuleApis that require optional modules.

Returns
Task<ModuleInstallIntentResponse>

a Task with value ModuleInstallIntentResponse which includes the that can be used to launch the UI flow. A null indicates that the optional modules are already present on device.

installModules

abstract Task<ModuleInstallResponseinstallModules(ModuleInstallRequest request)

Triggers an immediate installation request from a ModuleInstallRequest.

The Task completes once the ModuleInstallRequest has been initiated. This method does not wait for installation to complete. To monitor the install/download progress of the request, set a InstallStatusListener when building the ModuleInstallRequest to receive ModuleInstallStatusUpdate, and make sure to unregisterListener once the installation completes. The listener is only registered if the modules requested are not already installed.

The ModuleInstallResponse indicates whether the modules are already installed and contains an integer session id that is corresponding to a unique install request. A session id of 0 and/or areModulesAlreadyInstalled returned true indicate that the optional modules are already installed. You don't need to interact with session id unless the same InstallStatusListener object is used in multiple s.

Parameters
ModuleInstallRequest request

the ModuleInstallRequest you build for the install request.

Returns
Task<ModuleInstallResponse>

a Task with value ModuleInstallResponse if the install request is received.

releaseModules

abstract Task<VoidreleaseModules(OptionalModuleApi[] apis)

Initiates a request to release optional modules required by OptionalModuleApi when they are no longer needed.

This method notifies Google Play services that the optional modules are no longer needed for this app, but it does not guarantee the optional modules can be removed. Google Play services will try to clean up the optional modules when they are not used by any apps.

If this method is called when an install request with all the specified modules is pending, this method will do the best-effort to cancel that install request. You can monitor the through InstallStatusListener to listen for the STATE_CANCELED state when the install request is canceled.

Parameters
OptionalModuleApi[] apis

the OptionalModuleApis that require optional modules.

Returns
Task<Void>

a successful Task if the release modules request is received.

unregisterListener

abstract Task<BooleanunregisterListener(InstallStatusListener listener)

Unregisters a listener you previously set in ModuleInstallRequest.

Parameters
InstallStatusListener listener

the same InstallStatusListener that is set in the .

Returns
Task<Boolean>

true if the given listener was found and unregistered, false otherwise.