js-apis-update.md 17.9 KB
Newer Older
W
wusongqing 已提交
1 2
# Update

S
shawn_he 已提交
3 4 5
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**<br/>
> 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.

S
shawn_he 已提交
6
The Update module applies to updates throughout the entire system, including built-in resources and preset applications, but not third-party applications.
W
wusongqing 已提交
7 8 9 10 11 12 13 14 15

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 OTA update depends on the server deployed by the phone manufacturer for managing update packages. The OTA server IP address is passed by the caller. The request interface is fixed and developed by the phone manufacturer.

## Modules to Import

```js
S
shawn_he 已提交
16
import update from '@ohos.update'
W
wusongqing 已提交
17 18 19 20 21 22
```

## Required Permissions

None

S
shawn_he 已提交
23
## update.getUpdater
S
shawn_he 已提交
24 25 26 27 28

getUpdater(upgradeFile: string, updateType?: UpdateTypes): Updater

Obtains the **Updater** object for local update.

S
shawn_he 已提交
29
**System capability**: SystemCapability.Update.UpdateService
S
shawn_he 已提交
30 31 32 33 34 35 36 37

**Parameters**

| Name     | Type                       | Mandatory| Description    |
| ----------- | --------------------------- | ---- | -------- |
| upgradeFile | string                      | Yes  | Update file.|
| updateType  | [UpdateTypes](#updatetypes) | Yes  | Update type.|

S
shawn_he 已提交
38
**Return Value**
S
shawn_he 已提交
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53

| Type               | Description    |
| ------------------- | -------- |
| [Updater](#updater) | **Updater** object.|

**Example**

```
try {
  let updater = update.getUpdater('/data/updater/updater.zip', 'OTA');
} catch(error) {
  console.error(" Fail to get updater error: " + error);
}
```

S
shawn_he 已提交
54
## update.getUpdaterForOther
S
shawn_he 已提交
55 56 57 58 59

getUpdaterForOther(upgradeFile: string, device: string, updateType?: UpdateTypes): Updater

Obtains the **Updater** object for the device to be updated.

S
shawn_he 已提交
60
**System capability**: SystemCapability.Update.UpdateService
S
shawn_he 已提交
61 62 63 64 65 66 67 68 69

**Parameters**

| Name     | Type                       | Mandatory| Description      |
| ----------- | --------------------------- | ---- | ---------- |
| upgradeFile | string                      | Yes  | Update file.  |
| device      | string                      | Yes  | Device to be updated.|
| updateType  | [UpdateTypes](#updatetypes) | Yes  | Update type.  |

S
shawn_he 已提交
70
**Return Value**
S
shawn_he 已提交
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85

| Type               | Description    |
| ------------------- | -------- |
| [Updater](#updater) | **Updater** object.|

**Example**

```
try {
  let updater = update.getUpdaterForOther('/data/updater/updater.zip', '1234567890', 'OTA');
} catch(error) {
  console.error(" Fail to get updater error: " + error);
}
```

S
shawn_he 已提交
86
## update.getUpdaterFromOther
S
shawn_he 已提交
87 88 89 90 91

getUpdaterFromOther(upgradeFile: string, device: string, updateType?: UpdateTypes): Updater

Obtains the **Updater** object from another device for the device to be updated.

S
shawn_he 已提交
92
**System capability**: SystemCapability.Update.UpdateService
S
shawn_he 已提交
93 94 95 96 97 98 99 100 101

**Parameters**

| Name     | Type                       | Mandatory| Description      |
| ----------- | --------------------------- | ---- | ---------- |
| upgradeFile | string                      | Yes  | Update file.  |
| device      | string                      | Yes  | Device to be updated.|
| updateType  | [UpdateTypes](#updatetypes) | Yes  | Update type.  |

S
shawn_he 已提交
102
**Return Value**
S
shawn_he 已提交
103 104 105 106 107 108 109 110 111 112 113 114 115 116 117

| Type               | Description    |
| ------------------- | -------- |
| [Updater](#updater) | **Updater** object.|

**Example**

```
try {
  let updater = update.getUpdaterFromOther('/data/updater/updater.zip', '1234567890', 'OTA');
} catch(error) {
  console.error(" Fail to get updater error: " + error);
}
```

W
wusongqing 已提交
118 119 120 121 122 123
## Updater

###  getNewVersionInfo

getNewVersionInfo(callback: AsyncCallback\<NewVersionInfo>): void

S
shawn_he 已提交
124
Obtains the new version information. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
125

S
shawn_he 已提交
126
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
127 128 129

**Parameters**

S
shawn_he 已提交
130
| Name  | Type                                            | Mandatory| Description              |
W
wusongqing 已提交
131
| -------- | ------------------------------------------------ | ---- | ------------------ |
S
shawn_he 已提交
132
| callback | AsyncCallback<[NewVersionInfo](#newversioninfo)> | No  | Callback used to return the result.|
W
wusongqing 已提交
133 134 135 136

**Example**

```
S
shawn_he 已提交
137
update.getNewVersionInfo(info => {
W
wusongqing 已提交
138 139 140 141
  console.log("getNewVersionInfo success  " + info.status);
  console.log(`info versionName = ` + info.result[0].versionName);
  console.log(`info versionCode = ` + info.result[0].versionCode);
  console.log(`info verifyInfo = ` + info.result[0].verifyInfo);
S
shawn_he 已提交
142
});
W
wusongqing 已提交
143 144 145 146 147 148
```

### getNewVersionInfo

getNewVersionInfo(): Promise\<NewVersionInfo>

S
shawn_he 已提交
149
Obtains the new version information. This API uses a promise to return the result.
W
wusongqing 已提交
150

S
shawn_he 已提交
151
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
152

S
shawn_he 已提交
153
**Return Value**
S
shawn_he 已提交
154 155

| Type                                       | Description                     |
W
wusongqing 已提交
156
| ------------------------------------------- | ------------------------- |
S
shawn_he 已提交
157
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the result.|
W
wusongqing 已提交
158 159 160 161

**Example**

```
S
shawn_he 已提交
162
updater.getNewVersionInfo().then(value => {
W
wusongqing 已提交
163 164 165
  console.log(`info versionName = ` + value.result[0].versionName);
  console.log(`info versionCode = ` + value.result[0].versionCode);
  console.log(`info verifyInfo = ` + value.result[0].verifyInfo);
S
shawn_he 已提交
166
}).catch(err => {
W
wusongqing 已提交
167
  console.log("getNewVersionInfo promise error: " + err.code);
S
shawn_he 已提交
168
});
W
wusongqing 已提交
169 170 171 172 173 174
```

### checkNewVersion

checkNewVersion(callback: AsyncCallback\<NewVersionInfo>): void

S
shawn_he 已提交
175
Checks whether the current version is the latest. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
176

S
shawn_he 已提交
177
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
178 179 180

**Parameters**

S
shawn_he 已提交
181
| Name  | Type                                             | Mandatory| Description              |
W
wusongqing 已提交
182
| -------- | ------------------------------------------------- | ---- | ------------------ |
S
shawn_he 已提交
183
| callback | AsyncCallback\<[NewVersionInfo](#newversioninfo)> | No  | Callback used to return the result.|
W
wusongqing 已提交
184 185 186 187

**Example**

```
S
shawn_he 已提交
188
update.checkNewVersion(info => {
W
wusongqing 已提交
189 190 191 192
  console.log("checkNewVersion success  " + info.status);
  console.log(`info versionName = ` + info.result[0].versionName);
  console.log(`info versionCode = ` + info.result[0].versionCode);
  console.log(`info verifyInfo = ` + info.result[0].verifyInfo);
S
shawn_he 已提交
193
});
W
wusongqing 已提交
194 195 196 197 198 199
```

### checkNewVersion

checkNewVersion(): Promise\<NewVersionInfo>

S
shawn_he 已提交
200
Checks whether the current version is the latest. This API uses a promise to return the result.
S
shawn_he 已提交
201

S
shawn_he 已提交
202
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
203

S
shawn_he 已提交
204
**Return Value**
W
wusongqing 已提交
205

S
shawn_he 已提交
206
| Type                                       | Description                     |
W
wusongqing 已提交
207
| ------------------------------------------- | ------------------------- |
S
shawn_he 已提交
208
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the result.|
W
wusongqing 已提交
209 210 211 212

**Example**

```
S
shawn_he 已提交
213
update.checkNewVersion().then(value => {
W
wusongqing 已提交
214 215 216
  console.log(`info versionName = ` + value.result[0].versionName);
  console.log(`info versionCode = ` + value.result[0].versionCode);
  console.log(`info verifyInfo = ` + value.result[0].verifyInfo);
S
shawn_he 已提交
217
}).catch(err => {
W
wusongqing 已提交
218
  console.log("checkNewVersion promise error: " + err.code);
S
shawn_he 已提交
219
});
W
wusongqing 已提交
220 221 222 223 224 225 226 227
```

### verifyUpdatePackage

verifyUpdatePackage(upgradeFile: string, certsFile: string): void

Verifies whether the update package is valid.

S
shawn_he 已提交
228
**System capability**: SystemCapability.Update.UpdateService
S
shawn_he 已提交
229

W
wusongqing 已提交
230 231
**Parameters**

S
shawn_he 已提交
232
| Name     | Type  | Mandatory| Description              |
W
wusongqing 已提交
233
| ----------- | ------ | ---- | ------------------ |
S
shawn_he 已提交
234 235
| upgradeFile | string | Yes  | Path of the update package to be verified.|
| certsFile   | string | Yes  | Certificate path.          |
W
wusongqing 已提交
236 237 238 239

**Example**

```
S
shawn_he 已提交
240 241
update.on("verifyProgress", callback => {
  console.info('on verifyProgress ' + callback.percent);
W
wusongqing 已提交
242
});
S
shawn_he 已提交
243
update.verifyUpdatePackage("XXX", "XXX");
W
wusongqing 已提交
244 245 246 247 248 249
```

### rebootAndCleanUserData

rebootAndCleanUserData(): Promise\<number>

S
shawn_he 已提交
250
Reboots the device and clears the user partition data. This API uses a promise to return the result.
W
wusongqing 已提交
251

S
shawn_he 已提交
252
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
253

S
shawn_he 已提交
254
**Return Value**
S
shawn_he 已提交
255 256

| Type            | Description                           |
W
wusongqing 已提交
257
| ---------------- | ------------------------------- |
S
shawn_he 已提交
258
| Promise\<number> | Promise used to return the result.|
W
wusongqing 已提交
259 260 261 262

**Example**

```
S
shawn_he 已提交
263 264 265 266
update.rebootAndCleanUserData().then(result => {
  console.log("rebootAndCleanUserData " + result);
}).catch(err => {
  console.info("rebootAndCleanUserData promise error: " + err.code);
W
wusongqing 已提交
267 268 269 270 271 272 273
});
```

### rebootAndCleanUserData

rebootAndCleanUserData(callback: AsyncCallback\<number>): void

S
shawn_he 已提交
274
Reboots the device and clears the user partition data. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
275

S
shawn_he 已提交
276
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
277 278 279

**Parameters**

S
shawn_he 已提交
280
| Name  | Type    | Mandatory| Description                  |
W
wusongqing 已提交
281
| -------- | -------- | ---- | ---------------------- |
S
shawn_he 已提交
282
| callback | AsyncCallback\<number>| Yes  | Callback used to return the result.|
W
wusongqing 已提交
283 284 285 286

**Example**

```
S
shawn_he 已提交
287 288
update.rebootAndCleanUserData(result => {
  console.log("rebootAndCleanUserData ", result)
W
wusongqing 已提交
289 290 291 292 293 294 295
});
```

### applyNewVersion

applyNewVersion(): Promise\<number>

S
shawn_he 已提交
296
Installs the update package. This API uses a promise to return the result.
W
wusongqing 已提交
297

S
shawn_he 已提交
298
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
299

S
shawn_he 已提交
300
**Return Value**
S
shawn_he 已提交
301 302

| Type            | Description                           |
W
wusongqing 已提交
303
| ---------------- | ------------------------------- |
S
shawn_he 已提交
304
| Promise\<number> | Promise used to return the result.|
W
wusongqing 已提交
305 306 307 308

**Example**

```
S
shawn_he 已提交
309 310 311
update.applyNewVersion().then(result => {
    console.log("appVewVersion ", result)
}).catch(err => {
W
wusongqing 已提交
312 313 314 315 316 317 318 319
    console.info("applyNewVersion promise error: " + err.code);
});
```

### applyNewVersion

applyNewVersion(callback: AsyncCallback\<number>): void

S
shawn_he 已提交
320
Installs the update package. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
321

S
shawn_he 已提交
322
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
323 324 325

**Parameters**

S
shawn_he 已提交
326
| Name  | Type    | Mandatory| Description                  |
W
wusongqing 已提交
327
| -------- | -------- | ---- | ---------------------- |
S
shawn_he 已提交
328
| callback | AsyncCallback\<number>| Yes  | Callback used to return the result.|
W
wusongqing 已提交
329 330 331 332

**Example**

```
S
shawn_he 已提交
333 334
update.applyNewVersion(result => {
  console.log("applyNewVersion ", result)
W
wusongqing 已提交
335 336 337 338 339 340 341 342 343
});
```

### download

download(): void

Downloads the new version and displays the download process.

S
shawn_he 已提交
344
**System capability**: SystemCapability.Update.UpdateService
S
shawn_he 已提交
345

W
wusongqing 已提交
346 347 348 349 350 351 352
**Example**

```
updater.on("downloadProgress", progress => {
  console.log("downloadProgress on" + progress);
  console.log(`downloadProgress status: ` + progress.status);
  console.log(`downloadProgress percent: ` + progress.percent);
S
shawn_he 已提交
353
});
W
wusongqing 已提交
354 355 356 357 358 359 360 361 362
updater.download();
```

### upgrade

updater.upgrade():void

Starts an update.

S
shawn_he 已提交
363
**System capability**: SystemCapability.Update.UpdateService
S
shawn_he 已提交
364

W
wusongqing 已提交
365 366 367 368 369 370 371
**Example**

```
updater.on("upgradeProgress", progress => {
  console.log("upgradeProgress on" + progress);
  console.log(`upgradeProgress status: ` + progress.status);
  console.log(`upgradeProgress percent: ` + progress.percent);
S
shawn_he 已提交
372
});
W
wusongqing 已提交
373 374 375 376 377 378 379
updater.upgrade();
```

### setUpdatePolicy

setUpdatePolicy(policy: UpdatePolicy, callback: AsyncCallback\<number>): void

S
shawn_he 已提交
380
Sets the update policy. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
381

S
shawn_he 已提交
382
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
383 384 385

**Parameters**

S
shawn_he 已提交
386
| Name  | Type                         | Mandatory| Description        |
W
wusongqing 已提交
387
| -------- | ----------------------------- | ---- | ------------ |
S
shawn_he 已提交
388
| policy   | [UpdatePolicy](#updatepolicy) | Yes  | Update policy to set.|
S
shawn_he 已提交
389
| callback | AsyncCallback\<number>       | Yes  | Callback used to return the result.|
W
wusongqing 已提交
390 391 392 393 394 395

**Example**

```
// Set the update policy.
let policy = {
S
shawn_he 已提交
396 397 398 399 400
  autoDownload: false,
  autoDownloadNet: true,
  mode: 2,
  autoUpgradeInterval: [ 2, 3 ],
  autoUpgradeCondition: 2
W
wusongqing 已提交
401
}
S
shawn_he 已提交
402 403 404
update.setUpdatePolicy(policy, result => {
  console.log("setUpdatePolicy ", result)
});
W
wusongqing 已提交
405 406 407 408 409 410
```

### setUpdatePolicy

setUpdatePolicy(policy: UpdatePolicy): Promise\<number>

S
shawn_he 已提交
411
Sets the update policy. This API uses a promise to return the result.
S
shawn_he 已提交
412

S
shawn_he 已提交
413
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
414 415 416

**Parameters**

S
shawn_he 已提交
417
| Name| Type                         | Mandatory| Description        |
W
wusongqing 已提交
418
| ------ | ----------------------------- | ---- | ------------ |
S
shawn_he 已提交
419
| policy | [UpdatePolicy](#updatepolicy) | Yes  | Update policy to set.|
W
wusongqing 已提交
420

S
shawn_he 已提交
421
**Return Value**
W
wusongqing 已提交
422

S
shawn_he 已提交
423
| Type            | Description                   |
W
wusongqing 已提交
424
| ---------------- | ----------------------- |
S
shawn_he 已提交
425
| Promise\<number> | Promise used to return the result.|
W
wusongqing 已提交
426 427 428 429 430

**Example**

```
let policy = {
S
shawn_he 已提交
431 432 433 434 435
  autoDownload: false,
  autoDownloadNet: true,
  mode: 2,
  autoUpgradeInterval: [ 2, 3 ],
  autoUpgradeCondition: 2
W
wusongqing 已提交
436
}
S
shawn_he 已提交
437 438 439 440 441
update.setUpdatePolicy(policy).then(result => 
  console.log("setUpdatePolicy ", result)
).catch(err => {
  console.log("setUpdatePolicy promise error: " + err.code);
});
W
wusongqing 已提交
442 443 444 445 446 447
```

### getUpdatePolicy

getUpdatePolicy(callback: AsyncCallback\<UpdatePolicy>): void

S
shawn_he 已提交
448
Obtains the update policy. This API uses an asynchronous callback to return the result.
S
shawn_he 已提交
449

S
shawn_he 已提交
450
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
451 452 453

**Parameters**

S
shawn_he 已提交
454
| Name  | Type                                         | Mandatory| Description                |
W
wusongqing 已提交
455
| -------- | --------------------------------------------- | ---- | -------------------- |
S
shawn_he 已提交
456
| callback | AsyncCallback\<[UpdatePolicy](#updatepolicy)> | No  | Callback used to return the result.|
W
wusongqing 已提交
457 458 459 460

**Example**

```
S
shawn_he 已提交
461
update.getUpdatePolicy(policy => {
W
wusongqing 已提交
462 463 464 465
  console.log("getUpdatePolicy success");
  console.log(`policy autoDownload = ` + policy.autoDownload);
  console.log(`policy autoDownloadNet = ` + policy.autoDownloadNet);
  console.log(`policy mode = ` + policy.mode);
S
shawn_he 已提交
466
});
W
wusongqing 已提交
467 468 469 470 471 472
```

### getUpdatePolicy

getUpdatePolicy(): Promise\<UpdatePolicy>

S
shawn_he 已提交
473
Obtains the update policy. This API uses a promise to return the result.
W
wusongqing 已提交
474

S
shawn_he 已提交
475
**System capability**: SystemCapability.Update.UpdateService
W
wusongqing 已提交
476

S
shawn_he 已提交
477
**Return Value**
S
shawn_he 已提交
478 479

| Type                                   | Description                       |
W
wusongqing 已提交
480
| --------------------------------------- | --------------------------- |
S
shawn_he 已提交
481
| Promise\<[UpdatePolicy](#updatepolicy)> | Promise used to return the result.|
W
wusongqing 已提交
482 483 484 485

**Example**

```
S
shawn_he 已提交
486
update.getUpdatePolicy().then(value => {
W
wusongqing 已提交
487 488 489
  console.log(`info autoDownload = ` + value.autoDownload);
  console.log(`info autoDownloadNet = ` + value.autoDownloadNet);
  console.log(`info mode = ` + value.mode);
S
shawn_he 已提交
490
}).catch(err => {
W
wusongqing 已提交
491
  console.log("getUpdatePolicy promise error: " + err.code);
S
shawn_he 已提交
492
});
W
wusongqing 已提交
493 494 495 496
```

## UpdateTypes

S
shawn_he 已提交
497
Enumerates update types.
W
wusongqing 已提交
498

S
shawn_he 已提交
499 500
**System capability**: SystemCapability.Update.UpdateService

S
shawn_he 已提交
501
| Name| Description    |
W
wusongqing 已提交
502
| ------ | -------- |
S
shawn_he 已提交
503 504
| OTA    | OTA update. |
| patch  | Patch update.|
W
wusongqing 已提交
505 506 507

## PackageTypes

S
shawn_he 已提交
508
Enumerates update package types.
W
wusongqing 已提交
509

S
shawn_he 已提交
510 511
**System capability**: SystemCapability.Update.UpdateService

S
shawn_he 已提交
512
| Name              | Default Value| Description          |
W
wusongqing 已提交
513
| -------------------- | ------ | -------------- |
S
shawn_he 已提交
514 515 516 517 518 519 520
| PACKAGE_TYPE_NORMAL  | 1      | Common update package.    |
| PACKAGE_TYPE_BASE    | 2      | Basic update package.    |
| PACKAGE_TYPE_CUST    | 3      | Custom update package.    |
| PACKAGE_TYPE_PRELOAD | 4      | Preinstalled update package.    |
| PACKAGE_TYPE_COTA    | 5      | Parameter configuration update package.|
| PACKAGE_TYPE_VERSION | 6      | Version update package.    |
| PACKAGE_TYPE_PATCH   | 7      | Patch packages        |
W
wusongqing 已提交
521 522 523

## InstallMode

S
shawn_he 已提交
524
Enumerates update modes.
W
wusongqing 已提交
525

S
shawn_he 已提交
526 527
**System capability**: SystemCapability.Update.UpdateService

S
shawn_he 已提交
528
| Name             | Default Value| Description    |
W
wusongqing 已提交
529
| ------------------- | ------ | -------- |
S
shawn_he 已提交
530 531 532
| INSTALL_MODE_NORMAL | 0      | Normal update.|
| INSTALL_MODE_NIGHT  | 1      | Update at night.|
| INSTALL_MODE_AUTO   | 2      | Automatic update.|
W
wusongqing 已提交
533 534 535

## NewVersionStatus

S
shawn_he 已提交
536
Enumerates new version check results.
W
wusongqing 已提交
537

S
shawn_he 已提交
538 539
**System capability**: SystemCapability.Update.UpdateService

S
shawn_he 已提交
540
| Name             | Default Value| Description            |
W
wusongqing 已提交
541
| ------------------- | ------ | ---------------- |
S
shawn_he 已提交
542 543 544 545
| VERSION_STATUS_ERR  | -1     | System error while checking for the new version.  |
| VERSION_STATUS_NEW  | 0      | New version detected.    |
| VERSION_STATUS_NONE | 1      | No new version detected.|
| VERSION_STATUS_BUSY | 2      | System busy while checking for the new version.    |
W
wusongqing 已提交
546 547 548 549 550

## UpdatePolicy

Defines the update policy.

S
shawn_he 已提交
551 552
**System capability**: SystemCapability.Update.UpdateService

S
shawn_he 已提交
553
| Name               | Type                   | Mandatory| Description          |
W
wusongqing 已提交
554
| ------------------- | --------------------------- | ---- | -------------- |
S
shawn_he 已提交
555 556 557
| autoDownload        | bool                        | Yes  | Automatic update switch.  |
| installMode         | [InstallMode](#installmode) | Yes  | Installation mode.      |
| autoUpgradeInterval | Array\<number>              | Yes  | Period of time for automatic update.|
W
wusongqing 已提交
558 559 560 561 562

## NewVersionInfo

Defines the new version information.

S
shawn_he 已提交
563 564
**System capability**: SystemCapability.Update.UpdateService

S
shawn_he 已提交
565
| Name           | Type                                   | Mandatory| Description    |
W
wusongqing 已提交
566
| --------------- | ------------------------------------------- | ---- | -------- |
S
shawn_he 已提交
567 568 569 570
| status          | [NewVersionStatus](#newversionstatus)       | Yes  | Update status.|
| errMsg          | string                                      | Yes  | Error message.|
| checkResults    | Array<[CheckResult](#checkresult)>          | Yes  | Version check result.|
| descriptionInfo | Array\<[DescriptionInfo](#descriptioninfo)> | Yes  | Version description information.|
W
wusongqing 已提交
571 572 573

## CheckResult

S
shawn_he 已提交
574
Defines the version check result.
W
wusongqing 已提交
575

S
shawn_he 已提交
576 577
**System capability**: SystemCapability.Update.UpdateService

S
shawn_he 已提交
578
| Name         | Type                     | Mandatory| Description        |
W
wusongqing 已提交
579
| ------------- | ----------------------------- | ---- | ------------ |
S
shawn_he 已提交
580 581 582 583 584 585
| versionName   | string                        | Yes  | Version name.    |
| versionCode   | number                        | Yes  | Version code.    |
| size          | number                        | Yes  | Version size.    |
| verifyInfo    | string                        | Yes  | Version verification information.|
| packageType   | [PackageTypes](#packagetypes) | Yes  | Version type.    |
| descriptionId | string                        | Yes  | Version description information.|
W
wusongqing 已提交
586 587 588 589 590

## DescriptionInfo

Defines the version description information.

S
shawn_he 已提交
591 592
**System capability**: SystemCapability.Update.UpdateService

S
shawn_he 已提交
593
| Name         | Type| Mandatory| Description             |
W
wusongqing 已提交
594
| ------------- | -------- | ---- | ----------------- |
S
shawn_he 已提交
595 596
| descriptionId | string   | Yes  | Version ID information.|
| content       | string   | Yes  | Version changelog information.|