“958199895cc87a5f587c11d2f92d6d6c6543ace0”上不存在“src/share/git@gitcode.net:openanolis/dragonwell8_jdk.git”
提交 e5f45fdf 编写于 作者: S shawn_he

update doc

Signed-off-by: Nshawn_he <shawn.he@huawei.com>
上级 b237cb2c
...@@ -12,12 +12,10 @@ The following table provides only a brief description of related APIs. For detai ...@@ -12,12 +12,10 @@ The following table provides only a brief description of related APIs. For detai
**Table 1** APIs for application event logging **Table 1** APIs for application event logging
| API | Description | | API | Description |
| ------------------------------------------------------------ | ------------------------------------------------------------ | | ------------------------------------------------------------ | ---------------------------------------------------- |
| write(string eventName, EventType type, object keyValues, AsyncCallback\<void> callback): void | Logs application events in asynchronous mode. This API uses an asynchronous callback to return the result. | | write(AppEventInfo info, AsyncCallback\<void> callback): void | Logs application events in asynchronous mode. This API uses an asynchronous callback to return the result.|
| write(string eventName, EventType type, object keyValues): Promise\<void> | Logs application events in asynchronous mode. This API uses a promise to return the result. | | write(AppEventInfo info): Promise\<void> | Logs application events in asynchronous mode. This API uses a promise to return the result. |
| write(AppEventInfo info, AsyncCallback\<void> callback): void | Logs application events by domain in asynchronous mode. This API uses an asynchronous callback to return the result.|
| write(AppEventInfo info): Promise\<void> | Logs application events by domain in asynchronous mode. This API uses a promise to return the result.|
When an asynchronous callback is used, the return value can be processed directly in the callback. When an asynchronous callback is used, the return value can be processed directly in the callback.
...@@ -49,12 +47,12 @@ For details about the result codes, see [Event Verification Result Codes](#event ...@@ -49,12 +47,12 @@ For details about the result codes, see [Event Verification Result Codes](#event
| Result Code| Cause | Verification Rules | Handling Method | | Result Code| Cause | Verification Rules | Handling Method |
| ------ | ----------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------- | | ------ | ----------------------------- | ------------------------------------------------------------ | ---------------------------------------------------------- |
| 0 | N/A | Event verification is successful. | Event logging is normal. No action is required. | | 0 | N/A | Event verification is successful. | Event logging is normal. No action is required. |
| -1 | Invalid event name | The name is not empty and contains a maximum of 48 characters.<br>The name consists of only the following characters: digits (0 to 9), letters (a to z), and underscore \(_).<br>The name does not start with a digit or underscore \(_).| Ignore this event and do not perform logging. | | -1 | Invalid event name | The name is not empty and contains a maximum of 48 characters.<br>The name consists of only the following characters: digits (0 to 9), letters (a to z), and underscore (\_).<br>The name does not start with a digit or underscore (\_).| Ignore this event and do not perform logging. |
| -2 | Invalid event parameter type | The event name must be a string.<br>The event type must be a number.<br>The event parameter must be an object.| Ignore this event and do not perform logging. | | -2 | Invalid event parameter type | The event name must be a string.<br>The event type must be a number.<br>The event parameter must be an object.| Ignore this event and do not perform logging. |
| -4 | Invalid event domain name | The name is not empty and contains a maximum of 32 characters.<br>The name consists of only the following characters: digits (0 to 9), letters (a to z), and underscore \(_).<br>The name does not start with a digit or underscore \(_).| Ignore this event and do not perform logging. | | -4 | Invalid event domain name | The name is not empty and contains a maximum of 32 characters.<br>The name consists of only the following characters: digits (0 to 9), letters (a to z), and underscore (\_).<br>The name does not start with a digit or underscore (\_).| Ignore this event and do not perform logging. |
| -99 | Application event logging disabled | Application event logging is disabled. | Ignore this event and do not perform logging. | | -99 | Application event logging disabled | Application event logging is disabled. | Ignore this event and do not perform logging. |
| -100 | Unknown error | None. | Ignore this event and do not perform logging. | | -100 | Unknown error | None. | Ignore this event and do not perform logging. |
| 1 | Invalid key name | The name is not empty and contains a maximum of 16 characters.<br>The name consists of only the following characters: digits (0 to 9), letters (a to z), and underscore \(_).<br>The name does not start with a digit or underscore \(_).<br>The name does not end with an underscore \(_).| Ignore the key-value pair and continue to perform logging. | | 1 | Invalid key name | The name is not empty and contains a maximum of 16 characters.<br>The name consists of only the following characters: digits (0 to 9), letters (a to z), and underscore (\_).<br>The name does not start with a digit or underscore (\_).<br>The name does not end with an underscore (\_).| Ignore the key-value pair and continue to perform logging. |
| 2 | Invalid key type | The key must be a string. | Ignore the key-value pair and continue to perform logging. | | 2 | Invalid key type | The key must be a string. | Ignore the key-value pair and continue to perform logging. |
| 3 | Invalid value type | The supported value types vary depending on the programming language:<br>boolean, number, string, or Array [basic element]| Ignore the key-value pair and continue to perform logging. | | 3 | Invalid value type | The supported value types vary depending on the programming language:<br>boolean, number, string, or Array [basic element]| Ignore the key-value pair and continue to perform logging. |
| 4 | Invalid length for values of the string type| For a value of the string type, the maximum length is 8*1024 characters. | Truncate the value with the first 8*1024 characters retained, and continue to perform logging.| | 4 | Invalid length for values of the string type| For a value of the string type, the maximum length is 8*1024 characters. | Truncate the value with the first 8*1024 characters retained, and continue to perform logging.|
...@@ -84,6 +82,7 @@ The following uses a one-time event watcher as an example to illustrate the deve ...@@ -84,6 +82,7 @@ The following uses a one-time event watcher as an example to illustrate the deve
.fontWeight(FontWeight.Bold) .fontWeight(FontWeight.Bold)
Button("1 writeTest").onClick(()=>{ Button("1 writeTest").onClick(()=>{
// Perform event logging based on the input event parameters.
hiAppEvent.write({ hiAppEvent.write({
domain: "test_domain", domain: "test_domain",
name: "test_event", name: "test_event",
...@@ -100,6 +99,7 @@ The following uses a one-time event watcher as an example to illustrate the deve ...@@ -100,6 +99,7 @@ The following uses a one-time event watcher as an example to illustrate the deve
}) })
Button("2 addWatcherTest").onClick(()=>{ Button("2 addWatcherTest").onClick(()=>{
// Add an event watcher based on the input subscription parameters.
hiAppEvent.addWatcher({ hiAppEvent.addWatcher({
name: "watcher1", name: "watcher1",
appEventFilters: [{ domain: "test_domain" }], appEventFilters: [{ domain: "test_domain" }],
...@@ -109,17 +109,23 @@ The following uses a one-time event watcher as an example to illustrate the deve ...@@ -109,17 +109,23 @@ The following uses a one-time event watcher as an example to illustrate the deve
timeOut: 2 timeOut: 2
}, },
onTrigger: function (curRow, curSize, holder) { onTrigger: function (curRow, curSize, holder) {
// If the holder object is null, return an error after recording it in the log.
if (holder == null) { if (holder == null) {
console.error("HiAppEvent holder is null"); console.error("HiAppEvent holder is null");
return; return;
} }
// Set the size threshold to 1,000 bytes for obtaining an event package.
holder.setSize(1000);
let eventPkg = null; let eventPkg = null;
// Obtain the event package based on the configured size threshold. If returned event package is null, all event data has been obtained.
while ((eventPkg = holder.takeNext()) != null) { while ((eventPkg = holder.takeNext()) != null) {
console.info("HiAppEvent eventPkg.packageId=" + eventPkg.packageId); // Parse the obtained event package and display the result on the Log page.
console.info("HiAppEvent eventPkg.row=" + eventPkg.row); console.info('HiAppEvent eventPkg.packageId=' + eventPkg.packageId);
console.info("HiAppEvent eventPkg.size=" + eventPkg.size); console.info('HiAppEvent eventPkg.row=' + eventPkg.row);
console.info('HiAppEvent eventPkg.size=' + eventPkg.size);
// Traverse and parse event string arrays in the obtained event package.
for (const eventInfo of eventPkg.data) { for (const eventInfo of eventPkg.data) {
console.info("HiAppEvent eventPkg.data=" + eventInfo); console.info('HiAppEvent eventPkg.data=' + eventInfo);
} }
} }
} }
...@@ -127,6 +133,7 @@ The following uses a one-time event watcher as an example to illustrate the deve ...@@ -127,6 +133,7 @@ The following uses a one-time event watcher as an example to illustrate the deve
}) })
Button("3 removeWatcherTest").onClick(()=>{ Button("3 removeWatcherTest").onClick(()=>{
// Remove the specified event watcher.
hiAppEvent.removeWatcher({ hiAppEvent.removeWatcher({
name: "watcher1" name: "watcher1"
}) })
...@@ -157,9 +164,3 @@ The following uses a one-time event watcher as an example to illustrate the deve ...@@ -157,9 +164,3 @@ The following uses a one-time event watcher as an example to illustrate the deve
``` ```
5. On the application UI, touch button 3 to remove the event watcher. Then, touch button 1 for multiple times to perform application event logging. In such a case, there will be no log information about the callback invoked by the event watcher. 5. On the application UI, touch button 3 to remove the event watcher. Then, touch button 1 for multiple times to perform application event logging. In such a case, there will be no log information about the callback invoked by the event watcher.
## Samples
The following sample is provided to help you better understand how to develop the application event logging feature:
- [`JsDotTest` (JS) (API8)](https://gitee.com/openharmony/applications_app_samples/tree/master/DFX/JsDotTest)
...@@ -834,7 +834,7 @@ promise.then(data => { ...@@ -834,7 +834,7 @@ promise.then(data => {
## call.reject<sup>7+</sup> ## call.reject<sup>7+</sup>
reject\(callId: number, options: RejectMessageOption, callback: AsyncCallback<void\>\): void reject\(callId: number, options: RejectMessageOptions, callback: AsyncCallback<void\>\): void
Rejects a call based on the specified call ID and options. This API uses an asynchronous callback to return the result. Rejects a call based on the specified call ID and options. This API uses an asynchronous callback to return the result.
......
...@@ -194,8 +194,8 @@ Updates a contact based on the specified contact information and attributes. Thi ...@@ -194,8 +194,8 @@ Updates a contact based on the specified contact information and attributes. Thi
contact.updateContact({ contact.updateContact({
fullName: {fullName: 'xxx'}, fullName: {fullName: 'xxx'},
phoneNumbers: [{phoneNumber: '138xxxxxxxx'}] phoneNumbers: [{phoneNumber: '138xxxxxxxx'}]
},{ }, {
attributes:[contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME] attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
}, (err) => { }, (err) => {
if (err) { if (err) {
console.log('updateContact callback: err->${JSON.stringify(err)}'); console.log('updateContact callback: err->${JSON.stringify(err)}');
...@@ -449,7 +449,7 @@ Queries my card based on the specified contact attributes. This API uses a promi ...@@ -449,7 +449,7 @@ Queries my card based on the specified contact attributes. This API uses a promi
```js ```js
let promise = contact.queryMyCard({ let promise = contact.queryMyCard({
attributes:['ATTR_EMAIL', 'ATTR_NAME'] attributes: [contact.Attribute.ATTR_EMAIL, contact.Attribute.ATTR_NAME]
}); });
promise.then((data) => { promise.then((data) => {
console.log(`queryMyCard success: data->${JSON.stringify(data)}`); console.log(`queryMyCard success: data->${JSON.stringify(data)}`);
...@@ -467,7 +467,7 @@ Selects a contact. This API uses an asynchronous callback to return the result. ...@@ -467,7 +467,7 @@ Selects a contact. This API uses an asynchronous callback to return the result.
**Permission required**: ohos.permission.READ_CONTACTS **Permission required**: ohos.permission.READ_CONTACTS
**System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData **System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.Contacts
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
...@@ -495,7 +495,7 @@ Selects a contact. This API uses a promise to return the result. ...@@ -495,7 +495,7 @@ Selects a contact. This API uses a promise to return the result.
**Permission required**: ohos.permission.READ_CONTACTS **Permission required**: ohos.permission.READ_CONTACTS
**System capability**: SystemCapability.Applications.Contacts and SystemCapability.Applications.ContactsData **System capability**: SystemCapability.Applications.Contacts
**Return Value** **Return Value**
| Type | Description | | Type | Description |
......
...@@ -207,7 +207,7 @@ let ret = hiSysEvent.addWatcher(watcher) ...@@ -207,7 +207,7 @@ let ret = hiSysEvent.addWatcher(watcher)
## hiSysEvent.removeWatcher ## hiSysEvent.removeWatcher
removeWatcher(wathcer: Watcher): number removeWatcher(watcher: Watcher): number
Removes a watcher used for event subscription. Removes a watcher used for event subscription.
......
...@@ -67,6 +67,8 @@ hasDefaultNet(callback: AsyncCallback\<boolean>): void ...@@ -67,6 +67,8 @@ hasDefaultNet(callback: AsyncCallback\<boolean>): void
Checks whether the default data network is activated. This API uses an asynchronous callback to return the result. Checks whether the default data network is activated. This API uses an asynchronous callback to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core **System capability**: SystemCapability.Communication.NetManager.Core
**Parameters** **Parameters**
...@@ -90,6 +92,8 @@ hasDefaultNet(): Promise\<boolean> ...@@ -90,6 +92,8 @@ hasDefaultNet(): Promise\<boolean>
Checks whether the default data network is activated. This API uses a promise to return the result. Checks whether the default data network is activated. This API uses a promise to return the result.
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Communication.NetManager.Core **System capability**: SystemCapability.Communication.NetManager.Core
**Return Value** **Return Value**
......
...@@ -384,6 +384,27 @@ promise.then(data => { ...@@ -384,6 +384,27 @@ promise.then(data => {
}); });
``` ```
## radio.isNrSupported<sup>7+</sup>
isNrSupported\(\): boolean
Checks whether the current device supports 5G \(NR\).
**System capability**: SystemCapability.Telephony.CoreService
**Return value**
| Type | Description |
| ------- | -------------------------------- |
| boolean | - **true**: The current device supports 5G \(NR\).<br>- **false**: The current device does not support 5G \(NR\).|
**Example**
```js
let result = radio.isNrSupported();
console.log("Result: "+ result);
``
## radio.isNrSupported<sup>8+</sup> ## radio.isNrSupported<sup>8+</sup>
......
...@@ -2657,8 +2657,6 @@ getOpKey(slotId: number, callback: AsyncCallback<string\>): void ...@@ -2657,8 +2657,6 @@ getOpKey(slotId: number, callback: AsyncCallback<string\>): void
Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the opkey of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
**Parameters** **Parameters**
...@@ -2683,8 +2681,6 @@ getOpKey(slotId: number): Promise<string\> ...@@ -2683,8 +2681,6 @@ getOpKey(slotId: number): Promise<string\>
Obtains the opkey of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the opkey of the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
**Parameters** **Parameters**
...@@ -2716,8 +2712,6 @@ getOpName(slotId: number, callback: AsyncCallback<string\>): void ...@@ -2716,8 +2712,6 @@ getOpName(slotId: number, callback: AsyncCallback<string\>): void
Obtains the OpName of the SIM card in the specified slot. This API uses an asynchronous callback to return the result. Obtains the OpName of the SIM card in the specified slot. This API uses an asynchronous callback to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
**Parameters** **Parameters**
...@@ -2742,8 +2736,6 @@ getOpName(slotId: number): Promise<string\> ...@@ -2742,8 +2736,6 @@ getOpName(slotId: number): Promise<string\>
Obtains the OpName of the SIM card in the specified slot. This API uses a promise to return the result. Obtains the OpName of the SIM card in the specified slot. This API uses a promise to return the result.
**System API**: This is a system API.
**System capability**: SystemCapability.Telephony.CoreService **System capability**: SystemCapability.Telephony.CoreService
**Parameters** **Parameters**
......
...@@ -79,7 +79,7 @@ This is a system API. ...@@ -79,7 +79,7 @@ This is a system API.
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | ------------------------------------------------------------ | | -------- | --------------------- | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: clearing the default configuration| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: clearing the default configuration|
| callback | AsyncCallback\<void\> | Yes | Callback used to return the result. | | callback | AsyncCallback\<void\> | Yes | Callback used to return the result. |
**Example** **Example**
...@@ -90,6 +90,29 @@ data.setDefaultCellularDataSlotId(0,(err, data) => { ...@@ -90,6 +90,29 @@ data.setDefaultCellularDataSlotId(0,(err, data) => {
}); });
``` ```
## data.getDefaultCellularDataSlotIdSync
getDefaultCellularDataSlotIdSync(): number
Obtains the default SIM card used for mobile data.
**Required permission**: ohos.permission.GET_NETWORK_INFO
**System capability**: SystemCapability.Telephony.CellularData
**Return value**
| Type | Description |
| ------ | -------------------------------------------------- |
| number | Card slot ID.<br>**0**: card slot 1<br>**1**: card slot 2 |
**Example**
```js
console.log("Result: "+ data.getDefaultCellularDataSlotIdSync())
```
## data.setDefaultCellularDataSlotId ## data.setDefaultCellularDataSlotId
setDefaultCellularDataSlotId(slotId: number): Promise\<void\> setDefaultCellularDataSlotId(slotId: number): Promise\<void\>
...@@ -104,13 +127,13 @@ This is a system API. ...@@ -104,13 +127,13 @@ This is a system API.
**Parameters** **Parameters**
| Name| Type | Mandatory| Description | | Name| Type | Mandatory| Description |
| ------ | ------ | ---- | ------------------------------------------------------------ | | ------ | ------ | ---- | ------------------------------------------------------------ |
| slotId | number | Yes | SIM card slot ID. <br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: clearing the default configuration| | slotId | number | Yes | Card slot ID.<br>- **0**: card slot 1<br>- **1**: card slot 2<br>- **-1**: clearing the default configuration|
**Return value** **Return value**
| Type | Description | | Type | Description |
| -------------- | ------------------------------- | | -------------- | ------------------------------- |
| Promise<\void\> | Promise used to return the result. | | Promise<\void\> | Promise used to return the result. |
...@@ -135,7 +158,7 @@ Obtains the cellular data flow type, which can be uplink or downlink. This API u ...@@ -135,7 +158,7 @@ Obtains the cellular data flow type, which can be uplink or downlink. This API u
**Parameters** **Parameters**
| Name | Type | Mandatory| Description | | Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | ---------- | | -------- | ---------------------------------------------- | ---- | ---------- |
| callback | AsyncCallback\<[DataFlowType](#dataflowtype)\> | Yes | Callback used to return the result.| | callback | AsyncCallback\<[DataFlowType](#dataflowtype)\> | Yes | Callback used to return the result.|
...@@ -204,7 +227,7 @@ Obtains the connection status of the PS domain. This API uses a promise to retur ...@@ -204,7 +227,7 @@ Obtains the connection status of the PS domain. This API uses a promise to retur
**Return value** **Return value**
| Type | Description | | Type | Description |
| ------------------------------------------------ | ------------------------------------- | | ------------------------------------------------ | ------------------------------------- |
| Promise\<[DataConnectState](#dataconnectstate)\> | Promise used to return the result.| | Promise\<[DataConnectState](#dataconnectstate)\> | Promise used to return the result.|
......
...@@ -7,7 +7,7 @@ There are two types of updates: SD card update and over the air (OTA) update. ...@@ -7,7 +7,7 @@ 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:** > **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 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.
> >
...@@ -43,13 +43,13 @@ Obtains an **OnlineUpdater** object. ...@@ -43,13 +43,13 @@ Obtains an **OnlineUpdater** object.
```ts ```ts
try { try {
var upgradeInfo = { const upgradeInfo = {
upgradeApp: "com.ohos.ota.updateclient", upgradeApp: "com.ohos.ota.updateclient",
businessType: { businessType: {
vendor: update.BusinessVendor.PUBLIC, vendor: update.BusinessVendor.PUBLIC,
subType: update.BusinessSubType.FIRMWARE subType: update.BusinessSubType.FIRMWARE
} }
} };
let updater = update.getOnlineUpdater(upgradeInfo); let updater = update.getOnlineUpdater(upgradeInfo);
} catch(error) { } catch(error) {
console.error(`Fail to get updater error: ${error}`); console.error(`Fail to get updater error: ${error}`);
...@@ -226,22 +226,22 @@ Obtains the description file of the new version. This API uses an asynchronous c ...@@ -226,22 +226,22 @@ Obtains the description file of the new version. This API uses an asynchronous c
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------------------ | ---------------------------------------- | ---- | -------------- | | ------------------ | ---------------------------------------- | ---- | -------------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file. | | descriptionOptions | [DescriptionOptions](#descriptionoptions) | Yes | Options of the description file. |
| callback | AsyncCallback\<Array\<[ComponentDescription](#componentdescription)>>) | Yes | Callback used to return the result.| | callback | AsyncCallback\<Array\<[ComponentDescription](#componentdescription)>>) | Yes | Callback used to return the result.|
**Example** **Example**
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Options of the description file // Options of the description file
var descriptionOptions = { const descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese language: "zh-cn" // Chinese
} };
updater.getNewVersionDescription(versionDigestInfo, descriptionOptions, (err, info) => { updater.getNewVersionDescription(versionDigestInfo, descriptionOptions, (err, info) => {
console.log(`getNewVersionDescription info ${JSON.stringify(info)}`); console.log(`getNewVersionDescription info ${JSON.stringify(info)}`);
...@@ -276,15 +276,15 @@ Obtains the description file of the new version. This API uses a promise to retu ...@@ -276,15 +276,15 @@ Obtains the description file of the new version. This API uses a promise to retu
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Options of the description file // Options of the description file
var descriptionOptions = { const descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese language: "zh-cn" // Chinese
} };
updater.getNewVersionDescription(versionDigestInfo, descriptionOptions).then(info => { updater.getNewVersionDescription(versionDigestInfo, descriptionOptions).then(info => {
console.log(`getNewVersionDescription promise info ${JSON.stringify(info)}`); console.log(`getNewVersionDescription promise info ${JSON.stringify(info)}`);
...@@ -368,10 +368,10 @@ Obtains the description file of the current version. This API uses an asynchrono ...@@ -368,10 +368,10 @@ Obtains the description file of the current version. This API uses an asynchrono
```ts ```ts
// Options of the description file // Options of the description file
var descriptionOptions = { const descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese language: "zh-cn" // Chinese
} };
updater.getCurrentVersionDescription(descriptionOptions, (err, info) => { updater.getCurrentVersionDescription(descriptionOptions, (err, info) => {
console.log(`getCurrentVersionDescription info ${JSON.stringify(info)}`); console.log(`getCurrentVersionDescription info ${JSON.stringify(info)}`);
...@@ -405,10 +405,10 @@ Obtains the description file of the current version. This API uses a promise to ...@@ -405,10 +405,10 @@ Obtains the description file of the current version. This API uses a promise to
```ts ```ts
// Options of the description file // Options of the description file
var descriptionOptions = { const descriptionOptions = {
format: DescriptionFormat.STANDARD, // Standard format format: update.DescriptionFormat.STANDARD, // Standard format
language: "zh-cn" // Chinese language: "zh-cn" // Chinese
} };
updater.getCurrentVersionDescription(descriptionOptions).then(info => { updater.getCurrentVersionDescription(descriptionOptions).then(info => {
console.log(`getCurrentVersionDescription promise info ${JSON.stringify(info)}`); console.log(`getCurrentVersionDescription promise info ${JSON.stringify(info)}`);
...@@ -483,21 +483,21 @@ Downloads the new version. This API uses an asynchronous callback to return the ...@@ -483,21 +483,21 @@ Downloads the new version. This API uses an asynchronous callback to return the
| ----------------- | --------------------------------------- | ---- | ---------------------------------- | | ----------------- | --------------------------------------- | ---- | ---------------------------------- |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| downloadOptions | [DownloadOptions](#downloadoptions) | Yes | Download options. | | downloadOptions | [DownloadOptions](#downloadoptions) | Yes | Download options. |
| callback | AsyncCallback\<void> | Yes | Callback invoked 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**
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Download options // Download options
var downloadOptions = { const downloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
order: update.Order.DOWNLOAD // Download order: update.Order.DOWNLOAD // Download
} };
updater.download(versionDigestInfo, downloadOptions, (err) => { updater.download(versionDigestInfo, downloadOptions, (err) => {
console.log(`download error ${JSON.stringify(err)}`); console.log(`download error ${JSON.stringify(err)}`);
}); });
...@@ -524,21 +524,21 @@ Downloads the new version. This API uses a promise to return the result. ...@@ -524,21 +524,21 @@ Downloads the new version. This API uses a promise to return the result.
| Type | Description | | Type | Description |
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise Promise that returns no value.|
**Example** **Example**
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Download options // Download options
var downloadOptions = { const downloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
order: update.Order.DOWNLOAD // Download order: update.Order.DOWNLOAD // Download
} };
updater.download(versionDigestInfo, downloadOptions).then(() => { updater.download(versionDigestInfo, downloadOptions).then(() => {
console.log(`download start`); console.log(`download start`);
}).catch(err => { }).catch(err => {
...@@ -562,20 +562,20 @@ Resumes download of the new version. This API uses an asynchronous callback to r ...@@ -562,20 +562,20 @@ Resumes download of the new version. This API uses an asynchronous callback to r
| --------------------- | ---------------------------------------- | ---- | ------------------------------------ | | --------------------- | ---------------------------------------- | ---- | ------------------------------------ |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes | Options for resuming download. | | resumeDownloadOptions | [ResumeDownloadOptions](#resumedownloadoptions) | Yes | Options for resuming download. |
| callback | AsyncCallback\<void> | Yes | Callback invoked 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**
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Options for resuming download // Options for resuming download
var resumeDownloadOptions = { const resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
} };
updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err) => { updater.resumeDownload(versionDigestInfo, resumeDownloadOptions, (err) => {
console.log(`resumeDownload error ${JSON.stringify(err)}`); console.log(`resumeDownload error ${JSON.stringify(err)}`);
}); });
...@@ -608,14 +608,14 @@ Resumes download of the new version. This API uses a promise to return the resul ...@@ -608,14 +608,14 @@ Resumes download of the new version. This API uses a promise to return the resul
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Options for resuming download // Options for resuming download
var resumeDownloadOptions = { const resumeDownloadOptions = {
allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network allowNetwork: update.NetType.CELLULAR, // Whether to allow download over data network
} };
updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then(value => { updater.resumeDownload(versionDigestInfo, resumeDownloadOptions).then(value => {
console.log(`resumeDownload start`); console.log(`resumeDownload start`);
}).catch(err => { }).catch(err => {
...@@ -639,20 +639,20 @@ Pauses download of the new version. This API uses an asynchronous callback to re ...@@ -639,20 +639,20 @@ Pauses download of the new version. This API uses an asynchronous callback to re
| -------------------- | ---------------------------------------- | ---- | ------------------------------------ | | -------------------- | ---------------------------------------- | ---- | ------------------------------------ |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes | Options for pausing download. | | pauseDownloadOptions | [PauseDownloadOptions](#pausedownloadoptions) | Yes | Options for pausing download. |
| callback | AsyncCallback\<void> | Yes | Callback invoked 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**
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Options for pausing download // Options for pausing download
var pauseDownloadOptions = { const pauseDownloadOptions = {
isAllowAutoResume: true // Whether to allow automatic resuming of download isAllowAutoResume: true // Whether to allow automatic resuming of download
} };
updater.pauseDownload(versionDigestInfo, pauseDownloadOptions, (err) => { updater.pauseDownload(versionDigestInfo, pauseDownloadOptions, (err) => {
console.log(`pauseDownload error ${JSON.stringify(err)}`); console.log(`pauseDownload error ${JSON.stringify(err)}`);
}); });
...@@ -685,14 +685,14 @@ Resumes download of the new version. This API uses a promise to return the resul ...@@ -685,14 +685,14 @@ Resumes download of the new version. This API uses a promise to return the resul
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Options for pausing download // Options for pausing download
var pauseDownloadOptions = { const pauseDownloadOptions = {
isAllowAutoResume: true // Whether to allow automatic resuming of download isAllowAutoResume: true // Whether to allow automatic resuming of download
} };
updater.pauseDownload(versionDigestInfo, pauseDownloadOptions).then(value => { updater.pauseDownload(versionDigestInfo, pauseDownloadOptions).then(value => {
console.log(`pauseDownload`); console.log(`pauseDownload`);
}).catch(err => { }).catch(err => {
...@@ -716,20 +716,20 @@ Updates the version. This API uses an asynchronous callback to return the result ...@@ -716,20 +716,20 @@ Updates the version. This API uses an asynchronous callback to return the result
| ----------------- | --------------------------------------- | ---- | ------------------------------------ | | ----------------- | --------------------------------------- | ---- | ------------------------------------ |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| upgradeOptions | [UpgradeOptions](#upgradeoptions) | Yes | Update options. | | upgradeOptions | [UpgradeOptions](#upgradeoptions) | Yes | Update options. |
| callback | AsyncCallback\<void> | Yes | Callback invoked 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**
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Installation options // Installation options
var upgradeOptions = { const upgradeOptions = {
order: update.Order.INSTALL // Installation command order: update.Order.INSTALL // Installation command
} };
updater.upgrade(versionDigestInfo, upgradeOptions, (err) => { updater.upgrade(versionDigestInfo, upgradeOptions, (err) => {
console.log(`upgrade error ${JSON.stringify(err)}`); console.log(`upgrade error ${JSON.stringify(err)}`);
}); });
...@@ -762,14 +762,14 @@ Updates the version. This API uses a promise to return the result. ...@@ -762,14 +762,14 @@ Updates the version. This API uses a promise to return the result.
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Installation options // Installation options
var upgradeOptions = { const upgradeOptions = {
order: update.Order.INSTALL // Installation command order: update.Order.INSTALL // Installation command
} };
updater.upgrade(versionDigestInfo, upgradeOptions).then(() => { updater.upgrade(versionDigestInfo, upgradeOptions).then(() => {
console.log(`upgrade start`); console.log(`upgrade start`);
}).catch(err => { }).catch(err => {
...@@ -793,20 +793,20 @@ Clears errors. This API uses an asynchronous callback to return the result. ...@@ -793,20 +793,20 @@ Clears errors. This API uses an asynchronous callback to return the result.
| ----------------- | --------------------------------------- | ---- | ------------------------------------ | | ----------------- | --------------------------------------- | ---- | ------------------------------------ |
| versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. | | versionDigestInfo | [VersionDigestInfo](#versiondigestinfo) | Yes | Version digest information. |
| clearOptions | [ClearOptions](#clearoptions) | Yes | Clear options. | | clearOptions | [ClearOptions](#clearoptions) | Yes | Clear options. |
| callback | AsyncCallback\<void> | Yes | Callback invoked 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**
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Options for clearing errors // Options for clearing errors
var clearOptions = { const clearOptions = {
status: update.UpgradeStatus.UPGRADE_FAIL, status: update.UpgradeStatus.UPGRADE_FAIL,
} };
updater.clearError(versionDigestInfo, clearOptions, (err) => { updater.clearError(versionDigestInfo, clearOptions, (err) => {
console.log(`clearError error ${JSON.stringify(err)}`); console.log(`clearError error ${JSON.stringify(err)}`);
}); });
...@@ -839,14 +839,14 @@ Clears errors. This API uses a promise to return the result. ...@@ -839,14 +839,14 @@ Clears errors. This API uses a promise to return the result.
```ts ```ts
// Version digest information // Version digest information
var versionDigestInfo = { const versionDigestInfo = {
versionDigest: "versionDigest" // Version digest information in the check result versionDigest: "versionDigest" // Version digest information in the check result
} };
// Options for clearing errors // Options for clearing errors
var clearOptions = { lconstet clearOptions = {
status: update.UpgradeStatus.UPGRADE_FAIL, status: update.UpgradeStatus.UPGRADE_FAIL,
} };
updater.clearError(versionDigestInfo, clearOptions).then(() => { updater.clearError(versionDigestInfo, clearOptions).then(() => {
console.log(`clearError success`); console.log(`clearError success`);
}).catch(err => { }).catch(err => {
...@@ -926,11 +926,11 @@ Sets the update policy. This API uses an asynchronous callback to return the res ...@@ -926,11 +926,11 @@ Sets the update policy. This API uses an asynchronous callback to return the res
**Example** **Example**
```ts ```ts
let policy = { const policy = {
downloadStrategy: false, downloadStrategy: false,
autoUpgradeStrategy: false, autoUpgradeStrategy: false,
autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes
} };
updater.setUpgradePolicy(policy, (err) => { updater.setUpgradePolicy(policy, (err) => {
console.log(`setUpgradePolicy result: ${err}`); console.log(`setUpgradePolicy result: ${err}`);
}); });
...@@ -961,11 +961,11 @@ Sets the update policy. This API uses a promise to return the result. ...@@ -961,11 +961,11 @@ Sets the update policy. This API uses a promise to return the result.
**Example** **Example**
```ts ```ts
let policy = { const policy = {
downloadStrategy: false, downloadStrategy: false,
autoUpgradeStrategy: false, autoUpgradeStrategy: false,
autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes autoUpgradePeriods: [ { start: 120, end: 240 } ] // Automatic update period, in minutes
} };
updater.setUpgradePolicy(policy).then(() => { updater.setUpgradePolicy(policy).then(() => {
console.log(`setUpgradePolicy success`); console.log(`setUpgradePolicy success`);
}).catch(err => { }).catch(err => {
...@@ -987,7 +987,7 @@ Terminates the update. This API uses an asynchronous callback to return the resu ...@@ -987,7 +987,7 @@ Terminates the update. This API uses an asynchronous callback to return the resu
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | -------------------------------------- | | -------- | -------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback\<void> | Yes | Callback invoked 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**
...@@ -1041,10 +1041,10 @@ Enables listening for update events. This API uses an asynchronous callback to r ...@@ -1041,10 +1041,10 @@ Enables listening for update events. This API uses an asynchronous callback to r
**Example** **Example**
```ts ```ts
var eventClassifyInfo = { const eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // Listening for update events eventClassify: update.EventClassify.TASK, // Listening for update events
extraInfo: "" extraInfo: ""
} };
updater.on(eventClassifyInfo, (eventInfo) => { updater.on(eventClassifyInfo, (eventInfo) => {
console.log("updater on " + JSON.stringify(eventInfo)); console.log("updater on " + JSON.stringify(eventInfo));
...@@ -1068,10 +1068,10 @@ Disables listening for update events. This API uses an asynchronous callback to ...@@ -1068,10 +1068,10 @@ Disables listening for update events. This API uses an asynchronous callback to
**Example** **Example**
```ts ```ts
var eventClassifyInfo = { const eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // Listening for update events eventClassify: update.EventClassify.TASK, // Listening for update events
extraInfo: "" extraInfo: ""
} };
updater.off(eventClassifyInfo, (eventInfo) => { updater.off(eventClassifyInfo, (eventInfo) => {
console.log("updater off " + JSON.stringify(eventInfo)); console.log("updater off " + JSON.stringify(eventInfo));
...@@ -1084,7 +1084,7 @@ updater.off(eventClassifyInfo, (eventInfo) => { ...@@ -1084,7 +1084,7 @@ updater.off(eventClassifyInfo, (eventInfo) => {
factoryReset(callback: AsyncCallback\<void>): void factoryReset(callback: AsyncCallback\<void>): void
Restore the device to its factory settings. This API uses an asynchronous callback to return the result. Restores the device to its factory settings. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
...@@ -1094,7 +1094,7 @@ Restore the device to its factory settings. This API uses an asynchronous callba ...@@ -1094,7 +1094,7 @@ Restore the device to its factory settings. This API uses an asynchronous callba
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | -------------------- | ---- | -------------------------------------- | | -------- | -------------------- | ---- | -------------------------------------- |
| callback | AsyncCallback\<void> | Yes | Callback invoked 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**
...@@ -1108,7 +1108,7 @@ restorer.factoryReset((err) => { ...@@ -1108,7 +1108,7 @@ restorer.factoryReset((err) => {
factoryReset(): Promise\<void> factoryReset(): Promise\<void>
Restore the device to its factory settings. This API uses a promise to return the result. Restores the device to its factory settings. This API uses a promise to return the result.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
...@@ -1118,7 +1118,7 @@ Restore the device to its factory settings. This API uses a promise to return th ...@@ -1118,7 +1118,7 @@ Restore the device to its factory settings. This API uses a promise to return th
| Type | Description | | Type | Description |
| -------------- | -------------------------- | | -------------- | -------------------------- |
| Promise\<void> | Promise that returns no value.| | Promise\<void> | Promise Promise that returns no value.|
**Example** **Example**
...@@ -1153,10 +1153,10 @@ Verifies the update package. This API uses an asynchronous callback to return th ...@@ -1153,10 +1153,10 @@ Verifies the update package. This API uses an asynchronous callback to return th
**Example** **Example**
```ts ```ts
var upgradeFile = { const upgradeFile = {
fileType: update.ComponentType.OTA, // OTA package fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package filePath: "path" // Path of the local update package
} };
localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath", (err) => { localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath", (err) => {
console.log(`factoryReset error ${JSON.stringify(err)}`); console.log(`factoryReset error ${JSON.stringify(err)}`);
...@@ -1189,10 +1189,10 @@ Verifies the update package. This API uses a promise to return the result. ...@@ -1189,10 +1189,10 @@ Verifies the update package. This API uses a promise to return the result.
**Example** **Example**
```ts ```ts
var upgradeFile = { const upgradeFile = {
fileType: update.ComponentType.OTA, // OTA package fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package filePath: "path" // Path of the local update package
} };
localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath").then(() => { localUpdater.verifyUpgradePackage(upgradeFile, "cerstFilePath").then(() => {
console.log(`verifyUpgradePackage success`); console.log(`verifyUpgradePackage success`);
}).catch(err => { }).catch(err => {
...@@ -1214,15 +1214,15 @@ Installs the update package. This API uses an asynchronous callback to return th ...@@ -1214,15 +1214,15 @@ Installs the update package. This API uses an asynchronous callback to return th
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ----------- | ---------------------------------- | ---- | --------------------------------------- | | ----------- | ---------------------------------- | ---- | --------------------------------------- |
| upgradeFile | Array<[UpgradeFile](#upgradefile)> | Yes | Update file. | | upgradeFile | Array<[UpgradeFile](#upgradefile)> | Yes | Update file. |
| callback | AsyncCallback\<void> | Yes | Callback invoked 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**
```ts ```ts
var upgradeFiles = [{ const upgradeFiles = [{
fileType: update.ComponentType.OTA, // OTA package fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package filePath: "path" // Path of the local update package
}] }];
localUpdater.applyNewVersion(upgradeFiles, (err) => { localUpdater.applyNewVersion(upgradeFiles, (err) => {
console.log(`applyNewVersion error ${JSON.stringify(err)}`); console.log(`applyNewVersion error ${JSON.stringify(err)}`);
...@@ -1248,10 +1248,10 @@ Installs the update package. This API uses a promise to return the result. ...@@ -1248,10 +1248,10 @@ Installs the update package. This API uses a promise to return the result.
**Example** **Example**
```ts ```ts
var upgradeFiles = [{ localUpdater upgradeFiles = [{
fileType: update.ComponentType.OTA, // OTA package fileType: update.ComponentType.OTA, // OTA package
filePath: "path" // Path of the local update package filePath: "path" // Path of the local update package
}] }];
localUpdater.applyNewVersion(upgradeFiles).then(() => { localUpdater.applyNewVersion(upgradeFiles).then(() => {
console.log(`applyNewVersion success`); console.log(`applyNewVersion success`);
}).catch(err => { }).catch(err => {
...@@ -1276,10 +1276,10 @@ Enables listening for update events. This API uses an asynchronous callback to r ...@@ -1276,10 +1276,10 @@ Enables listening for update events. This API uses an asynchronous callback to r
**Example** **Example**
```ts ```ts
var eventClassifyInfo = { const eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // Listening for update events eventClassify: update.EventClassify.TASK, // Listening for update events
extraInfo: "" extraInfo: ""
} };
function onTaskUpdate(eventInfo) { function onTaskUpdate(eventInfo) {
console.log(`on eventInfo id `, eventInfo.eventId); console.log(`on eventInfo id `, eventInfo.eventId);
...@@ -1305,10 +1305,10 @@ Disables listening for update events. This API uses an asynchronous callback to ...@@ -1305,10 +1305,10 @@ Disables listening for update events. This API uses an asynchronous callback to
**Example** **Example**
```ts ```ts
var eventClassifyInfo = { const eventClassifyInfo = {
eventClassify: update.EventClassify.TASK, // Listening for update events eventClassify: update.EventClassify.TASK, // Listening for update events
extraInfo: "" extraInfo: ""
} };
function onTaskUpdate(eventInfo) { function onTaskUpdate(eventInfo) {
console.log(`on eventInfo id `, eventInfo.eventId); console.log(`on eventInfo id `, eventInfo.eventId);
...@@ -1337,7 +1337,7 @@ Enumerates update service types. ...@@ -1337,7 +1337,7 @@ Enumerates update service types.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------- | ----------------------------------- | ---- | ---- | | ------- | ----------------------------------- | ---- | ---- |
| vendor | [BusinessVendor](#businessvendor) | Yes | Application vendor. | | vendor | [BusinessVendor](#businessvendor) | Yes | Application vendor. |
| subType | [BusinessSubType](#businesssubtype) | Yes | Type | | subType | [BusinessSubType](#businesssubtype) | Yes | Update service type. |
## CheckResult ## CheckResult
...@@ -1377,11 +1377,11 @@ Represents a version component. ...@@ -1377,11 +1377,11 @@ Represents a version component.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
| Parameter | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------------- | ----------------------------------- | ---- | -------- | | --------------- | ----------------------------------- | ---- | -------- |
| componentId | string | Yes | Component ID. | | componentId | string | Yes | Component ID. |
| componentType | [ComponentType](#componenttype) | Yes | Component type. | | componentType | [ComponentType](#componenttype) | Yes | Color component type. |
| upgradeAction | [UpgradeAction](#upgradeaction) | Yes | Update mode. | | upgradeAction | [UpgradeAction](#upgradeaction) | Yes | Represents an update mode. |
| displayVersion | string | Yes | Display version number. | | displayVersion | string | Yes | Display version number. |
| innerVersion | string | Yes | Internal version number. | | innerVersion | string | Yes | Internal version number. |
| size | number | Yes | Update package size. | | size | number | Yes | Update package size. |
...@@ -1498,7 +1498,7 @@ Represents an update policy. ...@@ -1498,7 +1498,7 @@ Represents an update policy.
## UpgradePeriod ## UpgradePeriod
Represents a period for automatic update. Represents an automatic update period.
**System capability**: SystemCapability.Update.UpdateService **System capability**: SystemCapability.Update.UpdateService
...@@ -1516,7 +1516,7 @@ Represents task information. ...@@ -1516,7 +1516,7 @@ Represents task information.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| --------- | --------------------- | ---- | ------ | | --------- | --------------------- | ---- | ------ |
| existTask | bool | Yes | Whether a task exists.| | existTask | bool | Yes | Whether a task exists.|
| taskBody | [TaskBody](#taskinfo) | Yes | Task data. | | taskBody | [TaskBody](#taskinfo) | Yes | Represents task data. |
## EventInfo ## EventInfo
...@@ -1526,7 +1526,7 @@ Represents event type information. ...@@ -1526,7 +1526,7 @@ Represents event type information.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| -------- | --------------------- | ---- | ---- | | -------- | --------------------- | ---- | ---- |
| eventId | [EventId](#eventid) | Yes | Event ID.| | eventId | [EventId](#eventid) | Yes | Enumerates event IDs.|
| taskBody | [TaskBody](#taskinfo) | Yes | Task data.| | taskBody | [TaskBody](#taskinfo) | Yes | Task data.|
## TaskBody ## TaskBody
...@@ -1554,7 +1554,7 @@ Represents an error message. ...@@ -1554,7 +1554,7 @@ Represents an error message.
| Name | Type | Mandatory | Description | | Name | Type | Mandatory | Description |
| ------------ | ------ | ---- | ---- | | ------------ | ------ | ---- | ---- |
| errorCode | number | Yes | Error code. | | errorCode | number | Yes | Error code. |
| errorMessage | string | Yes | Error description.| | errorMessage | string | Yes | Error message.|
## EventClassifyInfo ## EventClassifyInfo
...@@ -1580,7 +1580,7 @@ Represents an update file. ...@@ -1580,7 +1580,7 @@ Represents an update file.
## UpgradeTaskCallback ## UpgradeTaskCallback
### (eventInfo: [EventInfo](#eventinfo)): void (eventInfo: EventInfo): void
Represents an event callback. Represents an event callback.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册