目录

module_install.h

Overview

Declares the APIs provided by the on-demand distribution capability.

Included file: <AppGalleryKit/module_install.h>

Library: libhmsmoduleinstall.so

System capability: SystemCapability.AppGalleryService.Distribution.OnDemandInstall

Since: 5.0.3(15)

Related module: ModuleInstall

Summary

[h2]Types

Name Description
typedef struct ModuleInstall_InstalledModule ModuleInstall_InstalledModule Module information.
typedef struct ModuleInstall_FetchModulesResult ModuleInstall_FetchModulesResult Module installation result.
typedef struct ModuleInstall_StatusCallback ModuleInstall_StatusCallback Module installation status callback.
ModuleInstall_OnStatusCallback Listener callback.

[h2]Enumerations

Name Description

typedef enum ModuleInstall_ErrCode {

E_NO_ERROR = 0,

E_PARAMS = 401,

E_QUERY_MODULE = 1006500001,

E_REPEATED_CALL = 1006500002,

E_CONNECT_SA = 1006500004,

E_OFF_WITHOUT_ON = 1006500006,

E_CONNECT_SERVICE_EXTENSION = 1006500007,

E_WRITE_PARAM = 1006500008,

E_REQUEST_SERVER = 1006500009,

E_RESPONSE_INVALID = 1006500010,

E_INNER_ERROR = 1006500011,

E_INTERNAL_COMMUNICATION = 1006500012,

E_INVALID_TASK_ID = 1006500013

}

Enumerates error codes.

typedef enum ModuleInstall_InstallStatus {

INSTALLED = 0,

NOT_INSTALLED = 1

}

Enumerates installation statuses.

typedef enum ModuleInstall_RequestCode {

MODULE_ALREADY_EXISTS = -8,

MODULE_UNAVAILABLE = -7,

INVALID_REQUEST = -6,

NETWORK_ERROR = -5,

INVOKER_VERIFICATION_FAILED = -4,

FOREGROUND_REQUIRED = -3,

ACTIVE_SESSION_LIMIT_EXCEEDED = -2,

FAILURE = -1,

SUCCESS = 0,

DOWNLOAD_WAIT_WIFI = 1

}

Enumerates request codes.

typedef enum ModuleInstall_TaskStatus {

CREATE_TASK_FAILED = -4,

HIGHER_VERSION_INSTALLED = -3,

TASK_ALREADY_EXISTS = -2,

TASK_UNFOUND = -1,

TASK_CREATED = 0,

DOWNLOADING = 1,

DOWNLOAD_PAUSED = 2,

DOWNLOAD_WAITING = 3,

DOWNLOAD_SUCCESSFUL = 4,

DOWNLOAD_FAILED = 5,

DOWNLOAD_WAIT_FOR_WIFI = 6,

INSTALL_WAITING = 20,

INSTALLING = 21,

INSTALL_SUCCESSFUL = 22,

INSTALL_FAILED = 23

}

Enumerates task statuses.

[h2]Functions

Name Description
ModuleInstall_ErrCode HMS_ModuleInstall_GetInstalledModule(const char *moduleName, unsigned int length, ModuleInstall_InstalledModule **installedModule) Queries whether a module has been installed.
char *HMS_ModuleInstall_GetInstalledModuleName(const ModuleInstall_InstalledModule *installedModule) Obtains the module name.
int HMS_ModuleInstall_GetInstalledModuleType(const ModuleInstall_InstalledModule *installedModule) Obtains the module type.
ModuleInstall_InstallStatus HMS_ModuleInstall_GetModuleInstallStatus(const ModuleInstall_InstalledModule *installedModule) Obtains the module installation status.
ModuleInstall_ErrCode HMS_ModuleInstall_FetchModules(const char *bundleName, unsigned int length, char **moduleNames, unsigned int moduleNamesLength, ModuleInstall_FetchModulesResult **fetchModulesResult) Requests to download a module.
ModuleInstall_RequestCode HMS_ModuleInstall_GetFetchModulesRequestCode(const ModuleInstall_FetchModulesResult *fetchModulesResult) Obtains the module download request code.
ModuleInstall_TaskStatus HMS_ModuleInstall_GetFetchModulesTaskStatus( const ModuleInstall_FetchModulesResult *fetchModulesResult) Obtains the module download task status.
char *HMS_ModuleInstall_GetFetchModulesTaskId(const ModuleInstall_FetchModulesResult *fetchModulesResult) Obtains the module download task ID.
char *HMS_ModuleInstall_GetFetchModulesDesc(const ModuleInstall_FetchModulesResult *fetchModulesResult) Obtains the module download description.
char *HMS_ModuleInstall_GetFetchModules(const ModuleInstall_FetchModulesResult *fetchModulesResult) Obtains the name of the downloaded module.
int HMS_ModuleInstall_GetFetchModulesTotalSize(const ModuleInstall_FetchModulesResult *fetchModulesResult) Obtains the total size of the downloaded module.
int HMS_ModuleInstall_GetFetchModulesDownloadedSize(const ModuleInstall_FetchModulesResult *fetchModulesResult) Obtains the downloaded size of the module.
ModuleInstall_ErrCode HMS_ModuleInstall_CancelTask(const char *taskId, unsigned int length, unsigned int cancelResult) Cancels a download task.
ModuleInstall_ErrCode HMS_ModuleInstall_PauseTask(const char *taskId) Pauses a download task.
ModuleInstall_ErrCode HMS_ModuleInstall_ShowCellularDataConfirmation(const char *taskId, unsigned int length, unsigned int showResult) Displays a mobile data reminder pop-up.
ModuleInstall_StatusCallback *HMS_ModuleInstall_CreateStatusCallback(ModuleInstall_OnStatusCallback *onStatusCallback) Creates a callback for listening for the download progress.
ModuleInstall_ErrCode HMS_ModuleInstall_On(const char *bundleName, unsigned int length, unsigned int appIndex, unsigned int period, ModuleInstall_StatusCallback **callback) Listens for the download progress.
void HMS_ModuleInstall_ReleaseStatusCallback(ModuleInstall_StatusCallback *statusCallback) Releases the callback used for download progress listening.
ModuleInstall_ErrCode HMS_ModuleInstall_Off(const char *bundleName, unsigned int length, unsigned int appIndex) Cancels the download progress listener.