diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d33521af10bcc7fd8cea344038eaaeb78d0ef5..0000000000000000000000000000000000000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/docs.iml b/.idea/docs.iml
deleted file mode 100644
index d6ebd4805981b8400db3e3291c74a743fef9a824..0000000000000000000000000000000000000000
--- a/.idea/docs.iml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index 87ea532768b38bd5204c0ec5698088effb68bc8a..0000000000000000000000000000000000000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 6049cfe013e0d2ef3f5f29c1b34b880e9d498ef0..0000000000000000000000000000000000000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1ddfbbc029bcab630581847471d7f238ec53..0000000000000000000000000000000000000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/OAT.xml b/OAT.xml
index 59b222c66c936f6d1284c6d1cded6f8cc95f1e25..23f7ee1c6a4bbd0a0fc4e65dd810fc904ced5005 100644
--- a/OAT.xml
+++ b/OAT.xml
@@ -38,13 +38,13 @@
-
+
-
+
diff --git a/en/application-dev/ability/ability-assistant-guidelines.md b/en/application-dev/ability/ability-assistant-guidelines.md
index 09fd374061b2288f851360259bacbec7b54ffaf7..4d7b0edb2b91ca07123ad7495f4d64fc2f525e1d 100644
--- a/en/application-dev/ability/ability-assistant-guidelines.md
+++ b/en/application-dev/ability/ability-assistant-guidelines.md
@@ -65,18 +65,18 @@ The ability assistant enables you to start applications, atomic services, and te
- **dump**
- Prints ability related information.
+ Prints ability-related information.
| Name | Level-2 Parameter | Description |
| ----------------- | -------------------- | ------------------------------------------------------------ |
| -h/--help | - | Prints help information. |
| -a/--all | - | Prints ability information in all missions. |
- | -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| Prints mission stack information. The following values are available for **type**: NORMAL DEFAULT_STANDARD DEFAULT_SINGLE LAUNCHER |
+ | -l/--mission-list | type (All logs are printed if this parameter is left unspecified.)| Prints mission stack information. The following values are available for **type**: - NORMAL - DEFAULT_STANDARD - DEFAULT_SINGLE - LAUNCHER |
| -e/--extension | elementName | Prints extended component information. |
- | -u/--userId | UserId | Prints stack information of a specified user ID. This parameter must be used together with other parameters. Example commands: aa **dump -a -u 100** and **aa dump -d -u 100**.|
+ | -u/--userId | UserId | Prints stack information of a specified user ID. This parameter must be used together with other parameters. Example commands: aa **dump -a -u 100** and **aa dump -d -u 100**. |
| -d/--data | - | Prints Data ability information. |
| -i/--ability | AbilityRecord ID | Prints detailed information about a specified ability. |
- | -c/--client | - | Prints detailed ability information. This parameter must be used together with other parameters. Example commands: **aa dump -a -c** and **aa dump -i 21 -c**.|
+ | -c/--client | - | Prints detailed ability information. This parameter must be used together with other parameters. Example commands: **aa dump -a -c** and **aa dump -i 21 -c**. |
**Method**
diff --git a/en/application-dev/ability/ability-brief.md b/en/application-dev/ability/ability-brief.md
index dee25352d7df1e828eada909bde107554a168bd9..283037aedc8c219bee48511898dd300a0c05dc3b 100644
--- a/en/application-dev/ability/ability-brief.md
+++ b/en/application-dev/ability/ability-brief.md
@@ -13,7 +13,7 @@ The stage model is designed to make it easier to develop complex applications in
| -------------- | ------------------------------------------------------------ | -------------------------------------------------------- |
| Development mode | Web-like APIs are provided. The UI development is the same as that of the stage model. | Object-oriented development mode is provided. The UI development is the same as that of the FA model. |
| Engine instance | Each ability in a process exclusively uses a JS VM engine instance. | Multiple abilities in a process share one JS VM engine instance. |
-| Intra-process object sharing| Not supported | Supported |
+| Intra-process object sharing| Not supported. | Supported. |
| Bundle description file | The `config.json` file is used to describe the HAP and component information. Each component must use a fixed file name.| The `module.json` file is used to describe the HAP and component information. The entry file name can be specified.|
| Component | Four types of components are provided: Page ability (used for UI page display), Service ability (used to provide services), Data ability (used for data sharing), and Form ability (used to provide widgets).| Two types of components are provided: Ability (used for UI page display) and Extension (scenario-based service extension). |
diff --git a/en/application-dev/ability/fa-serviceability.md b/en/application-dev/ability/fa-serviceability.md
index ef62358595f235aeae23d1f4b0bb63cb77936537..72b4542e19a675d3531948e07375d491fb001c63 100644
--- a/en/application-dev/ability/fa-serviceability.md
+++ b/en/application-dev/ability/fa-serviceability.md
@@ -238,7 +238,7 @@ You can use either of the following methods to connect to a Service ability:
}
```
-### Connecting to a Remote Service Ability (Applying only to System Applications)
+### Connecting to a Remote Service Ability
>**NOTE**
>
diff --git a/en/application-dev/ability/stage-ability.md b/en/application-dev/ability/stage-ability.md
index 91e7d1132a048a74ab168208d5f2212683350b78..011951ac5073aaec023c7c27aad3fe13dd1a7392 100644
--- a/en/application-dev/ability/stage-ability.md
+++ b/en/application-dev/ability/stage-ability.md
@@ -1,19 +1,19 @@
# Ability Development
## When to Use
-Unlike the FA model, the [stage model](stage-brief.md) requires you to declare the application package structure in the `module.json` and `app.json` files during application development. For details about the configuration file, see [Application Package Structure Configuration File](../quick-start/stage-structure.md). To develop abilities based on the stage model, implement the following logic:
-- Create abilities for an application that involves screen viewing and human-machine interaction. You must implement the following scenarios: ability lifecycle callbacks, obtaining ability configuration, requesting permissions, and notifying environment changes.
+Ability development in the [stage model](stage-brief.md) is significantly different from that in the FA model. The stage model requires you to declare the application package structure in the `module.json` and `app.json` files during application development. For details about the configuration file, see [Application Package Structure Configuration File](../quick-start/stage-structure.md). To develop an ability based on the stage model, implement the following logic:
+- Create an ability that supports screen viewing and human-machine interaction. You must implement the following scenarios: ability lifecycle callbacks, obtaining ability configuration, requesting permissions, and notifying environment changes.
- Start an ability. You need to implement ability startup on the same device, on a remote device, or with a specified UI page.
- Call abilities. For details, see [Call Development](stage-call.md).
- Connect to and disconnect from a Service Extension ability. For details, see [Service Extension Ability Development](stage-serviceextension.md).
- Continue the ability on another device. For details, see [Ability Continuation Development](stage-ability-continuation.md).
### Launch Type
-The ability supports three launch types: singleton, multi-instance, and instance-specific. Each launch type, specified by `launchType` in the `module.json` file, specifies the action that can be performed when the ability is started.
+An ability can be launched in the **standard**, **singleton**, or **specified** mode, as configured by `launchType` in the `module.json` file. Depending on the launch type, the action performed when the ability is started differs, as described below.
-| Launch Type | Description |Description |
+| Launch Type | Description |Action |
| ----------- | ------- |---------------- |
| standard | Multi-instance | A new instance is started each time an ability starts.|
-| singleton | Singleton | Only one instance exists in the system. If an instance already exists when an ability is started, that instance is reused.|
+| singleton | Singleton | The ability has only one instance in the system. If an instance already exists when an ability is started, that instance is reused.|
| specified | Instance-specific| The internal service of an ability determines whether to create multiple instances during running.|
By default, the singleton mode is used. The following is an example of the `module.json` file:
@@ -78,29 +78,29 @@ To create Page abilities for an application in the stage model, you must impleme
onCreate(want, launchParam) {
console.log("MainAbility onCreate")
}
-
+
onDestroy() {
console.log("MainAbility onDestroy")
}
-
+
onWindowStageCreate(windowStage) {
console.log("MainAbility onWindowStageCreate")
-
+
windowStage.loadContent("pages/index").then((data) => {
console.log("MainAbility load content succeed with data: " + JSON.stringify(data))
}).catch((error) => {
console.error("MainAbility load content failed with error: " + JSON.stringify(error))
})
}
-
+
onWindowStageDestroy() {
console.log("MainAbility onWindowStageDestroy")
}
-
+
onForeground() {
console.log("MainAbility onForeground")
}
-
+
onBackground() {
console.log("MainAbility onBackground")
}
@@ -145,9 +145,9 @@ export default class MainAbility extends Ability {
}
```
### Requesting Permissions
-If an application needs to obtain user privacy information or use system capabilities, for example, obtaining location information or using the camera to take photos or record videos, it must request the permission from consumers. During application development, you need to specify the involved sensitive permissions, declare the required permissions in `module.json`, and use the `requestPermissionsFromUser` API to request the permission from consumers in the form of a dialog box. The following uses the permissions for calendar access as an example.
+If an application needs to obtain user privacy information or use system capabilities, for example, obtaining location information or using the camera to take photos or record videos, it must request the respective permission from consumers. During application development, you need to specify the involved sensitive permissions, declare the required permissions in `module.json`, and use the `requestPermissionsFromUser` API to request the permission from consumers in the form of a dialog box. The following uses the permission for calendar access as an example.
-Declare the required permissions in the `module.json` file.
+Declare the required permission in the `module.json` file.
```json
"requestPermissions": [
{
@@ -155,7 +155,7 @@ Declare the required permissions in the `module.json` file.
}
]
```
-Request the permissions from consumers in the form of a dialog box:
+Request the permission from consumers in the form of a dialog box:
```ts
let context = this.context
let permissions: Array = ['ohos.permission.READ_CALENDAR']
@@ -166,11 +166,11 @@ context.requestPermissionsFromUser(permissions).then((data) => {
})
```
### Notifying of Environment Changes
-Environment changes include changes of global configurations and ability configurations. Currently, the global configurations include the system language and color mode. The change of global configurations is generally triggered by the configuration item in **Settings** or the icon in **Control Panel**. The ability configuration is specific to a single `Ability` instance, including the display ID, screen resolution, and screen orientation. The configuration is related to the display where the ability is located, and the change is generally triggered by the window. For details on the configuration, see [Configuration](../reference/apis/js-apis-configuration.md).
+Environment changes include changes of global configurations and ability configurations. Currently, the global configurations include the system language and color mode. The change of global configurations is generally triggered by configuration items in **Settings** or icons in **Control Panel**. The ability configuration is specific to a single `Ability` instance, including the display ID, screen resolution, and screen orientation. The configuration is related to the display where the ability is located, and the change is generally triggered by the window. For details on the configuration, see [Configuration](../reference/apis/js-apis-configuration.md).
For an application in the stage model, when the configuration changes, its abilities are not restarted, but the `onConfigurationUpdated(config: Configuration)` callback is triggered. If the application needs to perform processing based on the change, you can overwrite `onConfigurationUpdated`. Note that the `Configuration` object in the callback contains all the configurations of the current ability, not only the changed configurations.
-The following example shows the implement of the `onConfigurationUpdated` callback in the `AbilityStage` class. The callback is triggered when the system language and color mode are changed.
+The following example shows the implementation of the `onConfigurationUpdated` callback in the `AbilityStage` class. The callback is triggered when the system language and color mode are changed.
```ts
import Ability from '@ohos.application.Ability'
import ConfigurationConstant from '@ohos.application.ConfigurationConstant'
@@ -184,7 +184,7 @@ export default class MyAbilityStage extends AbilityStage {
}
```
-The following example shows the implement of the `onConfigurationUpdated` callback in the `Ability` class. The callback is triggered when the system language, color mode, or display parameters (such as the direction and density) change.
+The following example shows the implementation of the `onConfigurationUpdated` callback in the `Ability` class. The callback is triggered when the system language, color mode, or display parameters (such as the direction and density) change.
```ts
import Ability from '@ohos.application.Ability'
import ConfigurationConstant from '@ohos.application.ConfigurationConstant'
@@ -205,7 +205,7 @@ export default class MainAbility extends Ability {
```
## Starting an Ability
### Available APIs
-The `Ability` class has the `context` attribute, which belongs to the `AbilityContext` class. The `AbilityContext` class has the `abilityInfo`, `currentHapModuleInfo`, and other attributes and the APIs used for starting abilities. For details, see [AbilityContext](../reference/apis/js-apis-ability-context.md).
+The `Ability` class has the `context` attribute, which belongs to the `AbilityContext` class. The `AbilityContext` class has the `abilityInfo`, `currentHapModuleInfo`, and other attributes as well as the APIs used for starting abilities. For details, see [AbilityContext](../reference/apis/js-apis-ability-context.md).
**Table 3** AbilityContext APIs
|API|Description|
@@ -235,9 +235,8 @@ context.startAbility(want).then((data) => {
```
### Starting an Ability on a Remote Device
-This feature applies only to system applications, since the `getTrustedDeviceListSync` API of the `DeviceManager` class is open only to system applications.
+>This feature applies only to system applications, since the `getTrustedDeviceListSync` API of the `DeviceManager` class is open only to system applications.
In the cross-device scenario, you must specify the ID of the remote device. The sample code is as follows:
-
```ts
let context = this.context
var want = {
@@ -268,7 +267,7 @@ function getRemoteDeviceId() {
}
}
```
-Request the permission `ohos.permission.DISTRIBUTED_DATASYNC ` from consumers. This permission is used for data synchronization. For details about the sample code for requesting the permission, see [Requesting Permissions](##requesting-permissions).
+Request the permission `ohos.permission.DISTRIBUTED_DATASYNC` from consumers. This permission is used for data synchronization. For details about the sample code for requesting the permission, see [Requesting Permissions](##requesting-permissions).
### Starting an Ability with the Specified Page
If the launch type of an ability is set to `singleton` and the ability has been started, the `onNewWant` callback is triggered when the ability is started again. You can pass start options through the `want`. For example, to start an ability with the specified page, use the `uri` or `parameters` parameter in the `want` to pass the page information. Currently, the ability in the stage model cannot directly use the `router` capability. You must pass the start options to the custom component and invoke the `router` method to display the specified page during the custom component lifecycle management. The sample code is as follows:
diff --git a/en/application-dev/ability/stage-brief.md b/en/application-dev/ability/stage-brief.md
index eb6b66c5507d0aab80d9d22576519f70aba351a2..0b4bfe8e3ec2943528e3bd2e8b640dea4ffbd070 100644
--- a/en/application-dev/ability/stage-brief.md
+++ b/en/application-dev/ability/stage-brief.md
@@ -8,7 +8,7 @@ The following figure shows the design ideas of the stage model.

- The stage model is designed based on the following considerations:
+The stage model is designed based on the following considerations:
- **Balance between application capabilities and overall system power consumption**
diff --git a/en/application-dev/ability/stage-formextension.md b/en/application-dev/ability/stage-formextension.md
index 3e19e5c756b9db4fc7d657fc4c1d9445d5835329..0a1b17b91cf2be48405e4e9681146f1017ffa93b 100644
--- a/en/application-dev/ability/stage-formextension.md
+++ b/en/application-dev/ability/stage-formextension.md
@@ -12,7 +12,8 @@ Basic concepts:
- Widget host: an application that displays the widget content and controls the position where the widget is displayed in the host application.
- Widget Manager: a resident agent that manages widgets added to the system and provides functions such as periodic widget update.
->  **NOTE**
+> **NOTE**
+>
> The widget host and provider do not keep running all the time. The Widget Manager starts the widget provider to obtain widget information when a widget is added, deleted, or updated.
You only need to develop widget content as the widget provider. The system automatically handles the work done by the widget host and Widget Manager.
@@ -187,7 +188,7 @@ To create a widget in the stage model, implement the lifecycle callbacks of **Fo
{
"forms": [{
"name": "widget",
- "description": "This is a service widget.",
+ "description": "This is a widget.",
"src": "./js/widget/pages/index/index",
"window": {
"autoDesignWidth": true,
diff --git a/en/application-dev/ability/stage-serviceextension.md b/en/application-dev/ability/stage-serviceextension.md
index 21640122c2a0ffbf63c072e5880707b31e895fd5..c6f6362a727855189a398b6b305312c45e6135b1 100644
--- a/en/application-dev/ability/stage-serviceextension.md
+++ b/en/application-dev/ability/stage-serviceextension.md
@@ -39,7 +39,7 @@ OpenHarmony does not support creation of a Service Extension ability for third-p
```
-2. Customize a class that inherits from **ServiceExtensionAbility** in the .ts file in the directory where the Service Extension ability is defined and overwrite the lifecycle callbacks of the base class. The code sample is as follows:
+2. Customize a class that inherits from **ServiceExtensionAbility** in the .ts file in the directory where the Service Extension ability is defined and override the lifecycle callbacks of the base class. The code sample is as follows:
```js
import rpc from '@ohos.rpc'
diff --git a/en/application-dev/device/Readme-EN.md b/en/application-dev/device/Readme-EN.md
index 41f8cf0de280706eff7ae88c051d50d18630f173..c006438a34418139129e23f475d059e274ca914d 100644
--- a/en/application-dev/device/Readme-EN.md
+++ b/en/application-dev/device/Readme-EN.md
@@ -13,6 +13,6 @@
- Vibrator
- [Vibrator Overview](vibrator-overview.md)
- [Vibrator Development](vibrator-guidelines.md)
-- Update Servcie
+- Update Service
- [Sample Server Overview](sample-server-overview.md)
- [Sample Server Development](sample-server-guidelines.md)
diff --git a/en/application-dev/internationalization/i18n-guidelines.md b/en/application-dev/internationalization/i18n-guidelines.md
index ab30a5bdbd54630e9f94e7f31bc00de5ca9cc984..244734770314757986733edc03b597894aa8e75e 100644
--- a/en/application-dev/internationalization/i18n-guidelines.md
+++ b/en/application-dev/internationalization/i18n-guidelines.md
@@ -4,7 +4,7 @@ This development guide describes how to use i18n APIs that are not defined in EC
## Obtaining System Language and Region Information
-APIs are provided to access the system language and region information.
+You can use APIs provided in the following table to obtain the system language and region information.
### Available APIs
@@ -344,14 +344,14 @@ When a text is displayed in more than one line, [BreakIterator](../reference/api
```
- var firstPos = breakIterator.first(); // Sets a BreakIterator object to the first break point, that is, the start position of the text.
- var lastPos = breakIterator.last(); // Sets a BreakIterator object to the last break point, that is, the position after the text end.
- // Moves a BreakIterator object forward or backward by a certain number of break points.
+ var firstPos = breakIterator.first(); // Set a BreakIterator object to the first break point, that is, the start position of the text.
+ var lastPos = breakIterator.last(); // Set a BreakIterator object to the last break point, that is, the position after the text end.
+ // Move a BreakIterator object forward or backward by a certain number of break points.
// If a positive number is input, move backward. If a negative number is input, move forward. If no value is input, move one position backward.
// When the object is moved out of the text length range, -1 is returned.
var nextPos = breakIterator.next(-2);
- var previousPos = breakIterator.previous(); // Moves a BreakIterator object to the previous break point. When the text length is out of the range, -1 is returned.
- // Moves a BreakIterator object to the break point following the position specified by offset. If the object is moved out of the text length range, -1 is returned.
+ var previousPos = breakIterator.previous(); // Move a BreakIterator object to the previous break point. When the text length is out of the range, -1 is returned.
+ // Move a BreakIterator object to the break point following the position specified by offset. If the object is moved out of the text length range, -1 is returned.
var followingPos = breakIterator.following(10);
```
diff --git a/en/application-dev/internationalization/intl-guidelines.md b/en/application-dev/internationalization/intl-guidelines.md
index 1332d196cec8c565a13bb77c3fdbcf263b35cf2c..9eceb50b876b05c960518ff554f65ec09963c0c9 100644
--- a/en/application-dev/internationalization/intl-guidelines.md
+++ b/en/application-dev/internationalization/intl-guidelines.md
@@ -103,7 +103,7 @@ Use [DateTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the date
```
2. Format the date and time.
- Call the **format** method to format a **Date** object. This method returns a string representing the formatting result.
+ Call the **format** method to format the date and time in the **DateTimeFormat** object. This method returns a string representing the formatting result.
```
Date date = new Date();
@@ -111,7 +111,7 @@ Use [DateTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the date
```
3. Format a period.
- Call the **formatRange** method to format a period. This method requires input of two **Date** objects, which respectively indicate the start date and end date of a period. This method returns a string representing the formatting result.
+ Call the **formatRange** method to format the period in the **DateTimeFormat** object. This method requires input of two **Date** objects, which respectively indicate the start date and end date of a period. This method returns a string representing the formatting result.
```
Date startDate = new Date();
@@ -127,9 +127,9 @@ Use [DateTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the date
```
-## Number Formatting
+## Formatting Numbers
-Use [NumberFormat](../reference/apis/js-apis-intl.md) APIs to format a number for a specific locale.
+Use [NumberFormat](../reference/apis/js-apis-intl.md) APIs to format numbers for a specific locale.
### Available APIs
@@ -175,7 +175,7 @@ Use [NumberFormat](../reference/apis/js-apis-intl.md) APIs to format a number fo
```
-## String Sorting
+## Sorting Strings
Use [Collator](../reference/apis/js-apis-intl.md) APIs to sort strings based on a specific locale. Users in different regions have different preferences for string sorting.
@@ -262,7 +262,7 @@ Use [PluralRules](../reference/apis/js-apis-intl.md) APIs to determine the singu
```
-## Formatting Relative Time
+## Formatting the Relative Time
Use [RelativeTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the relative time for a specific locale.
diff --git a/en/application-dev/napi/native-window-guidelines.md b/en/application-dev/napi/native-window-guidelines.md
index f86fdb78ed8d0c111c1c2a1eb8b80ca2de5409bf..b92ccc54234c9162dad4b35242dcf9d992e5eeec 100644
--- a/en/application-dev/napi/native-window-guidelines.md
+++ b/en/application-dev/napi/native-window-guidelines.md
@@ -56,7 +56,7 @@ The following steps describe how to use `OH_NativeXComponent` in OpenHarmony to
3. Define the callback `OnSurfaceCreated`. During the creation of a `Surface`, the callback is used to initialize the rendering environment, for example, the `Skia` rendering environment, and write the content to be displayed to `NativeWindow`.
```c++
- void OnSufaceCreatedCB(NativeXComponent* component, void* window) {
+ void OnSurfaceCreatedCB(NativeXComponent* component, void* window) {
// Obtain the width and height of the native window.
uint64_t width_ = 0, height_ = 0;
OH_NativeXComponent_GetXComponentSize(nativeXComponent, window, &width_, &height_);
@@ -89,8 +89,8 @@ The following steps describe how to use `OH_NativeXComponent` in OpenHarmony to
// Create Skia Canvas and write the content to the native window.
...
- // After the write operation is complete, flush the buffer by using OH_NativeWindwo_NativeWindowFlushBuffer so that the data is displayed on the screen.
- Regoin region{nullptr, 0};
+ // After the write operation is complete, flush the buffer by using OH_NativeWindow_NativeWindowFlushBuffer so that the data is displayed on the screen.
+ Region region{nullptr, 0};
OH_NativeWindow_NativeWindowFlushBuffer(nativeWindow_, buffer, fenceFd, region)
}
```
@@ -99,9 +99,9 @@ The following steps describe how to use `OH_NativeXComponent` in OpenHarmony to
```c++
OH_NativeXComponent_Callback &callback_;
- callback_->OnSurfaceCreated = OnSufaceCreatedCB;
- callback_->OnSurfaceChanged = OnSufaceChangedCB;
- callback_->OnSurfaceDestoryed = OnSufaceDestoryedCB;
+ callback_->OnSurfaceCreated = OnSurfaceCreatedCB;
+ callback_->OnSurfaceChanged = OnSurfaceChangedCB;
+ callback_->OnSurfaceDestoryed = OnSurfaceDestoryedCB;
callback_->DispatchTouchEvent = DispatchTouchEventCB;
OH_NativeXComponent_RegisterCallback(nativeXComponent, callback_)
```
diff --git a/en/application-dev/quick-start/Readme-EN.md b/en/application-dev/quick-start/Readme-EN.md
index 228d2f0442007f51177f074b6d2e70fcf7486395..f44905cb2c2d33a8efb52f80d01e199e674e2c5b 100644
--- a/en/application-dev/quick-start/Readme-EN.md
+++ b/en/application-dev/quick-start/Readme-EN.md
@@ -11,4 +11,4 @@
- [Application Package Structure Configuration File (Stage Model)](stage-structure.md)
- [Resource File Categories](basic-resource-file-categories.md)
- [SysCap](syscap.md)
-
+ - [HarmonyAppProvision Configuration File](app-provision-structure.md)
diff --git a/en/application-dev/quick-start/app-provision-structure.md b/en/application-dev/quick-start/app-provision-structure.md
new file mode 100644
index 0000000000000000000000000000000000000000..0ab67146829dc0d8bed1f6eaac6afb2b06f21854
--- /dev/null
+++ b/en/application-dev/quick-start/app-provision-structure.md
@@ -0,0 +1,99 @@
+# HarmonyAppProvision Configuration File
+The **HarmonyAppProvision** configuration file (also called profile) is the file where you declare permission and signature information for your application.
+
+## Configuration File Internal Structure
+The **HarmonyAppProvision** file consists of several parts, which are described in the table below.
+
+**Table 1** Configuration file internal structure
+| Name | Description | Data Type| Mandatory | Initial Value Allowed|
+| ----------- | ---------------------------------------------------------------------------------------- | -------- | -------- | -------- |
+| version-code | Version number of the **HarmonyAppProvision** file format. The value is a positive integer containing 32 or less digits.| Number | Yes | No |
+| version-name | Description of the version number. It is recommended that the value consist of three segments, for example, **A.B.C**. | String | Yes | No|
+| uuid | Unique ID of the **HarmonyAppProvision** file. | String | Yes | No|
+| type | Type of the **HarmonyAppProvision** file. The value can be **debug** (for application debugging) and **release** (for application release). The recommended value is **debug**.| String | Yes | No|
+| issuer | Issuer of the **HarmonyAppProvision** file. | String | Yes | No|
+| validity | Validity period of the **HarmonyAppProvision** file. For details, see [Internal Structure of the validity Object](#internal-structure-of-the-validity-object). | Object | Yes | No |
+| bundle-info | Information about the application bundle and developer. For details, see [Internal Structure of the bundle-info Object](#internal-structure-of-the-bundle-info-object). | Object | Yes | No |
+| acls | Information about the Access Control Lists (ACLs). For details, see [Internal Structure of the acls Object](#internal-structure-of-the-acls-object). | Object | No | No |
+| permissions | Permissions required for your application. For details, see [Internal Structure of the permissions Object](#internal-structure-of-the-permissions-object). | Object | No | No |
+| debug-info | Additional debug information. For details, see [Internal Structure of the debug-info Object](#internal-structure-of-the-debug-info-object). | Object | No | No |
+
+An example of the **HarmonyAppProvision** file is as follows:
+```json
+{
+ "version-code": 1,
+ "version-name": "1.0.0",
+ "uuid": "string",
+ "type": "debug",
+ "validity": {
+ "not-before": 1586422743,
+ "not-after": 1617958743
+ },
+ "bundle-info" : {
+ "developer-id": "OpenHarmony",
+ "development-certificate": "Base64 string",
+ "distribution-certificate": "Base64 string",
+ "bundle-name": "com.OpenHarmony.app.test",
+ "apl": "normal",
+ "app-feature": "hos_normal_app"
+ },
+ "acls": {
+ "allowed-acls": ["string"]
+ },
+ "permissions": {
+ "restricted-permissions": ["string"]
+ },
+ "debug-info" : {
+ "device-id-type": "udid",
+ "device-ids": ["string"]
+ },
+ "issuer": "OpenHarmony"
+}
+
+```
+
+
+### Internal Structure of the validity Object
+| Name | Description | Data Type| Mandatory | Initial Value Allowed|
+| ---------- | ------------------------------- | ------- | ------- | --------- |
+| not-before | Start time of the file validity period. The value is a Unix timestamp, which is a non-negative integer.| Number | Yes | No |
+| not-after | End time of the file validity period. The value is a Unix timestamp, which is a non-negative integer.| Number | Yes | No |
+
+### Internal Structure of the bundle-info Object
+| Name | Description | Data Type| Mandatory | Initial Value Allowed|
+| ------------------------ | ------------------------------- | ------- | -------- | --------- |
+| developer-id | Unique ID of the developer.| String | Yes | No |
+| development-certificate | Information about the [debug certificate](../security/hapsigntool-guidelines.md).| Number | Yes if **type** is set to **debug** and no otherwise | No |
+| distribution-certificate | Information about the [release certificate](../security/hapsigntool-guidelines.md).| Number | Yes if **type** is set to **release** and no otherwise | No |
+| bundle-name | Bundle name of the application.| String | Yes | No |
+| apl | [Ability privilege level (APL)](../security/accesstoken-overview.md) of your application. The value can be **normal**, **system_basic**, or **system_core**.| String | Yes | No |
+| app-feature | Type of your application. The value can be **hos_system_app** (system application) or **hos_normal_app** (non-system application).| String | Yes | No |
+
+
+### Internal structure of the acls Object
+The **acls** object contains the [ACLs](../security/accesstoken-overview.md) configured for your application. It should be noted that you still need to fill the ACL information in the **reqPermissions** attribute in the [config.json](package-structure.md) file.
+
+**Table 4** Internal structure of the acls object
+
+| Name | Description | Data Type| Mandatory | Initial Value Allowed|
+| ------------------------ | ------------------------------- | ------- | ------- | --------- |
+| allowed-acls | [ACLs](../security/accesstoken-overview.md) configured for your application.| String array | No | No |
+
+### Internal Structure of the permissions Object
+The **permissions** object contains restricted permissions required for your application. Different from the ACLs set in the **acls** object, these permissions need user authorization during the running of your application. It should be noted that you still need to fill the permission information in the **reqPermissions** attribute in the [config.json](package-structure.md) file.
+
+**Table 5** Internal structure of the permissions object
+
+| Name | Description | Data Type| Mandatory | Initial Value Allowed|
+| ------------------------ | ------------------------------- | ------- | ------- | --------- |
+| restricted-permissions | [Restricted permissions](../security/accesstoken-overview.md) required for your application.| String array | No | No |
+
+### Internal Structure of the debug-info Object
+The **debug-info** object contains debug information of your application, mainly device management and control information.
+
+**Table 6** Internal structure of the debug-info object
+
+| Name | Description | Data Type| Mandatory | Initial Value Allowed|
+| ------------------------ | ------------------------------- | ------- | ------- | --------- |
+| device-id-type | Type of the device ID. Currently, only the udid type is supported.| String | No | No |
+| device-ids | IDs of devices on which your application can be debugged.| String array | No | No |
diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md
index 3577652546daea30400c7eadafd7e6771a55db77..57d3ad6ddbd25ff75da0532dc83ca2fb7700263b 100644
--- a/en/application-dev/reference/apis/js-apis-appAccount.md
+++ b/en/application-dev/reference/apis/js-apis-appAccount.md
@@ -1,4 +1,6 @@
-# App Account Management
+# App Account Management
+
+Provides app account management, including adding, deleting, querying, modifying, and authorizing app accounts, writing data to disks, and synchronizing data.
> **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -20,13 +22,14 @@ Creates an **AppAccountManager** instance.
**System capability**: SystemCapability.Account.AppAccount
**Return Value**
- | Type | Description |
- | ----------------- | ------------ |
- | AppAccountManager | **AppAccountManager** instance created. |
+
+| Type | Description |
+| ----------------- | ------------ |
+| AppAccountManager | **AppAccountManager** instance created.|
**Example**
```js
- var appAccountManager = account.createAppAccountManager();
+ const appAccountManager = account_appAccount.createAppAccountManager();
```
## AppAccountManager
@@ -37,16 +40,16 @@ Provides methods to manage app accounts.
addAccount(name: string, callback: AsyncCallback<void>): void
-Adds an app account to the account management service. This method uses an asynchronous callback to return the result.
+Adds an app account to the **AppAccountManager** service. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------------------------- | ---- | --------------------- |
- | name | string | Yes | Name of the app account to add. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when the app account is added. |
+| Name | Type | Mandatory | Description |
+| -------- | ------------------------- | ---- | -------------------- |
+| name | string | Yes | Name of the app account to add. |
+| callback | AsyncCallback<void> | Yes | Callback invoked when the app account is added.|
**Example**
@@ -61,17 +64,17 @@ Adds an app account to the account management service. This method uses an async
addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>): void
-Adds an app account and its additional information to the account management service. This method uses an asynchronous callback to return the result.
+Adds the account name and additional information (information that can be converted into the string type, such as token) of this app to the **AppAccountManager** service. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | --------- | ------------------------- | ---- | ---------------------------------------- |
- | name | string | Yes | Name of the app account to add. |
- | extraInfo | string | Yes | Additional information (for example, token) of the app account to add. The additional information cannot contain sensitive information about the app account. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when the app account and its additional information are added. |
+| Name | Type | Mandatory | Description |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| name | string | Yes | Name of the app account to add. |
+| extraInfo | string | Yes | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.|
+| callback | AsyncCallback<void> | Yes | Callback invoked when the app account name and additional information are added. |
**Example**
@@ -86,24 +89,24 @@ Adds an app account and its additional information to the account management ser
### addAccount
-addAccount(name: string, extraInfo?: string): Promise<void>
+addAccount(name: string, extraInfo: string): Promise<void>
-Adds an app account and its additional information to the account management service. This method uses a promise to return the result.
+Adds the account name and additional information (information that can be converted into the string type, such as token) of this app to the **AppAccountManager** service. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | --------- | ------ | ---- | -------------------------------- |
- | name | string | Yes | Name of the app account to add. |
- | extraInfo | string | Yes | Additional information of the app account to add. The additional information cannot contain sensitive information about the app account. |
+| Name | Type | Mandatory | Description |
+| --------- | ------ | ---- | ---------------------------------------- |
+| name | string | Yes | Name of the app account to add. |
+| extraInfo | string | Yes | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.|
**Return Value**
- | Type | Description |
- | ------------------- | --------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| ------------------- | --------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -120,18 +123,18 @@ Adds an app account and its additional information to the account management ser
addAccountImplicitly(owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
-Implicitly adds an app account based on the specified account owner, authentication type, and options. This method uses an asynchronous callback to return the result.
+Implicitly adds an app account based on the specified account owner, authentication type, and options. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | --------------------- | ---- | --------------- |
- | owner | string | Yes | Bundle name of the app account to add. |
- | authType | string | Yes | Authentication type of the app account to add. |
- | options | {[key: string]: any} | Yes | Options for the authentication. |
- | callback | AuthenticatorCallback | Yes | Authenticator callback invoked to return the authentication result. |
+| Name | Type | Mandatory | Description |
+| -------- | --------------------- | ---- | ----------------------- |
+| owner | string | Yes | Owner of the app account to add. The value is the bundle name of the app. |
+| authType | string | Yes | Authentication type of the app account to add. The authentication type is customized. |
+| options | {[key: string]: any} | Yes | Authentication options, which can be set as required.|
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the authentication result. |
**Example**
@@ -161,16 +164,16 @@ Implicitly adds an app account based on the specified account owner, authenticat
deleteAccount(name: string, callback: AsyncCallback<void>): void
-Deletes an app account from the account management service. This method uses an asynchronous callback to return the result.
+Deletes an app account from the **AppAccountManager** service. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------------------------- | ---- | ----------------- |
- | name | string | Yes | Name of the app account to delete. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when the app account is deleted. |
+| Name | Type | Mandatory | Description |
+| -------- | ------------------------- | ---- | ---------------- |
+| name | string | Yes | Name of the app account to delete. |
+| callback | AsyncCallback<void> | Yes | Callback invoked when the app account is deleted.|
**Example**
@@ -185,21 +188,21 @@ Deletes an app account from the account management service. This method uses an
deleteAccount(name: string): Promise<void>
-Deletes an app account from the account management service. This method uses a promise to return the result.
+Deletes an app account from the **AppAccountManager** service. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---- | ------ | ---- | ------------ |
- | name | string | Yes | Name of the app account to delete. |
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ----------- |
+| name | string | Yes | Name of the app account to delete.|
**Return Value**
- | Type | Description |
- | :------------------ | :-------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| :------------------ | :-------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -216,17 +219,17 @@ Deletes an app account from the account management service. This method uses a p
disableAppAccess(name: string, bundleName: string, callback: AsyncCallback<void>): void
-Disables an app account from accessing an application with the given bundle name. This method uses an asynchronous callback to return the result.
+Disables an app account from accessing an app with the given bundle name. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------------------------- | ---- | ------------------------------- |
- | name | string | Yes | App account name. |
- | bundleName | string | Yes | Bundle name of an app. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when the app account is disabled from accessing the application with the given bundle name. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------------------------- | ---- | --------------------------------- |
+| name | string | Yes | Name of the target app account. |
+| bundleName | string | Yes | Bundle name of the app. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
@@ -241,22 +244,22 @@ Disables an app account from accessing an application with the given bundle name
disableAppAccess(name: string, bundleName: string): Promise<void>
-Disables an app account from accessing an application with the given bundle name. This method uses a promise to return the result.
+Disables an app account from accessing an app with the given bundle name. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------ | ---- | ----------------- |
- | name | string | Yes | App account name. |
- | bundleName | string | Yes | Bundle name of an app. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------ | ---- | ---------------- |
+| name | string | Yes | Name of the target app account.|
+| bundleName | string | Yes | Bundle name of the app. |
**Return Value**
- | Type | Description |
- | :------------------ | :-------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| :------------------ | :-------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -273,17 +276,17 @@ Disables an app account from accessing an application with the given bundle name
enableAppAccess(name: string, bundleName: string, callback: AsyncCallback<void>): void
-Enables an app account to access an application with the given bundle name. This method uses an asynchronous callback to return the result.
+Enables an app account to access an app with the given bundle name. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------------------------- | ---- | ------------------------------- |
- | name | string | Yes | App account name. |
- | bundleName | string | Yes | Bundle name of an app. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when the app account is enabled to access the application with the given bundle name. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------------------------- | ---- | --------------------------------- |
+| name | string | Yes | Name of the target app account. |
+| bundleName | string | Yes | Bundle name of the app. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
@@ -298,22 +301,22 @@ Enables an app account to access an application with the given bundle name. This
enableAppAccess(name: string, bundleName: string): Promise<void>
-Enables an app account to access an application with the given bundle name. This method uses a promise to return the result.
+Enables an app account to access an app with the given bundle name. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------ | ---- | --------- |
- | name | string | Yes | App account name. |
- | bundleName | string | Yes | Bundle name of an app. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------ | ---- | --------- |
+| name | string | Yes | Name of the target app account. |
+| bundleName | string | Yes | Bundle name of the app.|
**Return Value**
- | Type | Description |
- | :------------------ | :-------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| :------------------ | :-------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -329,7 +332,7 @@ Enables an app account to access an application with the given bundle name. This
checkAppAccountSyncEnable(name: string, callback: AsyncCallback<boolean>): void
-Checks whether an app account allows application data synchronization. This method uses an asynchronous callback to return the result.
+Checks whether an app account allows app data synchronization. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
@@ -337,10 +340,10 @@ Checks whether an app account allows application data synchronization. This meth
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------- | ---- | ---------------------- |
- | name | string | Yes | App account name. |
- | callback | AsyncCallback<boolean> | Yes | Callback used to return whether the app account allows application data synchronization. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------- | ---- | --------------------- |
+| name | string | Yes | Name of the target app account. |
+| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
**Example**
@@ -356,7 +359,7 @@ Checks whether an app account allows application data synchronization. This meth
checkAppAccountSyncEnable(name: string): Promise<boolean>
-Checks whether an app account allows application data synchronization. This method uses a promise to return the result.
+Checks whether an app account allows app data synchronization. This API uses a promise to return the result.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
@@ -364,15 +367,15 @@ Checks whether an app account allows application data synchronization. This meth
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---- | ------ | ---- | ------- |
- | name | string | Yes | App account name. |
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ------- |
+| name | string | Yes | Name of the target app account.|
**Return Value**
- | Type | Description |
- | :--------------------- | :-------------------- |
- | Promise<boolean> | Promise used to return the result. |
+| Type | Description |
+| :--------------------- | :-------------------- |
+| Promise<boolean> | Promise used to return the result.|
**Example**
@@ -387,20 +390,20 @@ Checks whether an app account allows application data synchronization. This meth
### setAccountCredential
-setAccountCredential(name: string, credentialType: string, credential: string, callback: AsyncCallback<void>): void
+setAccountCredential(name: string, credentialType: string, credential: string,callback: AsyncCallback<void>): void
-Sets a credential for an app account. This method uses an asynchronous callback to return the result.
+Sets a credential for an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------------- | ------------------------- | ---- | -------------- |
- | name | string | Yes | App account name. |
- | credentialType | string | Yes | Type of the credential to set. |
- | credential | string | Yes | Credential to set. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when a credential is set for the specified app account. |
+| Name | Type | Mandatory | Description |
+| -------------- | ------------------------- | ---- | ------------- |
+| name | string | Yes | Name of the target app account. |
+| credentialType | string | Yes | Type of the credential to set. |
+| credential | string | Yes | Credential to set. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
@@ -415,23 +418,23 @@ Sets a credential for an app account. This method uses an asynchronous callback
setAccountCredential(name: string, credentialType: string, credential: string): Promise<void>
-Sets a credential for an app account. This method uses a promise to return the result asynchronously.
+Sets a credential for an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------------- | ------ | ---- | ---------- |
- | name | string | Yes | App account name. |
- | credentialType | string | Yes | Type of the credential to set. |
- | credential | string | Yes | Credential to set. |
+| Name | Type | Mandatory | Description |
+| -------------- | ------ | ---- | ---------- |
+| name | string | Yes | Name of the target app account. |
+| credentialType | string | Yes | Type of the credential to set.|
+| credential | string | Yes | Credential to set. |
**Return Value**
- | Type | Description |
- | :------------------ | :-------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| :------------------ | :-------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -448,17 +451,17 @@ Sets a credential for an app account. This method uses a promise to return the r
setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback<void>): void
-Sets additional information for an app account. This method uses an asynchronous callback to return the result.
+Sets additional information for an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | --------- | ------------------------- | ---- | ---------------- |
- | name | string | Yes | App account name. |
- | extraInfo | string | Yes | Additional information to set. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when additional information is set for the specified app account. |
+| Name | Type | Mandatory | Description |
+| --------- | ------------------------- | ---- | --------------- |
+| name | string | Yes | Name of the target app account. |
+| extraInfo | string | Yes | Additional information to set. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
@@ -473,22 +476,22 @@ Sets additional information for an app account. This method uses an asynchronous
setAccountExtraInfo(name: string, extraInfo: string): Promise<void>
-Sets additional information for an app account. This method uses a promise to return the result asynchronously.
+Sets additional information for an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | --------- | ------ | ---- | --------- |
- | name | string | Yes | App account name. |
- | extraInfo | string | Yes | Additional information to set. |
+| Name | Type | Mandatory | Description |
+| --------- | ------ | ---- | --------- |
+| name | string | Yes | Name of the target app account. |
+| extraInfo | string | Yes | Additional information to set.|
**Return Value**
- | Type | Description |
- | :------------------ | :-------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| :------------------ | :-------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -505,7 +508,7 @@ Sets additional information for an app account. This method uses a promise to re
setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback<void>): void
-Sets whether to enable application data synchronization for an app account. This method uses an asynchronous callback to return the result.
+Sets whether to enable app data synchronization for an app account. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
@@ -513,11 +516,11 @@ Sets whether to enable application data synchronization for an app account. This
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------------------------- | ---- | ------------------------- |
- | name | string | Yes | App account name. |
- | isEnable | boolean | Yes | Whether to enable app data synchronization. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when application data synchronization is enabled or disabled for the app account. |
+| Name | Type | Mandatory | Description |
+| -------- | ------------------------- | ---- | ------------------------- |
+| name | string | Yes | Name of the target app account. |
+| isEnable | boolean | Yes | Whether to enable app data synchronization. |
+| callback | AsyncCallback<void> | Yes | Callback invoked when app data synchronization is enabled or disabled for the app account.|
**Example**
@@ -532,7 +535,7 @@ Sets whether to enable application data synchronization for an app account. This
setAppAccountSyncEnable(name: string, isEnable: boolean): Promise<void>
-Sets whether to enable application data synchronization for an app account. This method uses a promise to return the result asynchronously.
+Sets whether to enable app data synchronization for an app account. This API uses a promise to return the result.
**Required permissions**: ohos.permission.DISTRIBUTED_DATASYNC (available only to system applications)
@@ -540,16 +543,16 @@ Sets whether to enable application data synchronization for an app account. This
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------- | ---- | ----------- |
- | name | string | Yes | App account name. |
- | isEnable | boolean | Yes | Whether to enable app data synchronization. |
+| Name | Type | Mandatory | Description |
+| -------- | ------- | ---- | ----------- |
+| name | string | Yes | Name of the target app account. |
+| isEnable | boolean | Yes | Whether to enable app data synchronization.|
**Return Value**
- | Type | Description |
- | :------------------ | :-------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| :------------------ | :-------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -566,18 +569,18 @@ Sets whether to enable application data synchronization for an app account. This
setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback<void>): void
-Sets data to be associated with an app account. This method uses an asynchronous callback to return the result.
+Sets data to be associated with an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------------------------- | ---- | ----------------- |
- | name | string | Yes | App account name. |
- | key | string | Yes | Key of the data to set. The private key can be customized. |
- | value | string | Yes | Value of the data to be set. |
- | callback | AsyncCallback<void> | Yes | Callback invoked when the data associated with the specified app account is set. |
+| Name | Type | Mandatory | Description |
+| -------- | ------------------------- | ---- | ----------------- |
+| name | string | Yes | Name of the target app account. |
+| key | string | Yes | Key of the data to set. The private key can be customized.|
+| value | string | Yes | Value of the data to be set. |
+| callback | AsyncCallback<void> | Yes | Callback invoked when the data associated with the specified app account is set.|
**Example**
@@ -591,23 +594,23 @@ Sets data to be associated with an app account. This method uses an asynchronous
setAssociatedData(name: string, key: string, value: string): Promise<void>
-Sets data to be associated with an app account. This method uses a promise to return the result asynchronously.
+Sets data to be associated with an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ----- | ------ | ---- | ----------------- |
- | name | string | Yes | App account name. |
- | key | string | Yes | Key of the data to set. The private key can be customized. |
- | value | string | Yes | Value of the data to be set. |
+| Name | Type | Mandatory | Description |
+| ----- | ------ | ---- | ----------------- |
+| name | string | Yes | Name of the target app account. |
+| key | string | Yes | Key of the data to set. The private key can be customized.|
+| value | string | Yes | Value of the data to be set. |
**Return Value**
- | Type | Description |
- | :------------------ | :-------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| :------------------ | :-------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -624,17 +627,17 @@ Sets data to be associated with an app account. This method uses a promise to re
getAccountCredential(name: string, credentialType: string, callback: AsyncCallback<string>): void
-Obtains the credential of an app account. This method uses an asynchronous callback to return the result.
+Obtains the credentials (such as the digital password, face image, and PIN) of an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------------- | --------------------------- | ---- | -------------- |
- | name | string | Yes | App account name. |
- | credentialType | string | Yes | Type of the credential to obtain. |
- | callback | AsyncCallback<string> | Yes | Callback invoked to return the credential of the specified app account. |
+| Name | Type | Mandatory | Description |
+| -------------- | --------------------------- | ---- | -------------- |
+| name | string | Yes | Name of the target app account. |
+| credentialType | string | Yes | Type of the credential to obtain.|
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the credential obtained.|
**Example**
@@ -650,22 +653,22 @@ Obtains the credential of an app account. This method uses an asynchronous callb
getAccountCredential(name: string, credentialType: string): Promise<string>
-Obtains the credential of an app account. This method uses a promise to return the result asynchronously.
+Obtains the credential of an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------------- | ------ | ---- | ---------- |
- | name | string | Yes | App account name. |
- | credentialType | string | Yes | Type of the credential to obtain. |
+| Name | Type | Mandatory | Description |
+| -------------- | ------ | ---- | ---------- |
+| name | string | Yes | Name of the target app account. |
+| credentialType | string | Yes | Type of the credential to obtain.|
**Return Value**
- | Type | Description |
- | :-------------------- | :-------------------- |
- | Promise<string> | Promise used to return the result. |
+| Type | Description |
+| :-------------------- | :-------------------- |
+| Promise<string> | Promise used to return the result.|
**Example**
@@ -682,16 +685,16 @@ Obtains the credential of an app account. This method uses a promise to return t
getAccountExtraInfo(name: string, callback: AsyncCallback<string>): void
-Obtains additional information of an app account. This method uses an asynchronous callback to return the result.
+Obtains additional information (information that can be converted into the string type) about an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | --------------------------- | ---- | ---------------- |
- | name | string | Yes | App account name. |
- | callback | AsyncCallback<string> | Yes | Callback invoked to return the additional information of the specified app account. |
+| Name | Type | Mandatory | Description |
+| -------- | --------------------------- | ---- | --------------- |
+| name | string | Yes | Name of the target app account. |
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the additional information of the specified app account.|
**Example**
@@ -707,21 +710,21 @@ Obtains additional information of an app account. This method uses an asynchrono
getAccountExtraInfo(name: string): Promise<string>
-Obtains additional information of an app account. This method uses a promise to return the result asynchronously.
+Obtains additional information of an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---- | ------ | ---- | ------- |
- | name | string | Yes | App account name. |
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | ------- |
+| name | string | Yes | Name of the target app account.|
**Return Value**
- | Type | Description |
- | :-------------------- | :-------------------- |
- | Promise<string> | Promise used to return the result. |
+| Type | Description |
+| :-------------------- | :-------------------- |
+| Promise<string> | Promise used to return the result.|
**Example**
@@ -738,17 +741,17 @@ Obtains additional information of an app account. This method uses a promise to
getAssociatedData(name: string, key: string, callback: AsyncCallback<string>): void
-Obtains data associated with an app account. This method uses an asynchronous callback to return the result.
+Obtains data associated with an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | --------------------------- | ---- | ----------------- |
- | name | string | Yes | App account name. |
- | key | string | Yes | Key of the data to obtain. |
- | callback | AsyncCallback<string> | Yes | Callback invoked to return the data associated with the specified app account. |
+| Name | Type | Mandatory | Description |
+| -------- | --------------------------- | ---- | ----------------- |
+| name | string | Yes | Name of the target app account. |
+| key | string | Yes | Key of the data to obtain. |
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the data associated with the specified app account.|
**Example**
@@ -764,22 +767,22 @@ Obtains data associated with an app account. This method uses an asynchronous ca
getAssociatedData(name: string, key: string): Promise<string>
-Obtains data associated with an app account. This method uses a promise to return the result asynchronously.
+Obtains data associated with an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---- | ------ | ---- | ----------- |
- | name | string | Yes | App account name. |
- | key | string | Yes | Key of the data to obtain. |
+| Name | Type | Mandatory | Description |
+| ---- | ------ | ---- | --------- |
+| name | string | Yes | Name of the target app account. |
+| key | string | Yes | Key of the data to obtain.|
**Return Value**
- | Type | Description |
- | :-------------------- | :-------------------- |
- | Promise<string> | Promise used to return the result. |
+| Type | Description |
+| :-------------------- | :-------------------- |
+| Promise<string> | Promise used to return the result.|
**Example**
@@ -796,7 +799,7 @@ Obtains data associated with an app account. This method uses a promise to retur
getAllAccessibleAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void
-Obtains information about all accessible app accounts. This method uses an asynchronous callback to return the result.
+Obtains information about all accessible app accounts. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS (available only to system applications)
@@ -804,9 +807,9 @@ Obtains information about all accessible app accounts. This method uses an async
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | -------- |
- | callback | AsyncCallback<Array<AppAccountInfo>> | Yes | Callback invoked to return information about all accessible app accounts. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | --------- |
+| callback | AsyncCallback<Array<[AppAccountInfo](#appaccountinfo)>> | Yes | Callback invoked to return information about all accessible app accounts.|
**Example**
@@ -822,7 +825,7 @@ Obtains information about all accessible app accounts. This method uses an async
getAllAccessibleAccounts(): Promise<Array<AppAccountInfo>>
-Obtains information about all accessible app accounts. This method uses an asynchronous callback to return the result.
+Obtains information about all accessible app accounts. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS (available only to system applications)
@@ -830,9 +833,9 @@ Obtains information about all accessible app accounts. This method uses an async
**Parameters**
- | Type | Description |
- | ---------------------------------------- | --------------------- |
- | Promise<Array<AppAccountInfo>> | Promise used to return the result. |
+| Type | Description |
+| ---------------------------------------- | --------------------- |
+| Promise<Array<[AppAccountInfo](#appaccountinfo)>> | Promise used to return the result.|
**Example**
@@ -849,7 +852,7 @@ Obtains information about all accessible app accounts. This method uses an async
getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void
-Obtains information about all app accounts of the specified app. This method uses an asynchronous callback to return the result.
+Obtains information about all app accounts of the specified app. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS (available only to system applications)
@@ -857,10 +860,10 @@ Obtains information about all app accounts of the specified app. This method use
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | -------- |
- | owner | string | Yes | Bundle name of the app. |
- | callback | AsyncCallback<Array<AppAccountInfo>> | Yes | Callback invoked to return information about all accessible app accounts. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | --------- |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app. |
+| callback | AsyncCallback<Array<[AppAccountInfo](#appaccountinfo)>> | Yes | Callback invoked to return information about all accessible app accounts.|
**Example**
@@ -877,7 +880,7 @@ Obtains information about all app accounts of the specified app. This method use
getAllAccounts(owner: string): Promise<Array<AppAccountInfo>>
-Obtains information about all app accounts of the specified app. This method uses an asynchronous callback to return the result.
+Obtains information about all app accounts of the specified app. This API uses a promise to return the result.
**Required permissions**: ohos.permission.GET_ALL_APP_ACCOUNTS (available only to system applications)
@@ -885,15 +888,15 @@ Obtains information about all app accounts of the specified app. This method use
**Parameters**
- | Name | Type | Mandatory | Description |
- | ----- | ------ | ---- | ----- |
- | owner | string | Yes | Bundle name of the app. |
+| Name | Type | Mandatory | Description |
+| ----- | ------ | ---- | ------ |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
**Parameters**
- | Type | Description |
- | ---------------------------------------- | --------------------- |
- | Promise<Array<AppAccountInfo>> | Promise used to return the result. |
+| Type | Description |
+| ---------------------------------------- | --------------------- |
+| Promise<Array<[AppAccountInfo](#appaccountinfo)>> | Promise used to return the result.|
**Example**
@@ -911,17 +914,17 @@ Obtains information about all app accounts of the specified app. This method use
on(type: 'change', owners: Array<string>, callback: Callback<Array<AppAccountInfo>>): void
-Subscribes to the account change event of the specified account owners. This method uses an asynchronous callback to return the result.
+Subscribes to the account change events of the specified account owners. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | ------------------------------ |
- | type | 'change' | Yes | Type of the event to subscribe to. The subscriber will receive a notification when the account owners update their accounts. |
- | owners | Array<string> | Yes | Owners of the accounts. |
- | callback | Callback<Array<AppAccountInfo>> | Yes | Callback invoked to return the account change. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ------------------------------ |
+| type | 'change' | Yes | Account change events to subscribe to. The subscriber will receive a notification when the account owners update their accounts.|
+| owners | Array<string> | Yes | Account owners. |
+| callback | Callback<Array<[AppAccountInfo](#appaccountinfo)>> | Yes | Callback invoked to return the account changes. |
**Example**
@@ -942,16 +945,16 @@ Subscribes to the account change event of the specified account owners. This met
off(type: 'change', callback?: Callback>): void
-Unsubscribes from the account change event. This method uses an asynchronous callback to return the result.
+Unsubscribes from the account change events. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------------------------------- | ---- | ------------ |
- | type | 'change' | Yes | Account change event to unsubscribe from. |
- | callback | Callback> | No | Callback used to report the account change. |
+| Name | Type | Mandatory | Description |
+| -------- | -------------------------------- | ---- | ------------ |
+| type | 'change' | Yes | Account change events to unsubscribe from. |
+| callback | Callback> | No | Callback used to report the account changes.|
**Example**
@@ -975,19 +978,19 @@ Unsubscribes from the account change event. This method uses an asynchronous cal
authenticate(name: string, owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
-Authenticates an app account to obtain the Open Authorization (OAuth) access token. This method uses an asynchronous callback to return the result.
+Authenticates an app account to obtain the Open Authorization (OAuth) token. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | --------------------- | ---- | --------------- |
- | name | string | Yes | Name of the app account to authenticate. |
- | owner | string | Yes | Bundle name of the app. |
- | authType | string | Yes | Authentication type. |
- | options | {[key: string]: any} | Yes | Options for the authentication. |
- | callback | AuthenticatorCallback | Yes | Authenticator callback invoked to return the authentication result. |
+| Name | Type | Mandatory | Description |
+| -------- | --------------------- | ---- | --------------- |
+| name | string | Yes | Name of the app account to authenticate. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app. |
+| authType | string | Yes | Authentication type. |
+| options | {[key: string]: any} | Yes | Options for the authentication. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the authentication result.|
**Example**
@@ -1017,18 +1020,18 @@ Authenticates an app account to obtain the Open Authorization (OAuth) access tok
getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback<string>): void
-Obtains the OAuth access token of an app account based on the specified authentication type. This method uses an asynchronous callback to return the result.
+Obtains the OAuth token of an app account based on the specified authentication type. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | --------------------------- | ---- | ----------- |
- | name | string | Yes | App account name. |
- | owner | string | Yes | Bundle name of the app. |
- | authType | string | Yes | Authentication type. |
- | callback | AsyncCallback<string> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | --------------------------- | ---- | ----------- |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
+| authType | string | Yes | Authentication type. |
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. |
**Example**
@@ -1044,23 +1047,23 @@ Obtains the OAuth access token of an app account based on the specified authenti
getOAuthToken(name: string, owner: string, authType: string): Promise<string>
-Obtains the OAuth access token of an app account based on the specified authentication type. This method uses a promise to return the result.
+Obtains the OAuth token of an app account based on the specified authentication type. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------ | ---- | ----------- |
- | name | string | Yes | App account name. |
- | owner | string | Yes | Bundle name of the app. |
- | authType | string | Yes | Authentication type. |
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------- |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
+| authType | string | Yes | Authentication type. |
**Parameters**
- | Type | Description |
- | --------------------- | --------------------- |
- | Promise<string> | Promise used to return the result. |
+| Type | Description |
+| --------------------- | --------------------- |
+| Promise<string> | Promise used to return the result.|
**Example**
@@ -1077,18 +1080,18 @@ Obtains the OAuth access token of an app account based on the specified authenti
setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback<void>): void
-Sets an OAuth access token for an app account. This method uses an asynchronous callback to return the result.
+Sets an OAuth token for an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------------------------- | ---- | -------- |
- | name | string | Yes | App account name. |
- | authType | string | Yes | Authentication type. |
- | token | string | Yes | OAuth access token to set. |
- | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | ------------------------- | ---- | -------- |
+| name | string | Yes | Name of the target app account.|
+| authType | string | Yes | Authentication type. |
+| token | string | Yes | OAuth token to set.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.|
**Example**
@@ -1103,23 +1106,23 @@ Sets an OAuth access token for an app account. This method uses an asynchronous
setOAuthToken(name: string, authType: string, token: string): Promise<void>
-Sets an OAuth access token for an app account. This method uses a promise to return the result.
+Sets an OAuth token for an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------ | ---- | -------- |
- | name | string | Yes | App account name. |
- | authType | string | Yes | Authentication type. |
- | token | string | Yes | OAuth access token to set. |
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | -------- |
+| name | string | Yes | Name of the target app account.|
+| authType | string | Yes | Authentication type. |
+| token | string | Yes | OAuth token to set.|
**Parameters**
- | Type | Description |
- | ------------------- | --------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| ------------------- | --------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -1136,19 +1139,19 @@ Sets an OAuth access token for an app account. This method uses a promise to ret
deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback<void>): void
-Deletes the specified OAuth access token for an app account. This method uses an asynchronous callback to return the result.
+Deletes the specified OAuth token for an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------------------------- | ---- | ------------ |
- | name | string | Yes | App account name. |
- | owner | string | Yes | Bundle name of the app. |
- | authType | string | Yes | Authentication type. |
- | token | string | Yes | OAuth access token to delete. |
- | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | ------------------------- | ---- | ------------ |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app. |
+| authType | string | Yes | Authentication type. |
+| token | string | Yes | OAuth token to delete.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
**Example**
@@ -1163,24 +1166,24 @@ Deletes the specified OAuth access token for an app account. This method uses an
deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise<void>
-Deletes the specified OAuth access token for an app account. This method uses a promise to return the result.
+Deletes the specified OAuth token for an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ------ | ---- | ------------ |
- | name | string | Yes | App account name. |
- | owner | string | Yes | Bundle name of the app. |
- | authType | string | Yes | Authentication type. |
- | token | string | Yes | OAuth access token to delete. |
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ------------ |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app. |
+| authType | string | Yes | Authentication type. |
+| token | string | Yes | OAuth token to delete.|
**Parameters**
- | Type | Description |
- | ------------------- | --------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| ------------------- | --------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -1197,19 +1200,19 @@ Deletes the specified OAuth access token for an app account. This method uses a
setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback<void>): void
-Sets the visibility of an OAuth access token to the specified app. This method uses an asynchronous callback to return the result.
+Sets the visibility of an OAuth token to an app. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------------------------- | ---- | ------------ |
- | name | string | Yes | App account name. |
- | authType | string | Yes | Authentication type. |
- | bundleName | string | Yes | Bundle name of the app. |
- | isVisible | boolean | Yes | Whether the OAuth access token is visible to the app. |
- | callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------------------------- | ---- | ------------------------- |
+| name | string | Yes | Name of the target app account. |
+| authType | string | Yes | Authentication type. |
+| bundleName | string | Yes | Bundle name of the app. |
+| isVisible | boolean | Yes | Whether the OAuth token is visible to the app. The value **true** means visible, and the value **false** means the opposite.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
**Example**
@@ -1224,24 +1227,24 @@ Sets the visibility of an OAuth access token to the specified app. This method u
setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise<void>
-Sets the visibility of an OAuth access token to the specified app. This method uses a promise to return the result.
+Sets the visibility of an OAuth token to an app. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------- | ---- | ------------ |
- | name | string | Yes | App account name. |
- | authType | string | Yes | Authentication type. |
- | bundleName | string | Yes | Bundle name of the app. |
- | isVisible | boolean | Yes | Whether the OAuth access token is visible to the app. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------- | ---- | ------------ |
+| name | string | Yes | Name of the target app account. |
+| authType | string | Yes | Authentication type. |
+| bundleName | string | Yes | Bundle name of the app.|
+| isVisible | boolean | Yes | Whether the OAuth token is visible to the app. |
**Parameters**
- | Type | Description |
- | ------------------- | --------------------- |
- | Promise<void> | Promise used to return the result. |
+| Type | Description |
+| ------------------- | --------------------- |
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -1258,18 +1261,18 @@ Sets the visibility of an OAuth access token to the specified app. This method u
checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback<boolean>): void
-Checks whether an OAuth token is visible to the specified app. This method uses an asynchronous callback to return the result.
+Checks whether an OAuth token is visible to an app. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ---------------------------- | ---- | ------------- |
- | name | string | Yes | App account name. |
- | authType | string | Yes | Authentication type. |
- | bundleName | string | Yes | Bundle name of the app. |
- | callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| ---------- | ---------------------------- | ---- | ----------- |
+| name | string | Yes | Name of the target app account. |
+| authType | string | Yes | Authentication type. |
+| bundleName | string | Yes | Bundle name of the app.|
+| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. |
**Example**
@@ -1285,23 +1288,23 @@ Checks whether an OAuth token is visible to the specified app. This method uses
checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise<boolean>
-Checks whether an OAuth token is visible to the specified app. This method uses a promise to return the result.
+Checks whether an OAuth token is visible to an app. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------- | ------ | ---- | ------------- |
- | name | string | Yes | App account name. |
- | authType | string | Yes | Authentication type. |
- | bundleName | string | Yes | Bundle name of the app. |
+| Name | Type | Mandatory | Description |
+| ---------- | ------ | ---- | ------------- |
+| name | string | Yes | Name of the target app account. |
+| authType | string | Yes | Authentication type. |
+| bundleName | string | Yes | Bundle name of the app.|
**Parameters**
- | Type | Description |
- | ---------------------- | --------------------- |
- | Promise<boolean> | Promise used to return the result. |
+| Type | Description |
+| ---------------------- | --------------------- |
+| Promise<boolean> | Promise used to return the result.|
**Example**
@@ -1318,17 +1321,17 @@ Checks whether an OAuth token is visible to the specified app. This method uses
getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback<Array<OAuthTokenInfo>>): void
-Obtains information about all OAuth access tokens of an app account visible to the specified app. This method uses an asynchronous callback to return the result.
+Obtains all OAuth tokens visible to the caller for an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | ----------- |
- | name | string | Yes | App account name. |
- | owner | string | Yes | Bundle name of the app. |
- | callback | AsyncCallback<Array<OAuthTokenInfo>> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ----------- |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
+| callback | AsyncCallback<Array< [OAuthTokenInfo](#oauthtokeninfo8)>> | Yes | Callback invoked to return the result. |
**Example**
@@ -1344,22 +1347,22 @@ Obtains information about all OAuth access tokens of an app account visible to t
getAllOAuthTokens(name: string, owner: string): Promise<Array<OAuthTokenInfo>>
-Obtains information about all OAuth access tokens of an app account visible to the specified app. This method uses a promise to return the result.
+Obtains all OAuth tokens visible to the caller for an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ----- | ------ | ---- | ----------- |
- | name | string | Yes | App account name. |
- | owner | string | Yes | Bundle name of the app. |
+| Name | Type | Mandatory | Description |
+| ----- | ------ | ---- | ----------- |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
**Parameters**
- | Type | Description |
- | ---------------------------------------- | --------------------- |
- | Promise<Array<OAuthTokenInfo>> | Promise used to return the result. |
+| Type | Description |
+| ---------------------------------------- | --------------------- |
+| Promise<Array< [OAuthTokenInfo](#oauthtokeninfo8)>> | Promise used to return the result.|
**Example**
@@ -1376,17 +1379,17 @@ Obtains information about all OAuth access tokens of an app account visible to t
getOAuthList(name: string, authType: string, callback: AsyncCallback<Array<string>>): void
-Obtains the authorization list of OAuth access tokens of an app account. This method uses an asynchronous callback to return the result.
+Obtains a list of authorized OAuth tokens of an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | ---------------------------------------- | ---- | ----------- |
- | name | string | Yes | App account name. |
- | owner | string | Yes | Bundle name of the app. |
- | callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | ---------------------------------------- | ---- | ----------------------- |
+| name | string | Yes | Name of the target app account. |
+| authType | string | Yes | Authorization type.|
+| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the result. |
**Example**
@@ -1402,22 +1405,22 @@ Obtains the authorization list of OAuth access tokens of an app account. This me
getOAuthList(name: string, authType: string): Promise<Array<string>>
-Obtains the authorization list of OAuth access tokens of an app account. This method uses a promise to return the result.
+Obtains a list of authorized OAuth tokens of an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ----- | ------ | ---- | ----------- |
- | name | string | Yes | App account name. |
- | owner | string | Yes | Bundle name of the app. |
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | ----------------------- |
+| name | string | Yes | Name of the target app account. |
+| authType | string | Yes | Authorization type.|
**Parameters**
- | Type | Description |
- | ---------------------------------- | --------------------- |
- | Promise<Array<string>> | Promise used to return the result. |
+| Type | Description |
+| ---------------------------------- | --------------------- |
+| Promise<Array<string>> | Promise used to return the result.|
**Example**
@@ -1434,20 +1437,21 @@ Obtains the authorization list of OAuth access tokens of an app account. This me
getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<AuthenticatorCallback>): void
-Obtains the authenticator callback for a session. This method uses an asynchronous callback to return the result.
+Obtains the authenticator callback for an authentication session. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | --------- | ---------------------------------------- | ---- | -------- |
- | sessionId | string | Yes | ID of the session to authenticate. |
- | callback | AsyncCallback<AuthenticatorCallback> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| --------- | ---------------------------------------- | ---- | -------- |
+| sessionId | string | Yes | ID of the authentication session.|
+| callback | AsyncCallback<[AuthenticatorCallback](#authenticatorcallback8)> | Yes | Callback invoked to return the result.|
**Example**
```js
+ import featureAbility from '@ohos.ability.featureAbility';
const appAccountManager = account_appAccount.createAppAccountManager();
featureAbility.getWant((err, want) => {
var sessionId = want.parameters[account_appAccount.Constants.KEY_SESSION_ID];
@@ -1469,21 +1473,21 @@ Obtains the authenticator callback for a session. This method uses an asynchrono
getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback>
-Obtains the authenticator callback for a session. This method uses a promise to return the result.
+Obtains the authenticator callback for an authentication session. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | --------- | ------ | ---- | -------- |
- | sessionId | string | Yes | ID of the session to authenticate. |
+| Name | Type | Mandatory | Description |
+| --------- | ------ | ---- | -------- |
+| sessionId | string | Yes | ID of the authentication session.|
**Parameters**
- | Type | Description |
- | ------------------------------------ | --------------------- |
- | Promise<AuthenticatorCallback> | Promise used to return the result. |
+| Type | Description |
+| ------------------------------------ | --------------------- |
+| Promise<[AuthenticatorCallback](#authenticatorcallback8)> | Promise used to return the result.|
**Example**
@@ -1509,16 +1513,16 @@ Obtains the authenticator callback for a session. This method uses a promise to
getAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorInfo>): void
-Obtains authenticator information of an app account. This method uses an asynchronous callback to return the result.
+Obtains authenticator information of an app account. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------------------------------------- | ---- | ----------- |
- | owner | string | Yes | Bundle name of the app. |
- | callback | AsyncCallback<AuthenticatorInfo> | Yes | Callback invoked to return the result. |
+| Name | Type | Mandatory | Description |
+| -------- | -------------------------------------- | ---- | ----------- |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
+| callback | AsyncCallback<[AuthenticatorInfo](#authenticatorinfo8)> | Yes | Callback invoked to return the result. |
**Example**
@@ -1534,21 +1538,21 @@ Obtains authenticator information of an app account. This method uses an asynchr
getAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo>
-Obtains authenticator information of an app account. This method uses a promise to return the result.
+Obtains authenticator information of an app account. This API uses a promise to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ----- | ------ | ---- | ----------- |
- | owner | string | Yes | Bundle name of the app. |
+| Name | Type | Mandatory | Description |
+| ----- | ------ | ---- | ----------- |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
**Parameters**
- | Type | Description |
- | -------------------------------- | --------------------- |
- | Promise<AuthenticatorInfo> | Promise used to return the result. |
+| Type | Description |
+| -------------------------------- | --------------------- |
+| Promise<[AuthenticatorInfo](#authenticatorinfo8)> | Promise used to return the result.|
**Example**
@@ -1561,27 +1565,397 @@ Obtains authenticator information of an app account. This method uses a promise
});
```
+### checkAppAccess9+
+
+checkAppAccess(name: string, bundleName: string, callback: AsyncCallback<boolean>): void
+
+Checks whether an app account is authorized to access an app. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------- | ---------------------------- | ----- | ---------------- |
+| name | string | Yes | Name of the target app account. |
+| bundleName | string | Yes | Bundle name of the app to check. |
+| callback | AsyncCallback<boolean> | Yes | Callback invoked to return the result. |
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.checkAppAccess("zhangsan", "com.example.ohos.accountjsdemo", (err, data) => {
+ console.log('checkAppAccess: ' + JSON.stringify(data));
+ console.log("checkAppAccess err: " + JSON.stringify(err));
+ });
+ ```
+
+### checkAppAccess9+
+
+checkAppAccess(name: string, bundleName: string): Promise<boolean>
+
+Checks whether an app account is authorized to access an app. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------- | ------ | ----- | ---------------- |
+| name | string | Yes | Name of the target app account. |
+| bundleName | string | Yes | Bundle name of the app to check. |
+
+**Parameters**
+
+| Type | Description |
+| ---------------------- | --------------------------------- |
+| Promise<boolean> | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.checkAppAccess("zhangsan", "com.example.ohos.accountjsdemo").then((data) => {
+ console.log('checkAppAccess: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("checkAppAccess err: " + JSON.stringify(err));
+ });
+ ```
+
+### deleteAccountCredential9+
+
+deleteAccountCredential(name: string, credentialType: string, callback: AsyncCallback<void>): void
+
+Deletes the credential of an app account. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | ------------------------- | ----- | -------------- |
+| name | string | Yes | Name of the target app account.|
+| credentialType | string | Yes | Type of the credential to delete. |
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.deleteAccountCredential("zhangsan", "pin", (err, data) => {
+ console.log('deleteAccountCredential: ' + JSON.stringify(data));
+ console.log("deleteAccountCredential err: " + JSON.stringify(err));
+ });
+ ```
+
+### deleteAccountCredential9+
+
+deleteAccountCredential(name: string, credentialType: string): Promise<void>
+
+Deletes the credential of an app account. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | ------ | ----- | --------------- |
+| name | string | Yes | Name of the target app account.|
+| credentialType | string | Yes | Type of the credential to delete. |
+
+**Parameters**
+
+| Type | Description |
+| ------------------- | -------------------------------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.deleteAccountCredential("zhangsan", "pin").then((data) => {
+ console.log('deleteAccountCredential: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("deleteAccountCredential err: " + JSON.stringify(err));
+ });
+ ```
+
+### checkAccountLabels9+
+
+checkAccountLabels(name: string, owner: string, labels: Array<string>, callback: AsyncCallback<boolean>): void;
+
+Checks whether an app account has specific labels. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | ------------------------- | ----- | --------------- |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
+| labels | Array<string> | Yes | Labels to check. |
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.checkAccountLabels("zhangsan", "com.example.ohos.accountjsdemo", (err, data) => {
+ console.log('checkAccountLabels: ' + JSON.stringify(data));
+ console.log("checkAccountLabels err: " + JSON.stringify(err));
+ });
+ ```
+
+### checkAccountLabels9+
+
+checkAccountLabels(name: string, owner: string, labels: Array<string>): Promise<void>
+
+Checks whether an app account has specific labels. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | ------------------------- | ----- | --------------- |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
+| labels | Array<string> | Yes | Labels to check. |
+
+**Parameters**
+
+| Type | Description |
+| ------------------- | -------------------------------- |
+| Promise<boolean> | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.checkAccountLabels("zhangsan", "com.example.ohos.accountjsdemo").then((data) => {
+ console.log('checkAccountLabels: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("checkAccountLabels err: " + JSON.stringify(err));
+ });
+ ```
+
+### selectAccountsByOptions9+
+
+selectAccountsByOptions(options: SelectAccountsOptions, callback: AsyncCallback<Array<AppAccountInfo>>);
+
+Selects the accounts accessible to the requester based on the options. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | ----------------------------------- | ----- | --------------- |
+| options | SelectAccountsOptions | Yes | Options for selecting accounts. |
+| callback | AsyncCallback<[AppAccountInfo](#appaccountinfo)> | Yes | Callback invoked to return the result. |
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ var options = {
+ allowedOwners: ["com.example.ohos.accountjsdemo"]
+ };
+ appAccountManager.selectAccountsByOptions(options, (err, data) => {
+ console.log('selectAccountsByOptions: ' + JSON.stringify(data));
+ console.log("selectAccountsByOptions err: " + JSON.stringify(err));
+ });
+ ```
+
+### selectAccountsByOptions9+
+
+selectAccountsByOptions(options: SelectAccountsOptions): Promise<void>
+
+Selects the accounts accessible to the requester based on the options. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------------- | ------------------------- | ----- | --------------- |
+| options | [SelectAccountsOptions](#selectaccountsoptions9) | Yes | Options for selecting accounts. |
+
+**Parameters**
+
+| Type | Description |
+| ------------------- | -------------------------------- |
+| Promise<[AppAccountInfo](#appaccountinfo)> | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ var options = {
+ allowedOwners: ["com.example.ohos.accountjsdemo"]
+ };
+ appAccountManager.selectAccountsByOptions(options).then((data) => {
+ console.log('selectAccountsByOptions: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("selectAccountsByOptions err: " + JSON.stringify(err));
+ });
+ ```
+
+### verifyCredential9+
+
+verifyCredential(name: string, owner: string, callback: AuthenticatorCallback): void;
+
+Verifies the user credential. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | --------------------- | ----- | ----------------------- |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the verification result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.verifyCredential("zhangsan", "com.example.ohos.accountjsdemo", {
+ onResult: (resultCode, result) => {
+ console.log("verifyCredential onResult, resultCode:" + JSON.stringify(resultCode));
+ console.log("verifyCredential onResult, result:" + JSON.stringify(result));
+ },
+ onRequestRedirected: (request) => {
+ console.log("verifyCredential onRequestRedirected, request:" + JSON.stringify(request));
+ }
+ });
+ ```
+
+### verifyCredential9+
+
+verifyCredential(name: string, owner: string, options, callback: AuthenticatorCallback): void;
+
+Verifies the user credential. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | ----------------------- | ----- | ----------------------- |
+| name | string | Yes | Name of the target app account. |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app. |
+| options | [VerifyCredentialOptions](#verifycredentialoptions9) | Yes | Options for verifying the user credential. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the verification result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ var options = {
+ credentialType: "pin",
+ credential: "123456"
+ };
+ appAccountManager.verifyCredential("zhangsan", "com.example.ohos.accountjsdemo", options, {
+ onResult: (resultCode, result) => {
+ console.log("verifyCredential onResult, resultCode:" + JSON.stringify(resultCode));
+ console.log("verifyCredential onResult, result:" + JSON.stringify(result));
+ },
+ onRequestRedirected: (request) => {
+ console.log("verifyCredential onRequestRedirected, request:" + JSON.stringify(request));
+ }
+ });
+ ```
+
+### setAuthenticatorProperties9+
+
+setAuthenticatorProperties(owner: string, callback: AuthenticatorCallback): void;
+
+Sets authenticator properties. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | --------------------- | ----- | ----------------------- |
+| owner | string | Yes | Owner of the authenticator. |
+| options | [SetPropertiesOptions](#setpropertiesoptions9) | Yes | Authenticator properties to set. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.setAuthenticatorProperties("com.example.ohos.accountjsdemo", {
+ onResult: (resultCode, result) => {
+ console.log("setAuthenticatorProperties onResult, resultCode:" + JSON.stringify(resultCode));
+ console.log("setAuthenticatorProperties onResult, result:" + JSON.stringify(result));
+ },
+ onRequestRedirected: (request) => {
+ console.log("setAuthenticatorProperties onRequestRedirected, request:" + JSON.stringify(request));
+ }
+ });
+ ```
+
+### setAuthenticatorProperties9+
+
+setAuthenticatorProperties(owner: string, options: SetPropertiesOptions, callback: AuthenticatorCallback): void;
+
+Sets authenticator properties. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| -------- | --------------------- | ----- | ----------------------- |
+| owner | string | Yes | Owner of the authenticator. |
+| options | [SetPropertiesOptions](#setpropertiesoptions9) | Yes | Authenticator properties to set. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the result.|
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ var options = {
+ properties: {"prop1": "value1"}
+ };
+ appAccountManager.setAuthenticatorProperties("com.example.ohos.accountjsdemo", options, {
+ onResult: (resultCode, result) => {
+ console.log("setAuthenticatorProperties onResult, resultCode:" + JSON.stringify(resultCode));
+ console.log("setAuthenticatorProperties onResult, result:" + JSON.stringify(result));
+ },
+ onRequestRedirected: (request) => {
+ console.log("setAuthenticatorProperties onRequestRedirected, request:" + JSON.stringify(request));
+ }
+ });
+ ```
+
## AppAccountInfo
Defines app account information.
**System capability**: SystemCapability.Account.AppAccount
- | Name | Type | Mandatory | Description |
- | ----- | ------ | ---- | ----------- |
- | owner | string | Yes | Bundle name of the app. |
- | name | string | Yes | App account name. |
+| Name | Type | Mandatory | Description |
+| ----- | ------ | ---- | ----------- |
+| owner | string | Yes | Owner of the app account. The value is the bundle name of the app.|
+| name | string | Yes | Name of the target app account. |
## OAuthTokenInfo8+
-Defines OAuth access token information.
+Defines OAuth token information.
**System capability**: SystemCapability.Account.AppAccount
- | Name | Type | Mandatory | Description |
- | -------- | ------ | ---- | -------- |
- | authType | string | Yes | Authentication type. |
- | token | string | Yes | Value of the access token. |
+| Name | Type | Mandatory | Description |
+| -------- | ------ | ---- | -------- |
+| authType | string | Yes | Authentication type.|
+| token | string | Yes | Value of the token. |
## AuthenticatorInfo8+
@@ -1589,11 +1963,47 @@ Defines OAuth authenticator information.
**System capability**: SystemCapability.Account.AppAccount
- | Name | Type | Mandatory | Description |
- | ------- | ------ | ---- | ---------- |
- | owner | string | Yes | Bundle name of the authenticator owner. |
- | iconId | string | Yes | ID of the authenticator icon. |
- | labelId | string | Yes | ID of the authenticator label. |
+| Name | Type | Mandatory | Description |
+| ------- | ------ | ---- | ---------- |
+| owner | string | Yes | Owner of the authenticator. The value is the bundle name of the app.|
+| iconId | string | Yes | ID of the authenticator icon. |
+| labelId | string | Yes | ID of the authenticator label. |
+
+## SelectAccountsOptions9+
+
+Represents the options for selecting accounts.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+| Name | Type | Mandatory | Description |
+| --------------- | --------------------------- | ----- | ------------------- |
+| allowedAccounts | Array<[AppAccountInfo](#appAccountinfo)> | No | Allowed accounts. |
+| allowedOwners | Array<string> | No | Allowed account owners.|
+| requiredLabels | Array<string> | No | Labels required for the authenticator. |
+
+## VerifyCredentialOptions9+
+
+Represents the options for verifying the user credential.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+| Name | Type | Mandatory | Description |
+| -------------- | ---------------------- | ----- | -------------- |
+| credentialType | string | No | Type of the credential to verify. |
+| credential | string | No | Credential value. |
+| parameters | {[key:string]: Object} | No | Customized parameters.|
+
+
+## SetPropertiesOptions9+
+
+Represents the options for setting authenticator properties.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+| Name | Type | Mandatory | Description |
+| ---------- | ---------------------- | ----- | -------------- |
+| properties | {[key:string]: Object} | No | Authenticator properties to set. |
+| parameters | {[key:string]: Object} | No | Customized parameters.|
## Constants8+
@@ -1601,19 +2011,21 @@ Enumerates the constants.
**System capability**: SystemCapability.Account.AppAccount
- | Name | Default Value | Description |
- | ----------------------------- | ---------------------- | ------------- |
- | ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | Operation for implicitly adding an account. |
- | ACTION_AUTHENTICATE | "authenticate" | Authentication operation. |
- | KEY_NAME | "name" | App account name. |
- | KEY_OWNER | "owner" | App account owner. |
- | KEY_TOKEN | "token" | OAuth access token. |
- | KEY_ACTION | "action" | Action. |
- | KEY_AUTH_TYPE | "authType" | Authentication type. |
- | KEY_SESSION_ID | "sessionId" | Session ID. |
- | KEY_CALLER_PID | "callerPid" | Caller process ID (PID). |
- | KEY_CALLER_UID | "callerUid" | Caller user ID (UID). |
- | KEY_CALLER_BUNDLE_NAME | "callerBundleName" | Caller bundle name. |
+| Name | Default Value | Description |
+| ----------------------------- | ---------------------- | ------------- |
+| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | Operation of adding an account implicitly. |
+| ACTION_AUTHENTICATE | "authenticate" | Authentication operation. |
+| KEY_NAME | "name" | App account name. |
+| KEY_OWNER | "owner" | Owner of an app account.|
+| KEY_TOKEN | "token" | Token. |
+| KEY_ACTION | "action" | Operation. |
+| KEY_AUTH_TYPE | "authType" | Authentication type. |
+| KEY_SESSION_ID | "sessionId" | Session ID. |
+| KEY_CALLER_PID | "callerPid" | PID of the caller. |
+| KEY_CALLER_UID | "callerUid" | UID of the caller. |
+| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | Bundle name of the caller. |
+| KEY_REQUIRED_LABELS | "requiredLabels" | Required labels. |
+| KEY_BOOLEAN_RESULT | "booleanResult" | Return value of the Boolean type. |
## ResultCode8+
@@ -1621,45 +2033,45 @@ Enumerates the result codes.
**System capability**: SystemCapability.Account.AppAccount
- | Name | Default Value | Description |
- | ----------------------------------- | ----- | ------------ |
- | SUCCESS | 0 | The operation is successful. |
- | ERROR_ACCOUNT_NOT_EXIST | 10001 | The app account does not exist. |
- | ERROR_APP_ACCOUNT_SERVICE_EXCEPTION | 10002 | The app account service is abnormal. |
- | ERROR_INVALID_PASSWORD | 10003 | The password is invalid. |
- | ERROR_INVALID_REQUEST | 10004 | The request is invalid. |
- | ERROR_INVALID_RESPONSE | 10005 | The response is invalid. |
- | ERROR_NETWORK_EXCEPTION | 10006 | The network is abnormal. |
- | ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST | 10007 | The authenticator does not exist. |
- | ERROR_OAUTH_CANCELED | 10008 | The authentication is canceled. |
- | ERROR_OAUTH_LIST_TOO_LARGE | 10009 | The size of the OAuth list exceeds the limit. |
- | ERROR_OAUTH_SERVICE_BUSY | 10010 | The OAuth service is busy. |
- | ERROR_OAUTH_SERVICE_EXCEPTION | 10011 | The OAuth service is abnormal. |
- | ERROR_OAUTH_SESSION_NOT_EXIST | 10012 | The session to be authenticated does not exist. |
- | ERROR_OAUTH_TIMEOUT | 10013 | The authentication timed out. |
- | ERROR_OAUTH_TOKEN_NOT_EXIST | 10014 | The OAuth access token does not exist. |
- | ERROR_OAUTH_TOKEN_TOO_MANY | 10015 | The number of OAuth access tokens reaches the limit. |
- | ERROR_OAUTH_UNSUPPORT_ACTION | 10016 | The authentication operation is not supported. |
- | ERROR_OAUTH_UNSUPPORT_AUTH_TYPE | 10017 | The authentication type is not supported. |
- | ERROR_PERMISSION_DENIED | 10018 | The required permission is missing. |
+| Name | Default Value | Description |
+| ----------------------------------- | ----- | ------------ |
+| SUCCESS | 0 | The operation is successful. |
+| ERROR_ACCOUNT_NOT_EXIST | 10001 | The app account does not exist. |
+| ERROR_APP_ACCOUNT_SERVICE_EXCEPTION | 10002 | The app account service is abnormal. |
+| ERROR_INVALID_PASSWORD | 10003 | The password is invalid. |
+| ERROR_INVALID_REQUEST | 10004 | The request is invalid. |
+| ERROR_INVALID_RESPONSE | 10005 | The response is invalid. |
+| ERROR_NETWORK_EXCEPTION | 10006 | The network is abnormal. |
+| ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST | 10007 | The authenticator does not exist. |
+| ERROR_OAUTH_CANCELED | 10008 | The authentication is canceled. |
+| ERROR_OAUTH_LIST_TOO_LARGE | 10009 | The size of the OAuth list exceeds the limit. |
+| ERROR_OAUTH_SERVICE_BUSY | 10010 | The OAuth service is busy. |
+| ERROR_OAUTH_SERVICE_EXCEPTION | 10011 | The OAuth service is abnormal. |
+| ERROR_OAUTH_SESSION_NOT_EXIST | 10012 | The session to be authenticated does not exist. |
+| ERROR_OAUTH_TIMEOUT | 10013 | The authentication timed out. |
+| ERROR_OAUTH_TOKEN_NOT_EXIST | 10014 | The OAuth token does not exist.|
+| ERROR_OAUTH_TOKEN_TOO_MANY | 10015 | The number of OAuth tokens reaches the limit. |
+| ERROR_OAUTH_UNSUPPORT_ACTION | 10016 | The authentication operation is not supported. |
+| ERROR_OAUTH_UNSUPPORT_AUTH_TYPE | 10017 | The authentication type is not supported. |
+| ERROR_PERMISSION_DENIED | 10018 | The required permission is missing. |
## AuthenticatorCallback8+
-Provides methods for managing the OAuth authenticator callback.
+Provides OAuth authenticator callbacks.
### onResult8+
onResult: (code: number, result: {[key: string]: any}) => void
-Called back to send the authentication result.
+Returns the result of an authentication request.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ------ | -------------------- | ---- | ------ |
- | code | number | Yes | Authentication result code. |
- | result | {[key: string]: any} | Yes | Authentication result. |
+| Name | Type | Mandatory | Description |
+| ------ | -------------------- | ---- | ------ |
+| code | number | Yes | Authentication result code.|
+| result | {[key: string]: any} | Yes | Authentication result. |
**Example**
@@ -1681,14 +2093,14 @@ Called back to send the authentication result.
onRequestRedirected: (request: Want) => void
-Called back to redirect an authentication request.
+Redirects a request.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ------- | ---- | ---- | ---------- |
- | request | Want | Yes | Request to be redirected. |
+| Name | Type | Mandatory | Description |
+| ------- | ---- | ---- | ---------- |
+| request | Want | Yes | Request to be redirected.|
**Example**
@@ -1710,42 +2122,128 @@ Called back to redirect an authentication request.
}
```
+### onRequestContinued9+
+
+onRequestContinued: () => void
+
+Continues to process the request.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Example**
+
+ ```js
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ var sessionId = "1234";
+ appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
+ callback.OnRequestContinued();
+ }).catch((err) => {
+ console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
+ });
+ ```
+
## Authenticator8+
-Defines the OAuth authenticator base class.
+Provides APIs to operate the authenticator.
### addAccountImplicitly8+
addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
-Implicitly adds an app account based on the specified authentication type and options. This method uses an asynchronous callback to return the result.
+Implicitly adds an app account based on the specified authentication type and options. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------------- | --------------------- | ---- | --------------- |
- | authType | string | Yes | Authentication type. |
- | callerBundleName | string | Yes | Bundle name of the authentication requester. |
- | options | {[key: string]: any} | Yes | Options for the authentication. |
- | callback | AuthenticatorCallback | Yes | Authenticator callback invoked to return the authentication result. |
+| Name | Type | Mandatory | Description |
+| ---------------- | --------------------- | ---- | --------------- |
+| authType | string | Yes | Authentication type. |
+| callerBundleName | string | Yes | Bundle name of the authentication requester. |
+| options | {[key: string]: any} | Yes | Options for the authentication. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the authentication result.|
### authenticate8+
authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void
-Authenticates an app account to obtain the OAuth access token. This method uses an asynchronous callback to return the result.
+Authenticates an app account to obtain the OAuth access token. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Account.AppAccount
**Parameters**
- | Name | Type | Mandatory | Description |
- | ---------------- | --------------------- | ---- | --------------- |
- | name | string | Yes | App account name. |
- | authType | string | Yes | Authentication type. |
- | callerBundleName | string | Yes | Bundle name of the authentication requester. |
- | options | {[key: string]: any} | Yes | Options for the authentication. |
- | callback | AuthenticatorCallback | Yes | Authenticator callback invoked to return the authentication result. |
+| Name | Type | Mandatory | Description |
+| ---------------- | --------------------- | ---- | --------------- |
+| name | string | Yes | Name of the target app account. |
+| authType | string | Yes | Authentication type. |
+| callerBundleName | string | Yes | Bundle name of the authentication requester. |
+| options | {[key: string]: any} | Yes | Options for the authentication. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the authentication result.|
+
+### verifyCredential9+
+
+verifyCredential(name: string, options: VerifyCredentialOptions, callback: AuthenticatorCallback): void;
+
+Verifies the app account credential. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+| Name | Type | Mandatory | Description |
+| ---------------- | --------------------- | ---- | --------------- |
+| name | string | Yes | Name of the target app account. |
+| options | [VerifyCredentialOptions](#verifycredentialoptions9) | Yes | Optional for credential verification. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the verification result.|
+
+### setProperties9+
+
+setProperties(options: SetPropertiesOptions, callback: AuthenticatorCallback): void;
+
+Sets authenticator properties. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+| Name | Type | Mandatory | Description |
+| ---------------- | --------------------- | ---- | --------------- |
+| options | [SetPropertiesOptions](#setpropertiesoptions9) | Yes | Authenticator properties to set. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the result.|
+
+### checkAccountLabels9+
+
+checkAccountLabels(name: string, labels: Array<string>, callback: AuthenticatorCallback): void;
+
+Checks the account labels. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+| Name | Type | Mandatory | Description |
+| ---------------- | --------------------- | ---- | --------------- |
+| name | string | Yes | Name of the target app account. |
+| labels | Array<string> | Yes | Labels to check. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the check result.|
+
+### isAccountRemovable9+
+
+isAccountRemovable(name: string, callback: AuthenticatorCallback): void;
+
+Checks whether an app account can be deleted. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Account.AppAccount
+
+**Parameters**
+| Name | Type | Mandatory | Description |
+| ---------------- | --------------------- | ---- | --------------- |
+| name | string | Yes | Name of the target app account. |
+| callback | [AuthenticatorCallback](#authenticatorcallback8) | Yes | Authenticator callback invoked to return the result.|
+
+### getRemoteObject9+
+
+getRemoteObject(): rpc.RemoteObject;
+
+Obtains the remote object of an authenticator. This API cannot be overloaded.
+
+**System capability**: SystemCapability.Account.AppAccount
**Example**
@@ -1764,11 +2262,36 @@ Authenticates an app account to obtain the OAuth access token. This method uses
[account_appAccount.Constants.KEY_TOKEN]: "xxxxxx"};
callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
}
- }
+ verifyCredential(name: string, options: VerifyCredentialOptions, callback: AuthenticatorCallback) {
+ callback.onRequestRedirected({
+ bundleName: "com.example.ohos.accountjsdemo",
+ abilityName: "com.example.ohos.accountjsdemo.VerifyAbility",
+ parameters: {
+ name: name
+ }
+ });
+ }
+
+ setProperties(options: SetPropertiesOptions, callback: AuthenticatorCallback) {
+ callback.onResult(account_appAccount.ResultCode.SUCCESS, {});
+ }
+
+ checkAccountLabels(name: string, labels: Array, callback: AuthenticatorCallback) {
+ var result = {[account_appAccount.Constants.KEY_BOOLEAN_RESULT]: false};
+ callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
+ }
+
+ isAccountRemovable(name, callback) {
+ var result = {[account_appAccount.Constants.KEY_BOOLEAN_RESULT]: true};
+ callback.onResult(account_appAccount.ResultCode.SUCCESS, result);
+ }
+ }
+ var authenticator = null;
export default {
onConnect(want) {
- return new MyAuthenticator();
+ authenticator = new MyAuthenticator();
+ return authenticator.getRemoteObject();
}
}
- ```
\ No newline at end of file
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md
index 8c2e4f41606e44f93d872427c2c81b1ecf70cb4f..1e280124850de1ccfa9658365d97c3219b1d5b2b 100644
--- a/en/application-dev/reference/apis/js-apis-bluetooth.md
+++ b/en/application-dev/reference/apis/js-apis-bluetooth.md
@@ -1,9 +1,9 @@
# Bluetooth
->  **NOTE**
+> **NOTE**
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
->
-> The Bluetooth module provides Classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.
+
+Provides classic Bluetooth capabilities and Bluetooth Low Energy (BLE) scan and advertising.
## Modules to Import
@@ -201,7 +201,7 @@ Obtains the connection state of a profile.
| Name | Type | Mandatory | Description |
| --------- | --------- | ---- | ------------------------------------- |
-| ProfileId | profileId | Yes | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.|
+| ProfileId | profileId | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.|
**Return value**
@@ -212,7 +212,7 @@ Obtains the connection state of a profile.
**Example**
```js
-let result = bluetooth.getProfileConnState(PROFILE_A2DP_SOURCE);
+let result = bluetooth.getProfileConnState(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
```
@@ -355,7 +355,7 @@ Sets the Bluetooth scan mode so that the device can be discovered by a remote de
```js
// The device can be discovered and connected only when the discoverable and connectable mode is used.
-let result = bluetooth.setBluetoothScanMode(ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 100);
+let result = bluetooth.setBluetoothScanMode(bluetooth.ScanMode.SCAN_MODE_CONNECTABLE_GENERAL_DISCOVERABLE, 100);
```
@@ -720,7 +720,7 @@ bluetooth.off('stateChange', onReceiveEvent);
```
-## bluetooth.sppListen8+
+## bluetooth.sppListen8+
sppListen(name: string, option: SppOption, callback: AsyncCallback<number>): void
@@ -773,6 +773,14 @@ Listens for a connection to be made to this socket from the client and accepts i
**Example**
```js
+let serverNumber = -1;
+function serverSocket(code, number) {
+ console.log('bluetooth error code: ' + code.code);
+ if (code.code == 0) {
+ console.log('bluetooth serverSocket Number: ' + number);
+ serverNumber = number;
+ }
+}
let clientNumber = -1;
function acceptClientSocket(code, number) {
console.log('bluetooth error code: ' + code.code);
@@ -807,6 +815,7 @@ Initiates an SPP connection to a remote device from the client.
**Example**
```js
+
let clientNumber = -1;
function clientSocket(code, number) {
if (code.code != 0) {
@@ -838,6 +847,14 @@ Closes the listening socket of the server.
**Example**
```js
+let serverNumber = -1;
+function serverSocket(code, number) {
+ console.log('bluetooth error code: ' + code.code);
+ if (code.code == 0) {
+ console.log('bluetooth serverSocket Number: ' + number);
+ serverNumber = number;
+ }
+}
bluetooth.sppCloseServerSocket(serverNumber);
```
@@ -860,6 +877,15 @@ Closes the client socket.
**Example**
```js
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
bluetooth.sppCloseClientSocket(clientNumber);
```
@@ -888,6 +914,15 @@ Writes data to the remote device through the socket.
**Example**
```js
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
let arrayBuffer = new ArrayBuffer(8);
let data = new Uint8Array(arrayBuffer);
data[0] = 123;
@@ -923,6 +958,15 @@ No value is returned.
**Example**
```js
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
function dataRead(dataBuffer) {
let data = new Uint8Array(dataBuffer);
console.log('bluetooth data is: ' + data[0]);
@@ -954,6 +998,15 @@ No value is returned.
**Example**
```js
+let clientNumber = -1;
+function clientSocket(code, number) {
+ if (code.code != 0) {
+ return;
+ }
+ console.log('bluetooth serverSocket Number: ' + number);
+ // The obtained clientNumber is used as the socket ID for subsequent read/write operations on the client.
+ clientNumber = number;
+}
bluetooth.off('sppRead', clientNumber);
```
@@ -981,14 +1034,14 @@ Obtains a profile object.
**Example**
```js
-let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
+let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
```
## bluetooth.getProfile9+
getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile
-Obtains the profile object instance based on **ProfileId**. API version 9 is added with **HidHostProfile**.
+Obtains a profile instance. **HidHostProfile** is added in API version 9.
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -996,7 +1049,7 @@ Obtains the profile object instance based on **ProfileId**. API version 9 is add
| Name | Type | Mandatory | Description |
| --------- | --------- | ---- | ------------------------------------- |
-| profileId | [ProfileId](#ProfileId) | Yes | ID of the target profile, for example, **PROFILE_A2DP_SOURCE**.|
+| profileId | [ProfileId](#ProfileId) | Yes | ID of the profile to obtain, for example, **PROFILE_A2DP_SOURCE**.|
**Return value**
@@ -1007,7 +1060,7 @@ Obtains the profile object instance based on **ProfileId**. API version 9 is add
**Example**
```js
-let hidHost = bluetooth.getProfile(PROFILE_HID_HOST);
+let hidHost = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HID_HOST);
```
@@ -1239,7 +1292,7 @@ No value is returned.
**Example**
```js
-let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE)
+let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE)
let retArray = a2dpSrc.getConnectionDevices();
```
@@ -1257,7 +1310,7 @@ Obtains the connection state of the profile.
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
-| device | string | Yes | Address of the remote device.|
+| device | string | Yes | Address of the target device.|
**Return value**
@@ -1268,7 +1321,7 @@ Obtains the connection state of the profile.
**Example**
```js
-let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE)
+let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE)
let ret = a2dpSrc.getDeviceState('XX:XX:XX:XX:XX:XX');
```
@@ -1277,7 +1330,7 @@ let ret = a2dpSrc.getDeviceState('XX:XX:XX:XX:XX:XX');
Before using a method of **A2dpSourceProfile**, you need to create an instance of this class by using the **getProfile()** method.
-### connect8+
+### connect8+
connect(device: string): boolean
@@ -1302,12 +1355,12 @@ Sets up an Advanced Audio Distribution Profile (A2DP) connection.
**Example**
```js
-let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE)
+let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE)
let ret = a2dpSrc.connect('XX:XX:XX:XX:XX:XX');
```
-### disconnect8+
+### disconnect8+
disconnect(device: string): boolean
@@ -1332,7 +1385,7 @@ Disconnects an A2DP connection.
**Example**
```js
-let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
+let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
let ret = a2dpSrc.disconnect('XX:XX:XX:XX:XX:XX');
```
@@ -1362,7 +1415,7 @@ No value is returned.
function onReceiveEvent(data) {
console.info('a2dp state = '+ JSON.stringify(data));
}
-let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
+let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
a2dpSrc.on('connectionStateChange', onReceiveEvent);
```
@@ -1392,7 +1445,7 @@ No value is returned.
function onReceiveEvent(data) {
console.info('a2dp state = '+ JSON.stringify(data));
}
-let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
+let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
a2dpSrc.on('connectionStateChange', onReceiveEvent);
a2dpSrc.off('connectionStateChange', onReceiveEvent);
```
@@ -1410,7 +1463,7 @@ Obtains the playing state of a device.
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
-| device | string | Yes | Address of the remote device.|
+| device | string | Yes | Address of the target device.|
**Return value**
@@ -1421,7 +1474,7 @@ Obtains the playing state of a device.
**Example**
```js
-let a2dpSrc = bluetooth.getProfile(PROFILE_A2DP_SOURCE);
+let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX');
```
@@ -1431,7 +1484,7 @@ let state = a2dpSrc.getPlayingState('XX:XX:XX:XX:XX:XX');
Before using a method of **HandsFreeAudioGatewayProfile**, you need to create an instance of this class by using the **getProfile()** method.
-### connect8+
+### connect8+
connect(device: string): boolean
@@ -1445,7 +1498,7 @@ Sets up a Hands-free Profile (HFP) connection of a device.
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
-| device | string | Yes | Address of the remote device.|
+| device | string | Yes | Address of the target device.|
**Return value**
@@ -1456,12 +1509,12 @@ Sets up a Hands-free Profile (HFP) connection of a device.
**Example**
```js
-let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY);
+let hfpAg = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
let ret = hfpAg.connect('XX:XX:XX:XX:XX:XX');
```
-### disconnect8+
+### disconnect8+
disconnect(device: string): boolean
@@ -1475,7 +1528,7 @@ Disconnects the HFP connection of a device.
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
-| device | string | Yes | Address of the remote device.|
+| device | string | Yes | Address of the target device.|
**Return value**
@@ -1486,7 +1539,7 @@ Disconnects the HFP connection of a device.
**Example**
```js
-let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY);
+let hfpAg = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
let ret = hfpAg.disconnect('XX:XX:XX:XX:XX:XX');
```
@@ -1516,7 +1569,7 @@ No value is returned.
function onReceiveEvent(data) {
console.info('hfp state = '+ JSON.stringify(data));
}
-let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY);
+let hfpAg = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
hfpAg.on('connectionStateChange', onReceiveEvent);
```
@@ -1546,7 +1599,7 @@ No value is returned.
function onReceiveEvent(data) {
console.info('hfp state = '+ JSON.stringify(data));
}
-let hfpAg = bluetooth.getProfile(PROFILE_HANDS_FREE_AUDIO_GATEWAY);
+let hfpAg = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HANDS_FREE_AUDIO_GATEWAY);
hfpAg.on('connectionStateChange', onReceiveEvent);
hfpAg.off('connectionStateChange', onReceiveEvent);
```
@@ -1573,7 +1626,7 @@ Connects to the HidHost service of a device.
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
-| device | string | Yes | Address of the remote device.|
+| device | string | Yes | Address of the target device.|
**Return value**
@@ -1584,7 +1637,7 @@ Connects to the HidHost service of a device.
**Example**
```js
-let hidHostProfile = bluetooth.getProfile(PROFILE_HID_HOST);
+let hidHostProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HID_HOST);
let ret = hidHostProfile.connect('XX:XX:XX:XX:XX:XX');
```
@@ -1605,7 +1658,7 @@ Disconnects from the HidHost service of a device.
| Name | Type | Mandatory | Description |
| ------ | ------ | ---- | ------- |
-| device | string | Yes | Address of the remote device.|
+| device | string | Yes | Address of the target device.|
**Return value**
@@ -1616,7 +1669,7 @@ Disconnects from the HidHost service of a device.
**Example**
```js
-let hidHostProfile = bluetooth.getProfile(PROFILE_HID_HOST);
+let hidHostProfile = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HID_HOST);
let ret = hidHostProfile.disconnect('XX:XX:XX:XX:XX:XX');
```
@@ -1646,7 +1699,7 @@ No value is returned.
function onReceiveEvent(data) {
console.info('hidHost state = '+ JSON.stringify(data));
}
-let hidHost = bluetooth.getProfile(PROFILE_HID_HOST);
+let hidHost = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HID_HOST);
hidHost.on('connectionStateChange', onReceiveEvent);
```
@@ -1676,7 +1729,7 @@ No value is returned.
function onReceiveEvent(data) {
console.info('hidHost state = '+ JSON.stringify(data));
}
-let hidHost = bluetooth.getProfile(PROFILE_HID_HOST);
+let hidHost = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HID_HOST);
hidHost.on('connectionStateChange', onReceiveEvent);
hidHost.off('connectionStateChange', onReceiveEvent);
```
@@ -1819,7 +1872,7 @@ cccV[0] = 1;
let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
let characteristicN = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
- characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptorsN};
+ characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
characteristics[0] = characteristic;
// Create a gattService instance.
@@ -1911,8 +1964,11 @@ Notifies the connected client device when a characteristic value changes.
**Example**
```js
+let arrayBufferC = new ArrayBuffer(8);
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
let notifyCharacteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
- characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: notifyCcc.characteristicValue, confirm: false};
+ characteristicUuid: '00001821-0000-1000-8000-00805F9B34FB', characteristicValue: characteristic.characteristicValue, confirm: false};
let server = bluetooth.BLE.createGattServer();
server.notifyCharacteristicChanged('XX:XX:XX:XX:XX:XX', notifyCharacteristic);
```
@@ -2138,7 +2194,7 @@ Subscribes to the descriptor read request events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | --------------------------------- |
| type | string | Yes | Event type. The value **descriptorRead** indicates a descriptor read request event.|
-| callback | Callback<[DescriptorReadReq](#descriptorreadreq)> | Yes | Callback invoked to return a descriptor read request from the GATT client. |
+| callback | Callback<[DescriptorReadReq](#descriptorreadreq)> | Yes | Callback invoked to return a descriptor read request event from the GATT client. |
**Return value**
@@ -2279,7 +2335,6 @@ let gattServer = bluetooth.BLE.createGattServer();
gattServer.off("descriptorWrite");
```
-
### on('connectStateChange')
on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void
@@ -2488,7 +2543,7 @@ Obtains all services of the remote BLE device. This API uses a promise to return
// Promise
let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX');
device.connect();
-let services = device.getServices();
+var services = device.getServices();
console.log("bluetooth services size is ", services.length);
for (let i = 0; i < services.length; i++) {
@@ -2826,8 +2881,11 @@ Sets the function of notifying the GATT client when the characteristic value of
**Example**
```js
+let arrayBufferC = new ArrayBuffer(8);
+let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
+ characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB', characteristicValue: arrayBufferC, descriptors:descriptors};
let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX');
-device.setNotifyCharacteristicChanged(notifyCcc, false);
+device.setNotifyCharacteristicChanged(characteristic, false);
```
@@ -3296,11 +3354,19 @@ Defines the scan filter parameters.
**System capability**: SystemCapability.Communication.Bluetooth.Core
-| Name | Type | Readable | Writable | Description |
-| ----------- | ------ | ---- | ---- | ---------------------------------------- |
-| deviceId | string | Yes | Yes | Address of the BLE device to filter, for example, XX:XX:XX:XX:XX:XX. |
-| name | string | Yes | Yes | Name of the BLE device to filter. |
-| serviceUuid | string | Yes | Yes | UUID of the service, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+| Name | Type | Readable| Writable| Description |
+| ---------------------------------------- | ----------- | ---- | ---- | ------------------------------------------------------------ |
+| deviceId | string | Yes | Yes | Address of the BLE device to filter, for example, XX:XX:XX:XX:XX:XX. |
+| name | string | Yes | Yes | Name of the BLE device to filter. |
+| serviceUuid | string | Yes | Yes | Service UUID of the device to filter, for example, **00001888-0000-1000-8000-00805f9b34fb**.|
+| serviceUuidMask9+ | string | Yes | Yes | Service UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.|
+| serviceSolicitationUuid9+ | string | Yes | Yes | Service solicitation UUID of the device to filter, for example, **00001888-0000-1000-8000-00805F9B34FB**.|
+| serviceSolicitationUuidMask9+ | string | Yes | Yes | Service solicitation UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.|
+| serviceData9+ | ArrayBuffer | Yes | Yes | Service data of the device to filter, for example, **[0x90, 0x00, 0xF1, 0xF2]**.|
+| serviceDataMask9+ | ArrayBuffer | Yes | Yes | Service data mask of the device to filter, for example, **[0xFF,0xFF,0xFF,0xFF]**.|
+| manufacturerId9+ | number | Yes | Yes | Manufacturer ID of the device to filter, for example, **0x0006**. |
+| manufactureData9+ | ArrayBuffer | Yes | Yes | Manufacturer data of the device to filter, for example, **[0x1F,0x2F,0x3F]**.|
+| manufactureDataMask9+ | ArrayBuffer | Yes | Yes | Manufacturer data mask of the device to filter, for example, **[0xFF, 0xFF, 0xFF]**.|
## ScanOptions
diff --git a/en/application-dev/reference/apis/js-apis-data-rdb.md b/en/application-dev/reference/apis/js-apis-data-rdb.md
index de6f685f0559aab651ccd14d14386d3e77e2663a..ac26222e5da8c26216901b3de93bec9b4f22133b 100644
--- a/en/application-dev/reference/apis/js-apis-data-rdb.md
+++ b/en/application-dev/reference/apis/js-apis-data-rdb.md
@@ -1,6 +1,14 @@
# Relational Database
+The relational database (RDB) manages data based on relational models. With the underlying SQLite database, the RDB provides a complete mechanism for managing local databases. To satisfy different needs in complicated scenarios, the RDB offers a series of methods for performing operations such as adding, deleting, modifying, and querying data, and supports direct execution of SQL statements.
+
+This module provides the following RDB-related functions:
+
+- [RdbPredicates](#rdbpredicates): predicates indicating the nature, feature, or relationship of a data entity in an RDB store. It is used to define the operation conditions for an RDB store.
+- [RdbStore](#rdbstore): provides APIs for managing an RDB store.
+
> **NOTE**
+>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -11,71 +19,9 @@ import data_rdb from '@ohos.data.rdb';
## data_rdb.getRdbStore
-getRdbStore(config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void
-
-Obtains a relational database (RDB) store. This API uses an asynchronous callback to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.|
-| version | number | Yes| RDB store version.|
-| callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes| Callback invoked to return the RDB store obtained.|
-
-**Example**
-
-```js
-const STORE_CONFIG = { name: "RdbTest.db"}
-data_rdb.getRdbStore(STORE_CONFIG, 1, function (err, rdbStore) {
- if (err) {
- console.info("Failed to get RdbStore, err: " + err)
- return
- }
- console.log("Got RdbStore successfully.")
-})
-```
-## data_rdb.getRdbStore
-
-getRdbStore(config: StoreConfig, version: number): Promise<RdbStore>
-
-Obtains an RDB store. This API uses a promise to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.|
-| version | number | Yes| RDB store version.|
-
-**Return value**
-
-| Type| Description|
-| -------- | -------- |
-| Promise<[RdbStore](#rdbstore)> | Promise used to return the RDB store obtained.|
-
-**Example**
-
-```js
-const STORE_CONFIG = { name: "RdbTest.db" }
-let promise = data_rdb.getRdbStore(STORE_CONFIG, 1);
-promise.then(async (rdbStore) => {
- console.log("Got RdbStore successfully.")
-}).catch((err) => {
- console.log("Failed to get RdbStore, err: " + err)
-})
-```
-
-
-## data_rdb.getRdbStore8+
-
getRdbStore(context: Context, config: StoreConfig, version: number, callback: AsyncCallback<RdbStore>): void
-Obtains a RDB store. This API uses an asynchronous callback to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations.
+Obtains an RDB store. This API uses an asynchronous callback to return the result. You can set parameters for the RDB store based on service requirements and call APIs to perform data operations.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
@@ -83,7 +29,7 @@ Obtains a RDB store. This API uses an asynchronous callback to return the result
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| context8+ | Context | Yes| Context of the app or functionality. For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes| Context of the application or functionality. See [Context](js-apis-Context.md) for versions earlier than API version 9. See [Context](js-apis-ability-context.md) for API version 9 or later.|
| config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.|
| version | number | Yes| RDB store version.|
| callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes| Callback invoked to return the RDB store obtained.|
@@ -101,7 +47,7 @@ data_rdb.getRdbStore(this.context, STORE_CONFIG, 1, function (err, rdbStore) {
})
```
-## data_rdb.getRdbStore8+
+## data_rdb.getRdbStore
getRdbStore(context: Context, config: StoreConfig, version: number): Promise<RdbStore>
@@ -113,7 +59,7 @@ Obtains an RDB store. This API uses a promise to return the result. You can set
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| context8+ | Context | Yes| Context of the app or functionality. For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes| Context of the application or functionality. See [Context](js-apis-Context.md) for versions earlier than API version 9. See [Context](js-apis-ability-context.md) for API version 9 or later.|
| config | [StoreConfig](#storeconfig) | Yes| Configuration of the RDB store.|
| version | number | Yes| RDB store version.|
@@ -137,68 +83,16 @@ promise.then(async (rdbStore) => {
## data_rdb.deleteRdbStore
-deleteRdbStore(name: string, callback: AsyncCallback<void>): void
-
-Deletes an RDB store. This API uses an asynchronous callback to return the result.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| name | string | Yes| Name of the RDB store to delete.|
-| callback | AsyncCallback<void> | Yes| Callback invoked to return the result.|
-
-**Example**
-```js
-data_rdb.deleteRdbStore("RdbTest.db", function (err, rdbStore) {
- if (err) {
- console.info("Failed to delete RdbStore, err: " + err)
- return
- }
- console.log("Deleted RdbStore successfully.")
-})
-```
- ## data_rdb.deleteRdbStore
-
-deleteRdbStore(name: string): Promise<void>
-
-Deletes an RDB store. This API uses a promise to return the result.
-
-**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-
-**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| name | string | Yes| Name of the RDB store to delete.|
-
-**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<void> | Promise used to return the result.|
-
-**Example**
-```js
-let promise = data_rdb.deleteRdbStore("RdbTest.db")
-promise.then(()=>{
- console.log("Deleted RdbStore successfully.")
-}).catch((err) => {
- console.info("Failed to delete RdbStore, err: " + err)
-})
-```
-
-## data_rdb.deleteRdbStore8+
-
deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void>): void
-Deletes an RDB store. This API uses a callback to return the result.
+Deletes an RDB store. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| context8+ | Context | Yes| Context of the app or functionality. For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes| Context of the application or functionality. See [Context](js-apis-Context.md) for versions earlier than API version 9. See [Context](js-apis-ability-context.md) for API version 9 or later.|
| name | string | Yes| Name of the RDB store to delete.|
| callback | AsyncCallback<void> | Yes| Callback invoked to return the result.|
@@ -213,7 +107,7 @@ data_rdb.deleteRdbStore(this.context, "RdbTest.db", function (err, rdbStore) {
})
```
-## data_rdb.deleteRdbStore8+
+## data_rdb.deleteRdbStore
deleteRdbStore(context: Context, name: string): Promise<void>
@@ -224,7 +118,7 @@ Deletes an RDB store. This API uses a promise to return the result.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| context8+ | Context | Yes| Context of the app or functionality. For the definition of **Context** of API version 8, see [Context](js-apis-Context.md). For the definition of **Context** of API version 9, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes| Context of the application or functionality. See [Context](js-apis-Context.md) for versions earlier than API version 9. See [Context](js-apis-ability-context.md) for API version 9 or later.|
| name | string | Yes| Name of the RDB store to delete.|
**Return value**
@@ -234,7 +128,7 @@ Deletes an RDB store. This API uses a promise to return the result.
**Example**
```js
-let promise = data_rdb.deleteRdbStore("RdbTest.db")
+let promise = data_rdb.deleteRdbStore(this.context, "RdbTest.db")
promise.then(()=>{
console.log("Deleted RdbStore successfully.")
}).catch((err) => {
@@ -1090,7 +984,7 @@ rdbStore.insert("EMPLOYEE", valueBucket, function (err, ret) {
console.info("Failed to insert data, err: " + err)
return
}
- console.log("Insert first done: " + ret)
+ console.log("Inserted first row: " + ret)
})
```
@@ -1215,7 +1109,7 @@ Updates data in the database based on the specified **DataSharePredicates** obje
| -------- | -------- | -------- | -------- |
| table | string | Yes| Name of the target table.|
| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to be updated in the database. The key-value pair is associated with the column name in the target table.|
-| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes| Update conditions specified by the **DataSharePredicates** object.|
+| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates)| Yes| Update conditions specified by the **DataSharePredicates** object.|
| callback | AsyncCallback<number> | Yes| Callback used to return the number of rows updated.|
**Example**
@@ -1239,7 +1133,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) {
```
### update9+
-update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise<number>
+update(table: string, values: ValuesBucket, predicates: DataSharePredicates):Promise<number>
Updates data in the database based on the specified **DataSharePredicates** object. This API uses a promise to return the result.
@@ -1300,7 +1194,7 @@ rdbStore.delete(predicates, function (err, rows) {
console.info("Failed to delete data, err: " + err)
return
}
- console.log("Delete rows: " + rows)
+ console.log("Deleted rows: " + rows)
})
```
@@ -1329,7 +1223,7 @@ let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Lisa")
let promise = rdbStore.delete(predicates)
promise.then((rows) => {
- console.log("Delete rows: " + rows)
+ console.log("Deleted rows: " + rows)
}).catch((err) => {
console.info("Failed to delete data, err: " + err)
})
@@ -1337,7 +1231,7 @@ promise.then((rows) => {
### delete9+
-delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void
+delete(table: string, predicates: DataSharePredicates, callback: AsyncCallback<number>):void
Deletes data from the database based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result.
@@ -1361,12 +1255,12 @@ rdbStore.delete("EMPLOYEE", predicates, function (err, rows) {
console.info("Failed to delete data, err: " + err)
return
}
- console.log("Delete rows: " + rows)
+ console.log("Deleted rows: " + rows)
})
```
### delete9+
-delete(table: string, predicates: DataSharePredicates):Promise<number>
+delete(table: string, predicates: dataSharePredicates.DataSharePredicates):Promise<number>
Deletes data from the database based on the specified **DataSharePredicates** object. This API uses a promise to return the result.
@@ -1390,7 +1284,7 @@ let predicates = new dataSharePredicates.DataSharePredicates()
predicates.equalTo("NAME", "Lisa")
let promise = rdbStore.delete("EMPLOYEE", predicates)
promise.then((rows) => {
- console.log("Delete rows: " + rows)
+ console.log("Deleted rows: " + rows)
}).catch((err) => {
console.info("Failed to delete data, err: " + err)
})
@@ -1417,7 +1311,7 @@ let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose")
rdbStore.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err, resultSet) {
if (err) {
- console.info("Query failed, err: " + err)
+ console.info("Failed to query data, err: " + err)
return
}
console.log("ResultSet column names: " + resultSet.columnNames)
@@ -1454,13 +1348,13 @@ Queries data in the database based on specified conditions. This API uses a prom
console.log("ResultSet column names: " + resultSet.columnNames)
console.log("ResultSet column count: " + resultSet.columnCount)
}).catch((err) => {
- console.info("Query failed, err: " + err)
+ console.info("Failed to query data, err: " + err)
})
```
### query9+
-query(predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void
+query(predicates: DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void
Queries data in the database based on specified conditions. This API uses an asynchronous callback to return the result.
@@ -1480,7 +1374,7 @@ let predicates = new dataSharePredicates.DataSharePredicates()
predicates.equalTo("NAME", "Rose")
rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"], function (err, resultSet) {
if (err) {
- console.info("Query failed, err: " + err)
+ console.info("Failed to query data, err: " + err)
return
}
console.log("ResultSet column names: " + resultSet.columnNames)
@@ -1490,7 +1384,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"],
### query9+
-query(predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSet>
+query(predicates: DataSharePredicates, columns?: Array<string>):Promise<ResultSet>
Queries data in the database based on specified conditions. This API uses a promise to return the result.
@@ -1517,7 +1411,7 @@ promise.then((resultSet) => {
console.log("ResultSet column names: " + resultSet.columnNames)
console.log("ResultSet column count: " + resultSet.columnCount)
}).catch((err) => {
- console.info("Query failed, err: " + err)
+ console.info("Failed to query data, err: " + err)
})
```
@@ -1540,7 +1434,7 @@ Queries data in the RDB store using the specified SQL statement. This API uses a
```js
rdbStore.querySql("SELECT * FROM EMPLOYEE CROSS JOIN BOOK WHERE BOOK.NAME = ?", ['sanguo'], function (err, resultSet) {
if (err) {
- console.info("Query failed, err: " + err)
+ console.info("Failed to query data, err: " + err)
return
}
console.log("ResultSet column names: " + resultSet.columnNames)
@@ -1575,7 +1469,7 @@ promise.then((resultSet) => {
console.log("ResultSet column names: " + resultSet.columnNames)
console.log("ResultSet column count: " + resultSet.columnCount)
}).catch((err) => {
- console.info("Query failed, err: " + err)
+ console.info("Failed to query data, err: " + err)
})
```
@@ -1600,7 +1494,7 @@ Runs the SQL statement that contains the specified parameters but does not retur
const SQL_CREATE_TABLE = "CREATE TABLE IF NOT EXISTS EMPLOYEE (ID INTEGER PRIMARY KEY AUTOINCREMENT, NAME TEXT NOT NULL, AGE INTEGER, SALARY REAL, CODES BLOB)"
rdbStore.executeSql(SQL_CREATE_TABLE, null, function(err) {
if (err) {
- console.info("ExecuteSql failed, err: " + err)
+ console.info("Failed to execute SQL, err: " + err)
return
}
console.info('Create table done.')
@@ -1634,7 +1528,7 @@ let promise = rdbStore.executeSql(SQL_CREATE_TABLE)
promise.then(() => {
console.info('Create table done.')
}).catch((err) => {
- console.info("ExecuteSql failed, err: " + err)
+ console.info("Failed to execute SQL, err: " + err)
})
```
@@ -1745,10 +1639,10 @@ Backs up the database with the specified name. This API uses an asynchronous cal
```js
rdbStore.backup("dbBackup.db", function(err) {
if (err) {
- console.info('Backup failed, err: ' + err)
+ console.info('Failed to back up data, err: ' + err)
return
}
- console.info('Backup success.')
+ console.info('Backup successful.')
})
```
@@ -1774,9 +1668,9 @@ Backs up the database with the specified name. This API uses a promise to return
```js
let promiseBackup = rdbStore.backup("dbBackup.db")
promiseBackup.then(()=>{
- console.info('Backup success.')
+ console.info('Backup successful.')
}).catch((err)=>{
- console.info('Backup failed, err: ' + err)
+ console.info('Failed to back up data, err: ' + err)
})
```
@@ -1798,10 +1692,10 @@ Restores a database from a specified database backup file. This API uses an asyn
```js
rdbStore.restore("dbBackup.db", function(err) {
if (err) {
- console.info('Restore failed, err: ' + err)
+ console.info('Failed to restore data, err: ' + err)
return
}
- console.info('Restore success.')
+ console.info('Restore successful.')
})
```
@@ -1827,9 +1721,9 @@ Restores a database from a specified database backup file. This API uses a promi
```js
let promiseRestore = rdbStore.restore("dbBackup.db")
promiseRestore.then(()=>{
- console.info('Restore success.')
+ console.info('Restore successful.')
}).catch((err)=>{
- console.info('Restore failed, err: ' + err)
+ console.info('Failed to restore data, err: ' + err)
})
```
@@ -1910,12 +1804,12 @@ Obtains the distributed table name for a remote device based on the local table
**Example**
```js
-rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE", function (err, tableName) {
+rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE", function (err, tableName) {
if (err) {
- console.info('Failed to obtain distributed table name, err: ' + err)
+ console.info('Failed to obtain DistributedTableName, err: ' + err)
return
}
- console.info('Obtained distributed table name successfully, tableName=.' + tableName)
+ console.info('Obtained DistributedTableName successfully, tableName=.' + tableName)
})
```
@@ -1943,11 +1837,11 @@ Obtains the distributed table name for a remote device based on the local table
**Example**
```js
-let promise = rdbStore.obtainDistributedTableName(deviceId, "EMPLOYEE")
+let promise = rdbStore.obtainDistributedTableName("12345678abcde", "EMPLOYEE")
promise.then((tableName) => {
- console.info('Obtained distributed table name successfully, tableName= ' + tableName)
+ console.info('Obtained DistributedTableName successfully, tableName= ' + tableName)
}).catch((err) => {
- console.info('Failed to obtain distributed table name, err: ' + err)
+ console.info('Failed to obtain DistributedTableName, err: ' + err)
})
```
@@ -1970,9 +1864,9 @@ Synchronizes data between devices. This API uses an asynchronous callback to ret
**Example**
```js
-let predicates = new rdb.RdbPredicates('EMPLOYEE')
+let predicates = new data_rdb.RdbPredicates('EMPLOYEE')
predicates.inDevices(['12345678abcde'])
-rdbStore.sync(rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) {
+rdbStore.sync(data_rdb.SyncMode.SYNC_MODE_PUSH, predicates, function (err, result) {
if (err) {
console.log('Sync failed, err: ' + err)
return
diff --git a/en/application-dev/reference/apis/js-apis-formprovider.md b/en/application-dev/reference/apis/js-apis-formprovider.md
index 7ff3e5f3d80fcfb93b057bf5e67def7d1f197e92..0637af7ceb3c1368f242d91d9f4b59566b7f08df 100644
--- a/en/application-dev/reference/apis/js-apis-formprovider.md
+++ b/en/application-dev/reference/apis/js-apis-formprovider.md
@@ -1,9 +1,10 @@
# FormProvider
-> **NOTE**
-> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+The **FormProvider** module provides APIs related to the widget provider. You can use the APIs to update a widget, set the next refresh time for a widget, obtain widget information, and release a widget release.
-Provides APIs related to the widget provider.
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -27,11 +28,11 @@ SystemCapability.Ability.Form
**Parameters**
- | Name| Type | Mandatory| Description |
- | ------ | ------ | ---- | ------------------------------------- |
- | formId | string | Yes | ID of a widget. |
- | minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. |
- | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------------------------- |
+| formId | string | Yes | ID of a widget. |
+| minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. |
+| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Example**
@@ -56,16 +57,16 @@ SystemCapability.Ability.Form
**Parameters**
- | Name| Type | Mandatory| Description |
- | ------ | ------ | ---- | ------------------------------------- |
- | formId | string | Yes | ID of a widget. |
- | minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. |
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------------------------- |
+| formId | string | Yes | ID of a widget. |
+| minute | number | Yes | Refresh interval, in minutes. The value must be greater than or equal to 5. |
**Return value**
- | Type | Description |
- | ------------- | ---------------------------------- |
- | Promise\ |Promise used to return the result. |
+| Type | Description |
+| ------------- | ---------------------------------- |
+| Promise\ |Promise used to return the result. |
**Example**
@@ -90,11 +91,11 @@ SystemCapability.Ability.Form
**Parameters**
- | Name| Type | Mandatory| Description |
- | ------ | ---------------------------------------------------------------------- | ---- | ---------------- |
- | formId | string | Yes | ID of the widget to update.|
- | formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. |
- | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
+| Name| Type | Mandatory| Description |
+| ------ | ---------------------------------------------------------------------- | ---- | ---------------- |
+| formId | string | Yes | ID of the widget to update.|
+| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. |
+| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Example**
@@ -121,10 +122,10 @@ SystemCapability.Ability.Form
**Parameters**
- | Name| Type | Mandatory| Description |
- | ------ | ---------------------------------------------------------------------- | ---- | ---------------- |
- | formId | string | Yes | ID of the widget to update.|
- | formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. |
+| Name| Type | Mandatory| Description |
+| ------ | ---------------------------------------------------------------------- | ---- | ---------------- |
+| formId | string | Yes | ID of the widget to update.|
+| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data to be used for the update. |
**Return value**
@@ -144,3 +145,289 @@ SystemCapability.Ability.Form
console.log('formProvider updateForm, error:' + JSON.stringify(error));
});
```
+
+## getFormsInfo9+
+
+getFormsInfo(callback: AsyncCallback<Array<formInfo.FormInfo>>): void;
+
+Obtains the application's widget information on the device. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.|
+
+**Example**
+
+```js
+formProvider.getFormsInfo((error, data) => {
+ if (error.code) {
+ console.log('formProvider getFormsInfo, error:' + JSON.stringify(error));
+ } else {
+ console.log('formProvider getFormsInfo, data:' + JSON.stringify(data));
+ }
+});
+```
+## getFormsInfo9+
+
+getFormsInfo(filter: formInfo.FormInfoFilter, callback: AsyncCallback<Array<formInfo.FormInfo>>): void;
+
+Obtains the application's widget information that meets a filter criterion on the device. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| filter | formInfo.FormInfoFilter | Yes| Filter criterion.|
+| callback | AsyncCallback<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Yes| Callback used to return the widget information.|
+
+**Example**
+
+```js
+const filter : formInfo.FormInfoFilter = {
+ moduleName : "entry"
+};
+formProvider.getFormsInfo(filter, (error, data) => {
+ if (error.code) {
+ console.log('formProvider getFormsInfo, error:' + JSON.stringify(error));
+ } else {
+ console.log('formProvider getFormsInfo, data:' + JSON.stringify(data));
+ }
+});
+```
+
+## getFormsInfo9+
+
+getFormsInfo(filter?: formInfo.FormInfoFilter): Promise<Array<formInfo.FormInfo>>;
+
+Obtains the application's widget information on the device. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| filter | formInfo.FormInfoFilter | No| Filter criterion.|
+
+**Return value**
+
+| Type | Description |
+| :------------ | :---------------------------------- |
+| Promise<Array<[FormInfo](./js-apis-formInfo.md#forminfo-1)>> | Promise used to return the widget information.|
+
+**Example**
+
+```js
+const filter : formInfo.FormInfoFilter = {
+ moduleName : "entry"
+};
+formProvider.getFormsInfo(filter).then((data) => {
+ console.log('formProvider getFormsInfo, data:' + JSON.stringify(data));
+}).catch((error) => {
+ console.log('formProvider getFormsInfo, error:' + JSON.stringify(error));
+});
+```
+
+## requestPublishForm9+
+
+requestPublishForm(want: Want, formBindingData: formBindingData.FormBindingData, callback: AsyncCallback<string>): <void>;
+
+Requests to publish a widget carrying data to the widget host. This API uses an asynchronous callback to return the result.
+
+**System capability**
+
+SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ---------------------------------------------------------------------- | ---- | ---------------- |
+| want | [Want](js-apis-application-Want.md) | Yes | Information about the target widget. **abilityName**: ability of the target widget. **parameters**: "ohos.extra.param.key.form_dimension" "ohos.extra.param.key.form_name" "ohos.extra.param.key.module_name" |
+| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | Yes | Data used for creating the widget.|
+| callback | AsyncCallback<string> | Yes| Callback used to return the widget ID.|
+
+**Example**
+
+ ```js
+ import formBindingData from '@ohos.application.formBindingData';
+ var want = {
+ abilityName: "FormAbility",
+ parameters: {
+ "ohos.extra.param.key.form_dimension": 2,
+ "ohos.extra.param.key.form_name": "widget",
+ "ohos.extra.param.key.module_name": "entry"
+ }
+ };
+ let obj = formBindingData.createFormBindingData({temperature:"22c", time:"22:00"});
+ formProvider.requestPublishForm(want, obj, (error, data) => {
+ if (error.code) {
+ console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error));
+ } else {
+ console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data));
+ }
+ });
+ ```
+
+## requestPublishForm9+
+
+requestPublishForm(want: Want, callback: AsyncCallback<string>): <void>;
+
+Requests to publish a widget to the widget host. This API uses an asynchronous callback to return the result.
+
+**System capability**
+
+SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ----------------------------------- | ---- | ------------------------------------------------------------ |
+| want | [Want](js-apis-application-Want.md) | Yes | Information about the target widget. **abilityName**: ability of the target widget. **parameters**: "ohos.extra.param.key.form_dimension" "ohos.extra.param.key.form_name" "ohos.extra.param.key.module_name" |
+| callback | AsyncCallback<string> | Yes | Callback used to return the widget ID. |
+
+**Example**
+
+ ```js
+ var want = {
+ abilityName: "FormAbility",
+ parameters: {
+ "ohos.extra.param.key.form_dimension": 2,
+ "ohos.extra.param.key.form_name": "widget",
+ "ohos.extra.param.key.module_name": "entry"
+ }
+ };
+ formProvider.requestPublishForm(want, (error, data) => {
+ if (error.code) {
+ console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error));
+ } else {
+ console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data));
+ }
+ });
+ ```
+
+## requestPublishForm9+
+
+requestPublishForm(want: Want, formBindingData?: formBindingData.FormBindingData): Promise<string>;
+
+Requests to publish a widget to the widget host. This API uses a promise to return the result.
+
+**System capability**
+
+SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| --------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| want | [Want](js-apis-application-Want.md) | Yes | Information about the target widget. **abilityName**: ability of the target widget. **parameters**: "ohos.extra.param.key.form_dimension" "ohos.extra.param.key.form_name" "ohos.extra.param.key.module_name" |
+| formBindingData | [FormBindingData](js-apis-formbindingdata.md#formbindingdata) | No | Data used for creating the widget. |
+
+**Return value**
+
+| Type | Description |
+| :------------ | :---------------------------------- |
+| Promise<string> | Promise used to return the widget ID.|
+
+**Example**
+
+ ```js
+ var want = {
+ abilityName: "FormAbility",
+ parameters: {
+ "ohos.extra.param.key.form_dimension": 2,
+ "ohos.extra.param.key.form_name": "widget",
+ "ohos.extra.param.key.module_name": "entry"
+ }
+ };
+ formProvider.requestPublishForm(want).then((data) => {
+ console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data));
+ }).catch((error) => {
+ console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error));
+ });
+ ```
+
+## isRequestPublishFormSupported9+
+
+isRequestPublishFormSupported(callback: AsyncCallback<boolean>): void;
+
+Checks whether a widget can be published to the widget host. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.Form
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------- |
+| callback | AsyncCallback<boolean> | Yes| Callback used to return the result.|
+
+**Example**
+
+```js
+formProvider.isRequestPublishFormSupported((error, isSupported) => {
+ if (error.code) {
+ console.log('formProvider isRequestPublishFormSupported, error:' + JSON.stringify(error));
+ } else {
+ if (isSupported) {
+ var want = {
+ abilityName: "FormAbility",
+ parameters: {
+ "ohos.extra.param.key.form_dimension": 2,
+ "ohos.extra.param.key.form_name": "widget",
+ "ohos.extra.param.key.module_name": "entry"
+ }
+ };
+ formProvider.requestPublishForm(want, (error, data) => {
+ if (error.code) {
+ console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error));
+ } else {
+ console.log('formProvider requestPublishForm, form ID is: ' + JSON.stringify(data));
+ }
+ });
+ }
+ }
+});
+```
+
+## isRequestPublishFormSupported9+
+
+isRequestPublishFormSupported(): Promise<boolean>;
+
+Checks whether a widget can be published to the widget host. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.Form
+
+**Return value**
+
+| Type | Description |
+| :------------ | :---------------------------------- |
+| Promise<boolean> | Promise used to return the result.|
+
+**Example**
+
+```js
+formProvider.isRequestPublishFormSupported().then((isSupported) => {
+ if (isSupported) {
+ var want = {
+ abilityName: "FormAbility",
+ parameters: {
+ "ohos.extra.param.key.form_dimension": 2,
+ "ohos.extra.param.key.form_name": "widget",
+ "ohos.extra.param.key.module_name": "entry"
+ }
+ };
+ formProvider.requestPublishForm(want).then((data) => {
+ console.log('formProvider requestPublishForm success, form ID is :' + JSON.stringify(data));
+ }).catch((error) => {
+ console.log('formProvider requestPublishForm, error: ' + JSON.stringify(error));
+ });
+ }
+}).catch((error) => {
+ console.log('formProvider isRequestPublishFormSupported, error:' + JSON.stringify(error));
+});
+```
diff --git a/en/application-dev/reference/apis/js-apis-inputmethod.md b/en/application-dev/reference/apis/js-apis-inputmethod.md
index c61ca55fd32ff103763e4271392c0e23c83deda7..0b7fc7a4e6e20b0cbd760c85d4ac3ee120b6a6cf 100644
--- a/en/application-dev/reference/apis/js-apis-inputmethod.md
+++ b/en/application-dev/reference/apis/js-apis-inputmethod.md
@@ -1,7 +1,8 @@
# Input Method Framework
-> **NOTE** 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.
+> **NOTE**
>
+> 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.
## Modules to Import
@@ -21,7 +22,7 @@ Provides the constants.
| MAX_TYPE_NUM | number | Yes| No| Maximum number of supported input methods.|
-## InputMethodProperty8+
+## InputMethodProperty8+
Describes the input method application attributes.
@@ -32,7 +33,7 @@ Describes the input method application attributes.
| packageName | string | Yes| No| Package name.|
| methodId | string | Yes| No| Ability name.|
-## inputMethod.getInputMethodController
+## inputMethod.getInputMethodController
getInputMethodController(): InputMethodController
@@ -48,11 +49,11 @@ Obtains an [InputMethodController](#InputMethodController) instance.
**Example**
- ```js
+```js
var InputMethodController = inputMethod.getInputMethodController();
- ```
+```
-## inputMethod.getInputMethodSetting8+
+## inputMethod.getInputMethodSetting8+
getInputMethodSetting(): InputMethodSetting
@@ -69,10 +70,10 @@ Obtains an [InputMethodSetting](#InputMethodSetting) instance.
**Example**
```js
-var InputMethodSetting = inputMethod.getInputMethodSetting();
+ var InputMethodSetting = inputMethod.getInputMethodSetting();
```
-## InputMethodController
+## InputMethodController
In the following API examples, you must first use [getInputMethodController](#getInputMethodController) to obtain an **InputMethodController** instance, and then call the APIs using the obtained instance.
@@ -93,7 +94,7 @@ Hides the keyboard. This API uses an asynchronous callback to return the result.
**Example**
```js
- InputMethodController.stopInput((error)=>{
+ InputMethodController.stopInput((error)=>{
console.info('stopInput');
});
```
@@ -116,11 +117,11 @@ Hides the keyboard. This API uses an asynchronous callback to return the result.
```js
- var isSuccess = InputMethodController.stopInput();
- console.info('stopInput isSuccess = ' + isSuccess);
+ var isSuccess = InputMethodController.stopInput();
+ console.info('stopInput isSuccess = ' + isSuccess);
```
-## InputMethodSetting8+
+## InputMethodSetting8+
In the following API examples, you must first use [getInputMethodSetting](#getInputMethodSetting) to obtain an **InputMethodSetting** instance, and then call the APIs using the obtained instance.
@@ -140,18 +141,18 @@ Obtains the list of installed input methods. This API uses an asynchronous callb
**Example**
- ```js
- InputMethodSetting.listInputMethod((properties)=>{
- for (var i = 0;i < properties.length; i++) {
- var property = properties[i];
- console.info(property.packageName + "/" + property.methodId);
- }
+```js
+ InputMethodSetting.listInputMethod((properties)=>{
+ for (var i = 0;i < properties.length; i++) {
+ var property = properties[i];
+ console.info(property.packageName + "/" + property.methodId);
+ }
});
- ```
+```
### listInputMethod
-listInputMethod(): Promise<Array<InputMethodProperty>>
+listInputMethod(): Array<InputMethodProperty>
Obtains the list of installed input methods. This API uses an asynchronous callback to return the result.
@@ -166,11 +167,11 @@ Obtains the list of installed input methods. This API uses an asynchronous callb
**Example**
```js
- var properties = InputMethodSetting.listInputMethod();
- for (var i = 0;i < properties.length; i++) {
- var property = properties[i];
- console.info(property.packageName + "/" + property.methodId);
- }
+ var properties = InputMethodSetting.listInputMethod();
+ for (var i = 0;i < properties.length; i++) {
+ var property = properties[i];
+ console.info(property.packageName + "/" + property.methodId);
+ }
```
### displayOptionalInputMethod
@@ -189,14 +190,14 @@ Displays a dialog box for selecting an input method. This API uses an asynchrono
**Example**
```js
- InputMethodSetting.displayOptionalInputMethod(()=>{
- console.info('displayOptionalInputMethod is called');
- });
+ InputMethodSetting.displayOptionalInputMethod(()=>{
+ console.info('displayOptionalInputMethod is called');
+ });
```
### displayOptionalInputMethod
-displayOptionalInputMethod(): Promise<void>
+ displayOptionalInputMethod(): Promise<void>
Displays a dialog box for selecting an input method. This API uses an asynchronous callback to return the result.
@@ -211,5 +212,5 @@ Displays a dialog box for selecting an input method. This API uses an asynchrono
**Example**
```js
- InputMethodSetting.displayOptionalInputMethod();
+ InputMethodSetting.displayOptionalInputMethod();
```
\ No newline at end of file
diff --git a/en/application-dev/reference/apis/js-apis-settings.md b/en/application-dev/reference/apis/js-apis-settings.md
index 81444a400e5dc33c2a2b53c489488fea4fe1be58..73be3dd9605235802e6bcd78992ff47d6cd1c469 100644
--- a/en/application-dev/reference/apis/js-apis-settings.md
+++ b/en/application-dev/reference/apis/js-apis-settings.md
@@ -1,6 +1,7 @@
# Settings
-> **NOTE**
+> **NOTE**
+>
> The initial APIs of this module are supported since API version 8. Updates will be marked with a superscript to indicate their earliest API version.
@@ -55,7 +56,7 @@ Obtains the value of a data item.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.|
-| name | string | Yes| Name of the target data item. Data items can be classified as follows:
|
| defValue | string | Yes| Default value This parameter is user-defined. If it is not found in the database, the default value is returned.|
**Return value**
@@ -93,7 +94,7 @@ If the specified data item exists in the database, the **setValueSync** method u
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| dataAbilityHelper | [DataAbilityHelper](js-apis-dataAbilityHelper.md) | Yes| **DataAbilityHelper** class.|
-| name | string | Yes| Name of the target data item. Data items can be classified as follows:
|
| value | string | Yes| Value of the data item.|
**Return value**
diff --git a/en/application-dev/reference/apis/js-apis-system-bluetooth.md b/en/application-dev/reference/apis/js-apis-system-bluetooth.md
index 27223da59dd798215ff27a2a6bad0f49282097c9..9f2ef61d8465f220a97884f3097c43b203e07b80 100644
--- a/en/application-dev/reference/apis/js-apis-system-bluetooth.md
+++ b/en/application-dev/reference/apis/js-apis-system-bluetooth.md
@@ -1,7 +1,7 @@
# Bluetooth
->  **NOTE**
+> **NOTE**
>
> - The APIs of this module are no longer maintained since API version 7. You are advised to use [`@ohos.bluetooth`](js-apis-bluetooth.md).
>
@@ -15,7 +15,6 @@
import bluetooth from '@system.bluetooth';
```
-
## bluetooth.startBLEScan(OBJECT)
Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes system resources. Call [bluetooth.stopBLEScan](#bluetoothstopblescanobject) to stop the scan after a BLE device is detected and connected.
@@ -25,7 +24,6 @@ Scans for Bluetooth Low Energy (BLE) devices nearby. This operation consumes sys
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters**
-
**Table 1** StartBLEScanOptions
| Name| Type| Mandatory| Description|
@@ -61,7 +59,6 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters**
-
**Table 2** StopBLEScanOptions
| Name| Type| Mandatory| Description|
@@ -74,6 +71,7 @@ Stops scanning for BLE devices nearby. This API is used with [bluetooth.startBLE
```
bluetooth.stopBLEScan({
+ interval:0,
success() {
console.log('call bluetooth.stopBLEScan success.');
},
@@ -96,7 +94,6 @@ Subscribes to the newly detected BLE device. If this API is called multiple time
**System capability**: SystemCapability.Communication.Bluetooth.Lite
**Parameters**
-
**Table 3** SubscribeBLEFoundOptions
| Name| Type| Mandatory| Description|
@@ -123,7 +120,7 @@ Subscribes to the newly detected BLE device. If this API is called multiple time
**Example**
```
- bluetooth.startaBLEScan({
+ bluetooth.startBLEScan({
success() {
bluetooth.subscribeBLEFound({
success(data) {
diff --git a/en/application-dev/reference/apis/js-apis-system-cipher.md b/en/application-dev/reference/apis/js-apis-system-cipher.md
index 2cc2fa8e75d563784bfc31efcb919619b5738994..c4f862b0e3cbf448631be452f826ac395a44435c 100644
--- a/en/application-dev/reference/apis/js-apis-system-cipher.md
+++ b/en/application-dev/reference/apis/js-apis-system-cipher.md
@@ -29,7 +29,7 @@ Encrypts or decrypts data using RSA.
| text | string | Yes| Text to be encrypted or decrypted. The text to be encrypted must be common text that meets the following requirement: Maximum text length = Key length/8 - 66 For example, if the key is of 1024 bytes, the text to be encrypted cannot exceed 62 bytes (1024/8 -66 = 62). The text to be decrypted must be binary text encoded in Base64. The default format is used for Base64 encoding.|
| key | string | Yes| RSA key. The key is used as a public key in encryption and a private key in decryption.|
| transformation | string | No| RSA padding. The default value is **RSA/None/OAEPWithSHA256AndMGF1Padding**.|
-| success | Function | No| Called when data is encrypted or decrypted successful.|
+| success | Function | No| Called when data is encrypted or decrypted successfully.|
| fail | Function | No| Called when data fails to be encrypted or decrypted.|
| complete | Function | No| Called when the execution is complete.|
@@ -44,48 +44,53 @@ export default {
// Text to be encrypted.
text: 'hello',
// Base64-encoded public key used for encryption.
- key:
- 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDc7GR2MrfAoefES+wrs1ns2afT\n' +
- 'eJXSfIkEHfPXG9fVFjaws1ho4KcZfsxlA0+SXvc83f2SVGCuzULmM2lxxRCtcUN/\n' +
- 'h7SoaYEeluhqFimL2AEjfSwINHCLqObJkcjCfoZpE1JCehPiDOJsyT50Auc08h/4\n' +
- 'jHQfanyC1nc62LqUCQIDAQAB',
- success: function(data) {
- console.log('handling success: ${data.text}');
- },
- fail: function(data, code) {
- console.log(`### cipher.rsa encrypt fail ### ${code}: ${data}`);
- }
+ key:
+ 'MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCx414QSP3RsYWYzf9mkBMiBAXo\n' +
+ '6S7Lpva1fKlcuVxjoFC1iMnzD4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ\n' +
+ '+Enz0RzmVFh/4yk6lmqRzuEFQqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBw\n' +
+ 'jBpApTJ3TeneOo6Z5QIDAQAB',
+ success: function(data) {
+ console.log(`handling successful:${data.text}`);
+ },
+ fail: function(data, code) {
+ console.log(`### Failed to encrypt cipher.rsa ### ${code}:${data}`);
+ },
+ complete: function() {
+ console.log(`operation complete!`);
+ }
});
cipher.rsa({
// Decrypt data.
action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64. The decrypted text is "hello".
text:
- 'CUg3tTxTIdpCfreIxIBdws3uhd5qXLwcrVl3XDnQzZFVHyjVVCDHS16rjopaZ4C5xU2Tc8mSDzt7\n' +
- 'gp9vBfSwi7bMtSUvXG18DlncsKJFDkJpS5t0PkpS9YrJXrY80Gpe+ME6+6dN9bjgqMljbitDdBRf\n' +
- 'S/ZWNI4Q8Q0suNjNkGU=',
+ 'EPeCFPib6ayKbA0M6oSywARvFZ8dFYfjQv3nY8ikZGtS9UHq2sLPvAfpeIzggSiCxqbWeCftP1XQ\n' +
+ 'Sa+jEpzFlT1qoSTunBbrYzugPTajIJDTg6R1IRsF/J+mmakn0POVPvi4jCo9wqavB324Bx0Wipnc\n' +
+ 'EU5WO0oBHo5l4x6dTpU=',
// Base64-encoded private key used for decryption.
key:
- 'MIICdwIBADANBgkqhkiG9w0BAQEFAASCAmEwggJdAgEAAoGBANzsZHYyt8Ch58RL\n' +
- '7CuzWezZp9N4ldJ8iQQd89cb19UWNrCzWGjgpxl+zGUDT5Je9zzd/ZJUYK7NQuYz\n' +
- 'aXHFEK1xQ3+HtKhpgR6W6GoWKYvYASN9LAg0cIuo5smRyMJ+hmkTUkJ6E+IM4mzJ\n' +
- 'PnQC5zTyH/iMdB9qfILWdzrYupQJAgMBAAECgYEAkibhH0DWR13U0gvYJeD08Lfd\n' +
- 'Sw1PMHyquEqIcho9Yv7bF3LOXjOg2EEGPx09mvuwXFgP1Kp1e67XPytr6pQQPzK7\n' +
- 'XAPcLPx80R/ZjZs8vNFndDOd1HgD3vSVmYQarNzmKi72tOUWMPevsaFXPHo6Xx3X\n' +
- '8x0wYb7XuBsQguRctTECQQD7GWX3JUiyo562iVrpTDPOXsrUxmzCrgz2OZildxMd\n' +
- 'Pp/PkyDrx7mEXTpk4K/XnQJ3GpJNi2iDSxDuPSAeJ/aPAkEA4Tw4+1Z43S/xH3C3\n' +
- 'nfulYBNyB4si6KEUuC0krcC1pDJ21Gd12efKo5VF8SaJI1ZUQOzguV+dqNsB/JUY\n' +
- 'OFfX5wJAB1dKv9r7MR3Peg6x9bggm5vx2h6i914XSuuMJupASM6X5X2rrLj+F3yS\n' +
- 'RHi9K1SPyeOg+1tkBtKfABgRZFBOyQJAbuTivUSe73AqTKuHjB4ZF0ubqgEkJ9sf\n' +
- 'Q2rekzm9dOFvxjZGPQo1qALX09qATMi1ZN376ukby8ZAnSafLSZ64wJBAM2V37go\n' +
- 'Sj44HF76ksRow8gecuQm48NCTGAGTicXg8riKog2GC9y8pMNHAezoR9wXJF7kk+k\n' +
- 'lz5cHyoMZ9mcd30=',
- success: function(data) {
- console.log('handling success: ${data.text}');
- },
- fail: function(data, code) {
- console.log(`### cipher.rsa decrypt fail ### ${code}: ${data}`);
- },
+ 'MIICXgIBAAKBgQCx414QSP3RsYWYzf9mkBMiBAXo6S7Lpva1fKlcuVxjoFC1iMnz\n' +
+ 'D4mC0uiL4k5MNi43J64c7dbqi3qAJjdAtuwQ6NZJ+Enz0RzmVFh/4yk6lmqRzuEF\n' +
+ 'QqhQqSZzaLq6sq2N2G0Sv2Xl3sLvqAfe2HNm2oBwjBpApTJ3TeneOo6Z5QIDAQAB\n' +
+ 'AoGBAKPNtoRQcklxqo+2wQP0j2m3Qqnib1DggjVEgb/8f/LNYQSI3U2QdROemryU\n' +
+ 'u3y6N3xacZ359PktTrRKfH5+8ohmHGhIuPAnefp6bLvAFUcl4t1xm74Cow62Kyw3\n' +
+ 'aSbmuTG98dxPA1sXD0jiprdtsq2wQ9CoKNyY7/d/pKoqxNuBAkEA4GytZ60NCTj9\n' +
+ 'w24jACFeko5YqCFY/TTLoc4SQvWtFMnimRPclLZhtUIK0P8dib71UFedx+AxklgL\n' +
+ 'A5gjcfo+2QJBAMrqiwyCh3OQ5DhyRPDwt87x1/jg5fy4hhete2ufSf2FoQCVqO+w\n' +
+ 'PKoljdXmJeS6rGgzGibstuHLrP3tcIho4+0CQD3ZFWzF/xq0jxKlrpWhnJuNCRfE\n' +
+ 'oO6e9yNvVA8J/5oEDSOcmqSNIp4+RhbUx8InUxnCG6Ryv5aSFu71pYcKrPkCQQCL\n' +
+ 'RUGcm3ZGTnslduB0knNF+V2ndwzDUQ7P74UXT+PjurTPhujFYiuxCEd6ORVnEOzG\n' +
+ 'M9TORIgdH8MjIbWsGnndAkEAw9yURDaorE8IYPLF2IEn09g1uzvWPs3phDb6smVx\n' +
+ '8GfqIdUNf+aCG5TZK/kXBF1sqcsi7jXMAf4jBlejVbSVZg==',
+ success: function(data) {
+ console.log(`handling successful:${data.text}`);
+ },
+ fail: function(data, code) {
+ console.log(`### Failed to encrypt cipher.rsa ### ${code}:${data}`);
+ },
+ complete: function() {
+ console.log(`operation complete!`);
+ }
});
}
}
@@ -109,9 +114,9 @@ Encrypts or decrypts data using AES.
| key | string | Yes| Key used for encryption or decryption. It is a string encoded in Base64.|
| transformation | string | No| Encryption mode and padding of the AES algorithm. The default value is **AES/CBC/PKCS5Padding**.|
| iv | string | No| Initialization vector (IV) for AES-based encryption and decryption. The value is a string encoded in Base64. The default value is the key value.|
-| ivOffset | string | No| Offset of the IV for AES-based encryption and decryption. The default value is **0**.|
-| ivLen | string | No| Length of the IV for AES-based encryption and decryption, in bytes. The default value is **16**.|
-| success | Function | No| Called when data is encrypted or decrypted successful.|
+| ivOffset | string | No| Offset of the IV for AES-based encryption and decryption. The default value is **0**, which is the only value supported.|
+| ivLen | string | No| Length of the IV, in bytes. This field is reserved. The default value is **16**, which is the only value supported.|
+| success | Function | No| Called when data is encrypted or decrypted successfully.|
| fail | Function | No| Called when data fails to be encrypted or decrypted.|
| complete | Function | No| Called when the execution is complete.|
@@ -128,35 +133,38 @@ export default {
// Base64-encoded key used for encryption.
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding',
- ivOffset: 0,
- ivLen: 16,
- success: (data) => {
- console.log('handling success: ${data.text}');
- },
- fail: (data, code) => {
- console.log(`### cipher.aes encrypt fail ### ${code}: ${data}`);
- }
+ ivOffset: '0',
+ ivLen: '16',
+ success: function(data) {
+ console.log(`handling successful:${data.text}`);
+ },
+ fail: function(data, code) {
+ console.log(`### Failed to encrypt cipher.rsa ### ${code}:${data}`);
+ },
+ complete: function() {
+ console.log(`operation complete!`);
+ }
});
cipher.aes({
// Decrypt data.
action: 'decrypt',
// Text to be decrypted, which is binary text encoded in Base64.
- text: 'CUg3tTxTIdpCfreIxIBdws3uhd5qXLwcrVl3XDnQzZFVHyjVVCDHS16rjopaZ4C5xU2Tc8mSDzt7\n' +
- 'gp9vBfSwi7bMtSUvXG18DlncsKJFDkJpS5t0PkpS9YrJXrY80Gpe+ME6+6dN9bjgqMljbitDdBRf\n' +
- 'S/ZWNI4Q8Q0suNjNkGU=',
+ text: '1o0kf2HXwLxHkSh5W5NhzA==',
// Base64-encoded key used for decryption.
key: 'NDM5Qjk2UjAzMEE0NzVCRjlFMkQwQkVGOFc1NkM1QkQ=',
transformation: 'AES/CBC/PKCS5Padding',
- ivOffset: 0,
- ivLen: 16,
- success: (data) => {
- this.dealTxt = data.text;
- },
- fail: (data, code) => {
- prompt.showToast({
- message: (`### cipher.aes decrypt fail ### code = ${code}: ${data}`)
- })
- },
+ ivOffset: '0',
+ ivLen: '16',
+ success: function(data) {
+ console.log(`handling success:${data.text}`);
+ },
+ fail: function(data, code) {
+ console.log(`### Failed to decrypt cipher.rsa ### ${code}:${data}`);
+ },
+ complete: function() {
+ console.log(`operation complete!`);
+ }
+ });
});
}
}
diff --git a/en/application-dev/reference/arkui-js/js-components-media-video.md b/en/application-dev/reference/arkui-js/js-components-media-video.md
index b957ee6d968a2a4b038c4d600d7ea6adef966b40..18c3fbef3bff790dfea6359d7a5d7c5516d0ecd5 100644
--- a/en/application-dev/reference/arkui-js/js-components-media-video.md
+++ b/en/application-dev/reference/arkui-js/js-components-media-video.md
@@ -1,7 +1,7 @@
# video
-> **NOTE**
+> **NOTE**
>
> - This component is supported since API version 4. Updates will be marked with a superscript to indicate their earliest API version.
>
@@ -15,7 +15,7 @@
> ]
> ```
-The **\