> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
The Update module applies to updates throughout the entire system, including built-in resources and preset applications, but not third-party applications.
The Update module applies to updates throughout the entire system, including built-in resources and preset applications, but not third-party applications.
There are two types of updates: SD card update and over the air (OTA) update.
There are two types of updates: SD card update and over the air (OTA) update.
...
@@ -10,135 +7,180 @@ There are two types of updates: SD card update and over the air (OTA) update.
...
@@ -10,135 +7,180 @@ There are two types of updates: SD card update and over the air (OTA) update.
- The SD card update depends on the update packages and SD cards.
- The SD card update depends on the update packages and SD cards.
- The OTA update depends on the server deployed by the device manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the device manufacturer.
- The OTA update depends on the server deployed by the device manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the device manufacturer.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
>
> The APIs provided by this module are system APIs.
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Example**
**Example**
```
```
// Set the update policy.
// Version digest information
let policy = {
var versionDigestInfo = {
autoDownload: false,
versionDigest: "versionDigest" // Version digest information in the check result
autoDownloadNet: true,
}
mode: 2,
autoUpgradeInterval: [ 2, 3 ],
// Options for resuming download
autoUpgradeCondition: 2
var resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
## PackageTypes
**Example**
Enumerates update package types.
```
// Version digest information
var versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Example**
```
// Version digest information
var versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
| callback | AsyncCallback\<void> | Yes | Callback used to return the result. If the operation is successful, `err` is `undefined`; otherwise, `err` is an `Error` object.|
**Example**
```
var upgradeFiles = [{
fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package