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

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

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 已提交
13
import update from '@ohos.update'
W
wusongqing 已提交
14 15 16 17 18 19
```

## Required Permissions

None

S
shawn_he 已提交
20
## Obtaining an Updater Object
S
shawn_he 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116

### update.getUpdater

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

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

**System capability**: SystemCapability.Updater.update_service

**Parameters**

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

**Return value**

| 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);
}
```

### update.getUpdaterForOther

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

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

**System capability**: SystemCapability.Updater.update_service

**Parameters**

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

**Return value**

| 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);
}
```

### update.getUpdaterFromOther

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

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

**System capability**: SystemCapability.Updater.update_service

**Parameters**

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

**Return value**

| 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 已提交
117 118 119 120 121 122
## Updater

###  getNewVersionInfo

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

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

**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
126 127 128

**Parameters**

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

**Example**

```
S
shawn_he 已提交
136
update.getNewVersionInfo(info => {
W
wusongqing 已提交
137 138 139 140
  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 已提交
141
});
W
wusongqing 已提交
142 143 144 145 146 147
```

### getNewVersionInfo

getNewVersionInfo(): Promise\<NewVersionInfo>

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

S
shawn_he 已提交
150
**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
151

S
shawn_he 已提交
152 153 154
**Return value**

| Type                                       | Description                     |
W
wusongqing 已提交
155 156 157 158 159 160
| ------------------------------------------- | ------------------------- |
| Promise\<[NewVersionInfo](#newversioninfo)> | Promise used to return the new version information.|

**Example**

```
S
shawn_he 已提交
161
updater.getNewVersionInfo().then(value => {
W
wusongqing 已提交
162 163 164
  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 已提交
165
}).catch(err => {
W
wusongqing 已提交
166
  console.log("getNewVersionInfo promise error: " + err.code);
S
shawn_he 已提交
167
});
W
wusongqing 已提交
168 169 170 171 172 173
```

### checkNewVersion

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

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

**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
177 178 179

**Parameters**

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

**Example**

```
S
shawn_he 已提交
187
update.checkNewVersion(info => {
W
wusongqing 已提交
188 189 190 191
  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 已提交
192
});
W
wusongqing 已提交
193 194 195 196 197 198
```

### checkNewVersion

checkNewVersion(): Promise\<NewVersionInfo>

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

**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
202

S
shawn_he 已提交
203
**Return value**
W
wusongqing 已提交
204

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

**Example**

```
S
shawn_he 已提交
212
update.checkNewVersion().then(value => {
W
wusongqing 已提交
213 214 215
  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 已提交
216
}).catch(err => {
W
wusongqing 已提交
217
  console.log("checkNewVersion promise error: " + err.code);
S
shawn_he 已提交
218
});
W
wusongqing 已提交
219 220 221 222 223 224 225 226
```

### verifyUpdatePackage

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

Verifies whether the update package is valid.

S
shawn_he 已提交
227 228
**System capability**: SystemCapability.Updater.update_service

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

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

**Example**

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

### rebootAndCleanUserData

rebootAndCleanUserData(): Promise\<number>

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

S
shawn_he 已提交
251
**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
252

S
shawn_he 已提交
253 254 255
**Return value**

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

**Example**

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

### rebootAndCleanUserData

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

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

**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
276 277 278

**Parameters**

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

**Example**

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

### applyNewVersion

applyNewVersion(): Promise\<number>

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

S
shawn_he 已提交
297
**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
298

S
shawn_he 已提交
299 300 301
**Return value**

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

**Example**

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

### applyNewVersion

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

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

**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
322 323 324

**Parameters**

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

**Example**

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

### download

download(): void

Downloads the new version and displays the download process.

S
shawn_he 已提交
343 344
**System capability**: SystemCapability.Updater.update_service

W
wusongqing 已提交
345 346 347 348 349 350 351
**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 已提交
352
});
W
wusongqing 已提交
353 354 355 356 357 358 359 360 361
updater.download();
```

### upgrade

updater.upgrade():void

Starts an update.

S
shawn_he 已提交
362 363
**System capability**: SystemCapability.Updater.update_service

W
wusongqing 已提交
364 365 366 367 368 369 370
**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 已提交
371
});
W
wusongqing 已提交
372 373 374 375 376 377 378
updater.upgrade();
```

### setUpdatePolicy

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

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

**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
382 383 384

**Parameters**

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

**Example**

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

### setUpdatePolicy

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

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

**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
413 414 415

**Parameters**

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

S
shawn_he 已提交
420
**Return value**
W
wusongqing 已提交
421

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

**Example**

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

### getUpdatePolicy

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

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

**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
450 451 452

**Parameters**

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

**Example**

```
S
shawn_he 已提交
460
update.getUpdatePolicy(policy => {
W
wusongqing 已提交
461 462 463 464
  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 已提交
465
});
W
wusongqing 已提交
466 467 468 469 470 471
```

### getUpdatePolicy

getUpdatePolicy(): Promise\<UpdatePolicy>

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

S
shawn_he 已提交
474
**System capability**: SystemCapability.Updater.update_service
W
wusongqing 已提交
475

S
shawn_he 已提交
476 477 478
**Return value**

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

**Example**

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

## UpdateTypes

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

S
shawn_he 已提交
498
| Name| Description    |
W
wusongqing 已提交
499
| ------ | -------- |
S
shawn_he 已提交
500 501
| OTA    | OTA update.<br>**System capability**: SystemCapability.Updater.update_service|
| patch  | Patch update.<br>**System capability**: SystemCapability.Updater.update_service|
W
wusongqing 已提交
502 503 504

## PackageTypes

S
shawn_he 已提交
505
Enumerates update package types.
W
wusongqing 已提交
506

S
shawn_he 已提交
507
| Name              | Default Value| Description          |
W
wusongqing 已提交
508
| -------------------- | ------ | -------------- |
S
shawn_he 已提交
509 510 511 512 513 514 515
| PACKAGE_TYPE_NORMAL  | 1      | Common update package.<br>**System capability**: SystemCapability.Updater.update_service|
| PACKAGE_TYPE_BASE    | 2      | Basic update package.<br>**System capability**: SystemCapability.Updater.update_service|
| PACKAGE_TYPE_CUST    | 3      | Custom update package.<br>**System capability**: SystemCapability.Updater.update_service|
| PACKAGE_TYPE_PRELOAD | 4      | Preinstalled update package.<br>**System capability**: SystemCapability.Updater.update_service|
| PACKAGE_TYPE_COTA    | 5      | Parameter configuration update package.<br>**System capability**: SystemCapability.Updater.update_service|
| PACKAGE_TYPE_VERSION | 6      | Version update package.<br>**System capability**: SystemCapability.Updater.update_service|
| PACKAGE_TYPE_PATCH   | 7      | Patch package.<br>**System capability**: SystemCapability.Updater.update_service|
W
wusongqing 已提交
516 517 518

## InstallMode

S
shawn_he 已提交
519
Enumerates update modes.
W
wusongqing 已提交
520

S
shawn_he 已提交
521
| Name             | Default Value| Description    |
W
wusongqing 已提交
522
| ------------------- | ------ | -------- |
S
shawn_he 已提交
523 524 525
| INSTALL_MODE_NORMAL | 0      | Normal update.<br>**System capability**: SystemCapability.Updater.update_service|
| INSTALL_MODE_NIGHT  | 1      | Update at night.<br>**System capability**: SystemCapability.Updater.update_service|
| INSTALL_MODE_AUTO   | 2      | Automatic update.<br>**System capability**: SystemCapability.Updater.update_service|
W
wusongqing 已提交
526 527 528

## NewVersionStatus

S
shawn_he 已提交
529
Enumerates new version check results.
W
wusongqing 已提交
530

S
shawn_he 已提交
531
| Name             | Default Value| Description            |
W
wusongqing 已提交
532
| ------------------- | ------ | ---------------- |
S
shawn_he 已提交
533 534 535 536
| VERSION_STATUS_ERR  | -1     | System error while checking for the new version.<br>**System capability**: SystemCapability.Updater.update_service|
| VERSION_STATUS_NEW  | 0      | New version detected.<br>**System capability**: SystemCapability.Updater.update_service|
| VERSION_STATUS_NONE | 1      | No new version detected.<br>**System capability**: SystemCapability.Updater.update_service|
| VERSION_STATUS_BUSY | 2      | System busy while checking for the new version.<br>**System capability**: SystemCapability.Updater.update_service|
W
wusongqing 已提交
537 538 539 540 541

## UpdatePolicy

Defines the update policy.

S
shawn_he 已提交
542
| Name               | Type                   | Mandatory| Description          |
W
wusongqing 已提交
543
| ------------------- | --------------------------- | ---- | -------------- |
S
shawn_he 已提交
544 545 546
| autoDownload        | bool                        | Yes  | Automatic update switch.<br>**System capability**: SystemCapability.Updater.update_service|
| installMode         | [InstallMode](#installmode) | Yes  | Update mode.<br>**System capability**: SystemCapability.Updater.update_service|
| autoUpgradeInterval | Array\<number>              | Yes  | Period of time for automatic update.<br>**System capability**: SystemCapability.Updater.update_service|
W
wusongqing 已提交
547 548 549 550 551

## NewVersionInfo

Defines the new version information.

S
shawn_he 已提交
552
| Name           | Type                                   | Mandatory| Description    |
W
wusongqing 已提交
553
| --------------- | ------------------------------------------- | ---- | -------- |
S
shawn_he 已提交
554 555 556 557
| status          | [NewVersionStatus](#newversionstatus)       | Yes  | Update status.<br>**System capability**: SystemCapability.Updater.update_service|
| errMsg          | string                                      | Yes  | Error message.<br>**System capability**: SystemCapability.Updater.update_service|
| checkResults    | Array<[CheckResult](#checkresult)>          | Yes  | Version check result.<br>**System capability**: SystemCapability.Updater.update_service|
| descriptionInfo | Array\<[DescriptionInfo](#descriptioninfo)> | Yes  | Version description information.<br>**System capability**: SystemCapability.Updater.update_service|
W
wusongqing 已提交
558 559 560

## CheckResult

S
shawn_he 已提交
561
Defines the version check result.
W
wusongqing 已提交
562

S
shawn_he 已提交
563
| Name         | Type                     | Mandatory| Description        |
W
wusongqing 已提交
564
| ------------- | ----------------------------- | ---- | ------------ |
S
shawn_he 已提交
565 566 567 568 569 570
| versionName   | string                        | Yes  | Version name.<br>**System capability**: SystemCapability.Updater.update_service|
| versionCode   | number                        | Yes  | Version code.<br>**System capability**: SystemCapability.Updater.update_service|
| size          | number                        | Yes  | Version size.<br>**System capability**: SystemCapability.Updater.update_service|
| verifyInfo    | string                        | Yes  | Version verification information.<br>**System capability**: SystemCapability.Updater.update_service|
| packageType   | [PackageTypes](#packagetypes) | Yes  | Version type.<br>**System capability**: SystemCapability.Updater.update_service|
| descriptionId | string                        | Yes  | Version description information.<br>**System capability**: SystemCapability.Updater.update_service|
W
wusongqing 已提交
571 572 573 574 575

## DescriptionInfo

Defines the version description information.

S
shawn_he 已提交
576
| Name         | Type| Mandatory| Description             |
W
wusongqing 已提交
577
| ------------- | -------- | ---- | ----------------- |
S
shawn_he 已提交
578 579
| descriptionId | string   | Yes  | Version ID information.<br>**System capability**: SystemCapability.Updater.update_service|
| content       | string   | Yes  | Version changelog information.<br>**System capability**: SystemCapability.Updater.update_service|