IRemoteBrokerpublic interface IBundleInstaller extends IRemoteBroker
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
STATUS_INSTALL_FAILURE |
Indicates that the installation fails due to system or service exceptions.
|
static int |
STATUS_INSTALL_FAILURE_ABORTED |
Indicates that the installation is aborted because the user declined to grant permission or the installation
session is interrupted.
|
static int |
STATUS_INSTALL_FAILURE_CONFLICT |
Indicates that the installation fails due to an application conflict, for example, an application version with
a different signature has been installed.
|
static int |
STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED |
Indicates that the installation fails because the download fails.
|
static int |
STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT |
Indicates that the installation fails because the download is not completed in time.(30 seconds)
|
static int |
STATUS_INSTALL_FAILURE_INCOMPATIBLE |
Indicates that the installation fails due to incompatibility, for example, the in-use Ohos SDK version is not
the latest one required or the native code of the application binary interface (ABI) supported by the device is
unavailable.
|
static int |
STATUS_INSTALL_FAILURE_INVALID |
Indicates that the installation fails because the bundle format is incorrect, the bundle is damaged, or the
signature is incorrect.
|
static int |
STATUS_INSTALL_FAILURE_STORAGE |
Indicates that the installation fails due to storage reasons, for example, insufficient storage space or
unavailable storage media.
|
static int |
STATUS_UNINSTALL_FAILURE |
Indicates that the uninstallation fails due to system or service exceptions.
|
static int |
STATUS_UNINSTALL_FAILURE_ABORTED |
Indicates that the uninstallation is aborted.
|
static int |
STATUS_UNINSTALL_FAILURE_BLOCKED |
Indicates that the uninstallation fails because the bundle does not exist, the uninstallation is not allowed
by the device, or the user does not have the permission to uninstall the application.
|
static int |
STATUS_UNINSTALL_FAILURE_CONFLICT |
Indicates that the uninstallation fails because the application has a shared library and cannot be uninstalled.
|
static int |
SUCCESS |
Indicates that the application is successfully installed or uninstalled.
|
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
boolean |
install(List<String> bundleFilePaths,
InstallParam installParam,
InstallerCallback callback) |
Installs an application.
|
boolean |
uninstall(String bundleName,
InstallParam installParam,
InstallerCallback callback) |
Uninstalls an application.
|
asObjectstatic final int STATUS_INSTALL_FAILURE
The value is 1.
static final int STATUS_INSTALL_FAILURE_ABORTED
The value is 2.
static final int STATUS_INSTALL_FAILURE_CONFLICT
The value is 4.
static final int STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED
The value is 12.
static final int STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT
The value is 11.
static final int STATUS_INSTALL_FAILURE_INCOMPATIBLE
The value is 6.
static final int STATUS_INSTALL_FAILURE_INVALID
The value is 3.
static final int STATUS_INSTALL_FAILURE_STORAGE
The value is 5.
static final int STATUS_UNINSTALL_FAILURE
The value is 7.
static final int STATUS_UNINSTALL_FAILURE_ABORTED
The value is 9.
static final int STATUS_UNINSTALL_FAILURE_BLOCKED
The value is 8.
static final int STATUS_UNINSTALL_FAILURE_CONFLICT
The value is 10.
static final int SUCCESS
The value is 0.
boolean install(List<String> bundleFilePaths, InstallParam installParam, InstallerCallback callback) throws RemoteException
To use this method, you need to request the ohos.permission.INSTALL_BUNDLE
permission from the system, and this permission is of the signature level.
The installation is an asynchronous process, and this method does not return the installation result.
The result will be carried in the callback method specified by callback.
bundleFilePaths - Indicates the path where the bundle of the application is stored. The path should be the
relative path to the data directory of the current application.installParam - Indicates other parameters required for the installation.callback - Indicates the callback method for installing an application, which is used to listen for the
installation result.true if the application installation procedure is successfully started;
returns false otherwise.RemoteException - Throws this exception if an inter-process calling exception occurs.boolean uninstall(String bundleName, InstallParam installParam, InstallerCallback callback) throws RemoteException
To use this method, you need to request the ohos.permission.INSTALL_BUNDLE
permission from the system, and this permission is of the signature level.
You can use a flag to determine whether to keep user data when uninstalling an application.
bundleName - Indicates the bundle name of the application to be uninstalled.installParam - Indicates other parameters required for the uninstallation.callback - Indicates the callback for uninstalling an application, which is used to listen for the
uninstallation result.true if the application uninstallation procedure is successfully started;
returns false otherwise.RemoteException - Throws this exception if an inter-process calling exception occurs.