diff --git a/en/OpenHarmony-Overview.md b/en/OpenHarmony-Overview.md
index 594fb355e417b047d93b1de9d413540a2c839190..a8dbb1b636a19fe6a2b7e6dee741b56dac0e6289 100644
--- a/en/OpenHarmony-Overview.md
+++ b/en/OpenHarmony-Overview.md
@@ -127,7 +127,7 @@ The following table describes the subsystems of OpenHarmony. For details about t
| Build | Provides a compilation and building framework based on Generate Ninja (GN) and Ninja. | All systems |
| Test | The test-driven development mode is used during the development process. You can develop new cases or modify existing cases to test new or enhanced system features. The test helps you develop high-quality code in the development phase.| All systems |
| Data Management | Provides local data management and distributed data management: - Local application data management for lightweight preference databases and relational databases - Distributed data service to provide applications with the capability to store data in the databases of different devices| Standard system |
-| Programming Language Runtime| Provides the compilation and execution environment for programs developed with JavaScript or C/C++, basic libraries that support the runtime, and the runtime-associated APIs, compilers, and auxiliary tools.| All systems |
+| Compiler and Runtime | Provides the compilation and execution environment for programs developed with JavaScript or C/C++, basic libraries that support the runtime, and the runtime-associated APIs, compilers, and auxiliary tools.| All systems |
| Distributed Scheduler| Starts, registers, queries, and manages system services. | All systems |
| JS UI Framework | OpenHarmony JS UI framework supports web-development-like paradigm. | All systems |
| Multimedia | Provides easy-to-use APIs for developing multimedia components such as audio, video, and camera, and enables applications to use multimedia resources of the system.| All systems |
diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md
index a627e1116a792c5d4fc885ae01aa6ccb172b7b1d..73bbd2d608562535e3272c1a659bcebbd39b125a 100644
--- a/en/application-dev/Readme-EN.md
+++ b/en/application-dev/Readme-EN.md
@@ -17,7 +17,6 @@
- Application Package Structure
- [Application Package Structure in Stage Model)](quick-start/application-package-structure-stage.md)
- [Application Package Structure in FA Model](quick-start/application-package-structure-fa.md)
- - [HAR File Structure](quick-start/har-structure.md)
- Multi-HAP Mechanism
- [Multi-HAP Design Objectives](quick-start/multi-hap-objective.md)
- [Multi-HAP Build View](quick-start/multi-hap-build-view.md)
@@ -49,7 +48,7 @@
- Development
- [Application Models](application-models/Readme-EN.md)
- [UI Development](ui/Readme-EN.md)
- - [Common Event and Notification](notification/Readme-EN.md)
+ - [Notification](notification/Readme-EN.md)
- [Window Manager](windowmanager/Readme-EN.md)
- [WebGL](webgl/Readme-EN.md)
- [Media](media/Readme-EN.md)
@@ -57,7 +56,7 @@
- [Connectivity](connectivity/Readme-EN.md)
- [Data Management](database/Readme-EN.md)
- [File Management](file-management/Readme-EN.md)
- - [Telephony](telephony/Readme-EN.md)
+ - [Telephony Service](telephony/Readme-EN.md)
- [Task Management](task-management/Readme-EN.md)
- [Device Management](device/Readme-EN.md)
- [Device Usage Statistics](device-usage-statistics/Readme-EN.md)
diff --git a/en/application-dev/application-dev-guide-for-gitee.md b/en/application-dev/application-dev-guide-for-gitee.md
index 96e956f86e1528c5946c094b204c83e6e7d96222..ca206e65fd11a48631e950f26c1c9b656f298e13 100644
--- a/en/application-dev/application-dev-guide-for-gitee.md
+++ b/en/application-dev/application-dev-guide-for-gitee.md
@@ -24,13 +24,13 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O
All applications should be developed on top of these frameworks.
Then, equip yourself for developing the key features, with the following guidelines:
-- [Common Event and Notification](notification/Readme-EN.md)
+- [Notification](notification/Readme-EN.md)
- [Window Manager](windowmanager/Readme-EN.md)
- [WebGL](webgl/Readme-EN.md)
- [Media](media/Readme-EN.md)
- [Security](security/Readme-EN.md)
- [Connectivity](connectivity/Readme-EN.md)
-- [Telephony](telephony/Readme-EN.md)
+- [Telephony Service](telephony/Readme-EN.md)
- [Data Management](database/Readme-EN.md)
- [Task Management](task-management/Readme-EN.md)
- [Device Management](device/Readme-EN.md)
@@ -40,6 +40,7 @@ Then, equip yourself for developing the key features, with the following guideli
- [Application Test](application-test/Readme-EN.md)
- [IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/Readme-EN.md)
+- [File Management](file-management/medialibrary-overview.md)
### Tools
diff --git a/en/application-dev/application-dev-guide.md b/en/application-dev/application-dev-guide.md
index 650eaf0b956e544bd19e8892b0c6946a6839beb5..c7b49ac56b0638e8c4ba9908582683f9c4c46d21 100644
--- a/en/application-dev/application-dev-guide.md
+++ b/en/application-dev/application-dev-guide.md
@@ -24,13 +24,13 @@ First thing first, familiarize yourself with the two cornerstone frameworks in O
All applications should be developed on top of these frameworks.
Then, equip yourself for developing the key features, with the following guidelines:
-- [Common Event and Notification](notification/notification-overview.md)
+- [Notification](notification/notification-overview.md)
- [Window Manager](windowmanager/window-overview.md)
- [WebGL](webgl/webgl-overview.md)
- [Media](media/audio-overview.md)
- [Security](security/userauth-overview.md)
- [Connectivity](connectivity/ipc-rpc-overview.md)
-- [Telephony](telephony/telephony-overview.md)
+- [Telephony Service](telephony/telephony-overview.md)
- [Data Management](database/database-mdds-overview.md)
- [Task Management](task-management/background-task-overview.md)
- [Device](device/usb-overview.md)
@@ -40,6 +40,7 @@ Then, equip yourself for developing the key features, with the following guideli
- [Application Test](application-test/arkxtest-guidelines.md)
- [OpenHarmony IDL Specifications and User Guide](IDL/idl-guidelines.md)
- [Using Native APIs in Application Projects](napi/napi-guidelines.md)
+- [File Management](file-management/medialibrary-overview.md)
### Tools
diff --git a/en/application-dev/application-models/Readme-EN.md b/en/application-dev/application-models/Readme-EN.md
index 6b35052ce4b7729fa566f845c9d1d367e23582f6..2c1505fc1c12e57a96f22fcda7faf92ba9ea7418 100644
--- a/en/application-dev/application-models/Readme-EN.md
+++ b/en/application-dev/application-models/Readme-EN.md
@@ -17,11 +17,11 @@
- ExtensionAbility Component
- [ExtensionAbility Component Overview](extensionability-overview.md)
- [ServiceExtensionAbility](serviceextensionability.md)
- - [DataShareExtensionAbility (System Applications Only)](datashareextensionability.md)
+ - [DataShareExtensionAbility (for System Applications Only)](datashareextensionability.md)
- [FormExtensionAbility (Widget)](widget-development-stage.md)
- - [StaticSubscriberExtensionAbility](static-subscriber-extension-ability.md)
- [AccessibilityExtensionAbility](accessibilityextensionability.md)
- [EnterpriseAdminExtensionAbility](enterprise-extensionAbility.md)
+ - [InputMethodExtensionAbility](inputmethodextentionability.md)
- [WindowExtensionAbility](windowextensionability.md)
- [AbilityStage Component Container](abilitystage.md)
- [Context](application-context-stage.md)
@@ -35,16 +35,19 @@
- [Component Startup Rules](component-startup-rules.md)
- Inter-Device Application Component Interaction (Continuation)
- [Continuation Overview](inter-device-interaction-hop-overview.md)
- - [Cross-Device Migration (System Applications Only)](hop-cross-device-migration.md)
- - [Multi-device Collaboration (System Applications Only)](hop-multi-device-collaboration.md)
+ - [Cross-Device Migration (for System Applications Only)](hop-cross-device-migration.md)
+ - [Multi-device Collaboration (for System Applications Only)](hop-multi-device-collaboration.md)
- [Subscribing to System Environment Variable Changes](subscribe-system-environment-variable-changes.md)
- IPC
- [Process Model](process-model-stage.md)
- Common Events
- [Introduction to Common Events](common-event-overview.md)
- - [Subscribing to Common Events](common-event-subscription.md)
- - [Publishing Common Events](common-event-publish.md)
+ - Common Event Subscription
+ - [Common Event Subscription Overview](common-event-subscription-overview.md)
+ - [Subscribing to Common Events in Dynamic Mode](common-event-subscription.md)
+ - [Subscribing to Common Events in Static Mode (for System Applications Only)](common-event-static-subscription.md)
- [Unsubscribing from Common Events](common-event-unsubscription.md)
+ - [Publishing Common Events](common-event-publish.md)
- [Background Services](background-services.md)
- Inter-Thread Communication
- [Thread Model](thread-model-stage.md)
@@ -68,7 +71,7 @@
- [Creating a PageAbility](create-pageability.md)
- [Starting a Local PageAbility](start-local-pageability.md)
- [Stopping a PageAbility](stop-pageability.md)
- - [Starting a Remote PageAbility (System Applications Only)](start-remote-pageability.md)
+ - [Starting a Remote PageAbility (for System Applications Only)](start-remote-pageability.md)
- [Starting a Specified Page](start-page.md)
- [Window Properties](window-properties.md)
- [Requesting Permissions](request-permissions.md)
diff --git a/en/application-dev/application-models/common-event-overview.md b/en/application-dev/application-models/common-event-overview.md
index 0d3788b41b516d0af9619d320ceeefc3f52c74c5..d54fcf4786f0e22077cda0e6aae2d211bb2d0e90 100644
--- a/en/application-dev/application-models/common-event-overview.md
+++ b/en/application-dev/application-models/common-event-overview.md
@@ -15,11 +15,11 @@ Common events are classified into system common events and custom common events.
Common events are also classified into unordered, ordered, and sticky common events.
-- Unordered common events: CES forwards common events based on the subscription sequence, regardless of whether subscribers receive the events.
+- Unordered common events: common events that CES forwards based on the subscription sequence, regardless of whether subscribers receive the events.
-- Ordered common event: CES forwards common events to the next subscriber only after receiving a reply from the previous subscriber.
+- Ordered common events: common events that CES forwards based on the subscriber priority. CES forwards common events to the subscriber with lower priority only after receiving a reply from the previous subscriber with higher priority.
-- Sticky common event: a public event that can be sent to a subscriber before they initiate a subscription. Only system applications or system services can send sticky common event, and they must request the **ohos.permission.COMMONEVENT_STICKY** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
+- Sticky common events: common events that can be sent to a subscriber before they initiate a subscription. Only system applications and system services can send sticky common events, and they must request the **ohos.permission.COMMONEVENT_STICKY** permission. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md#declaring-permissions-in-the-configuration-file).
Each application can subscribe to common events as required. After your application subscribes to a common event, the system sends it to your application every time the event is published. Such an event may be published by the system, other applications, or your own application.
diff --git a/en/application-dev/application-models/common-event-static-subscription.md b/en/application-dev/application-models/common-event-static-subscription.md
new file mode 100644
index 0000000000000000000000000000000000000000..85852f5712df84107c6593160d276ed33557baf9
--- /dev/null
+++ b/en/application-dev/application-models/common-event-static-subscription.md
@@ -0,0 +1,105 @@
+# Subscribing to Common Events in Static Mode (for System Applications Only)
+
+## When to Use
+
+A static subscriber is started once it receives a target event published by the system or application. At the same time, the **onReceiveEvent** callback is triggered, in which you can implement the service logic. For example, if an application needs to execute some initialization tasks during device power-on, the application can subscribe to the power-on event in static mode. After receiving the power-on event, the application is started to execute the initialization tasks. Subscribing to a common event in static mode is achieved by configuring a declaration file and implementing a class that inherits from **StaticSubscriberExtensionAbility**. Note that this subscribing mode has negative impact on system power consumption. Therefore, exercise caution when using this mode.
+
+## How to Develop
+
+1. Declaring a Static Subscriber
+
+ To declare a static subscriber, create an ExtensionAbility, which is derived from the **StaticSubscriberExtensionAbility** class, in the project. The sample code is as follows:
+
+ ```ts
+ import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility'
+
+ export default class StaticSubscriber extends StaticSubscriberExtensionAbility {
+ onReceiveEvent(event) {
+ console.log('onReceiveEvent, event:' + event.event);
+ }
+ }
+ ```
+
+ You can implement service logic in the **onReceiveEvent** callback.
+
+
+
+2. Project Configuration for a Static Subscriber
+
+ After writing the static subscriber code, configure the subscriber in the **module.json5** file. The configuration format is as follows:
+
+ ```ts
+ {
+ "module": {
+ ......
+ "extensionAbilities": [
+ {
+ "name": "StaticSubscriber",
+ "srcEntrance": "./ets/StaticSubscriber/StaticSubscriber.ts",
+ "description": "$string:StaticSubscriber_desc",
+ "icon": "$media:icon",
+ "label": "$string:StaticSubscriber_label",
+ "type": "staticSubscriber",
+ "visible": true,
+ "metadata": [
+ {
+ "name": "ohos.extension.staticSubscriber",
+ "resource": "$profile:subscribe"
+ }
+ ]
+ }
+ ]
+ ......
+ }
+ }
+ ```
+
+ Pay attention to the following fields in the JSON file:
+
+ - **srcEntrance**: entry file path of the ExtensionAbility, that is, the file path of the static subscriber declared in Step 2.
+
+ - **type**: ExtensionAbility type. For a static subscriber, set this field to **staticSubscriber**.
+
+ - **metadata**: level-2 configuration file information of the ExtensionAbility. The configuration information varies according to the ExtensionAbility type. Therefore, you must use different config files to indicate the specific configuration.
+ - **name**: name of the ExtensionAbility. For a static subscriber, declare the name as **ohos.extension.staticSubscriber** for successful identification.
+ - **resource**: path that stores the ExtensionAbility configuration, which is customizable. In this example, the path is **resources/base/profile/subscribe.json**.
+
+ A level-2 configuration file pointed to by **metadata** must be in the following format:
+
+ ```ts
+ {
+ "commonEvents": [
+ {
+ "name": "xxx",
+ "permission": "xxx",
+ "events":[
+ "xxx"
+ ]
+ }
+ ]
+ }
+ ```
+
+ If the level-2 configuration file is not declared in this format, the file cannot be identified. The fields are described as follows:
+
+ - **name**: name of the ExtensionAbility, which must be the same as the name of **extensionAbility** declared in **module.json5**.
+
+ - **permission**: permission required for the publisher. If a publisher without the required permission attempts to publish an event, the event is regarded as invalid and will not be published.
+
+ - **events**: list of target events to subscribe to.
+
+3. Device System Configuration
+
+ In the device system configuration file **/system/etc/app/install_list_capability.json**, add the bundle name of the static subscriber.
+
+ ```json
+ {
+ "install_list": [
+ {
+ "bundleName": "ohos.extension.staticSubscriber",
+ "allowCommonEvent": ["usual.event.A", "usual.event.B"],
+ }
+ ]
+ }
+ ```
+
diff --git a/en/application-dev/application-models/common-event-subscription-overview.md b/en/application-dev/application-models/common-event-subscription-overview.md
new file mode 100644
index 0000000000000000000000000000000000000000..20064af92d3df2e6f7ab7d62c4f71f911848057a
--- /dev/null
+++ b/en/application-dev/application-models/common-event-subscription-overview.md
@@ -0,0 +1,7 @@
+# Common Event Subscription Overview
+
+The common event service provides two subscription modes: dynamic and static. The biggest difference between these two modes is that dynamic subscription requires the application to be running, while static subscription does not.
+
+- In dynamic subscription mode, a subscriber subscribes to common events by calling an API during the running period. For details, see [Subscribing to Common Events in Dynamic Mode](common-event-subscription.md).
+
+- In static subscription mode, a subscriber subscribes to common events by configuring a declaration file and implementing a class that inherits from StaticSubscriberExtensionAbility. For details, see [Subscribing to Common Events in Static Mode](common-event-static-subscription.md).
diff --git a/en/application-dev/application-models/common-event-subscription.md b/en/application-dev/application-models/common-event-subscription.md
index ce61e40458a7cbd5c9ec226138535da93d3766b1..6cdc52ef9b798e48a911892f965db8fbf2aaa67f 100644
--- a/en/application-dev/application-models/common-event-subscription.md
+++ b/en/application-dev/application-models/common-event-subscription.md
@@ -1,9 +1,9 @@
-# Subscribing to Common Events
+# Subscribing to Common Events in Dynamic Mode
## When to Use
-You can create a subscriber object to subscribe to a common event so as to obtain the parameters passed in the event. Certain system common events [require specific permissions](../security/accesstoken-guidelines.md) to subscribe to. For details, see [Required Permissions](../reference/apis/js-apis-commonEventManager.md#support).
+In dynamic subscription mode, an application subscribes to a common event when it is running. If the subscribed event is published during the running period, the subscriber application will receive the event, together with the parameters passed in the event. For example, if an application expects to be notified of low battery so that it can reduce power consumption accordingly when running, then the application can subscribe to the low-battery event. Upon receiving the event, the application can close some unnecessary tasks to reduce power consumption. Certain system common events [require specific permissions](../security/accesstoken-guidelines.md) to subscribe to. For details, see [Required Permissions](../reference/apis/js-apis-commonEventManager.md#support).
## Available APIs
diff --git a/en/application-dev/application-models/common-event-unsubscription.md b/en/application-dev/application-models/common-event-unsubscription.md
index c87017ef08c05e8a22097c4bd2a05f52fc758134..1a44675d61947325a8c1a8790ff5f53626e43f57 100644
--- a/en/application-dev/application-models/common-event-unsubscription.md
+++ b/en/application-dev/application-models/common-event-unsubscription.md
@@ -1,9 +1,9 @@
-# Unsubscribing from Common Events
+# Unsubscribing from Common Events in Dynamic Mode
## When to Use
-You can call [unsubscribe()](../reference/apis/js-apis-commonEventManager.md#commoneventmanagerunsubscribe) to unsubscribe from a common event that is no longer required.
+You can call [unsubscribe()](../reference/apis/js-apis-commonEventManager.md#commoneventmanagerunsubscribe) to unsubscribe from a common event that is no longer required in dynamic mode.
## Available APIs
@@ -21,12 +21,12 @@ You can call [unsubscribe()](../reference/apis/js-apis-commonEventManager.md#com
import commonEventManager from '@ohos.commonEventManager';
```
-2. Subscribe to an event by following the procedure described in [Subscribing to Common Events](common-event-subscription.md).
+2. Subscribe to an event by following the procedure described in [Subscribing to Common Events in Dynamic Mode](common-event-subscription.md).
3. Call **unsubscribe** in **CommonEvent** to unsubscribe from the common event.
```ts
- // The subscriber object iscreated during event subscription.
+ // The subscriber object is created during event subscription.
if (subscriber !== null) {
commonEventManager.unsubscribe(subscriber, (err) => {
if (err) {
diff --git a/en/application-dev/application-models/datashareextensionability.md b/en/application-dev/application-models/datashareextensionability.md
index 1f968abfa743d7fb917fb7db3e0e41342e41c848..f671848f890277af92fc23869c5db0d57b02a316 100644
--- a/en/application-dev/application-models/datashareextensionability.md
+++ b/en/application-dev/application-models/datashareextensionability.md
@@ -1,4 +1,4 @@
-# DataShareExtensionAbility (System Applications Only)
+# DataShareExtensionAbility (for System Applications Only)
DataShareExtensionAbility provides the data sharing capability. System applications can implement a DataShareExtensionAbility or access an existing DataShareExtensionAbility in the system. Third-party applications can only access an existing DataShareExtensionAbility. For details, see [DataShare Development](../database/database-datashare-guidelines.md).
diff --git a/en/application-dev/application-models/enterprise-extensionAbility.md b/en/application-dev/application-models/enterprise-extensionAbility.md
index 514e254f77981977c7c425a4ea2ddbebbcff9ca8..3750b2298ba5321194d827edde4ad7c526b467f7 100644
--- a/en/application-dev/application-models/enterprise-extensionAbility.md
+++ b/en/application-dev/application-models/enterprise-extensionAbility.md
@@ -1,54 +1,54 @@
# EnterpriseAdminExtensionAbility Development
-## Introduction
+## Introduction to EnterpriseAdminExtensionAbility
-**EnterpriseAdminExtensionAbility** is essential to a mobile device management (MDM) application. When developing an MDM application for an enterprise, you must inherit the **EnterpriseAdminExtensionAbility** class and have the MDM service logic implemented in an **EnterpriseAdminExtensionAbility** instance. The **EnterpriseAdminExtensionAbility** class provides callbacks for the enable, disable, install, and uninstall events of a device administrator application, implementing notification of system administrator status changes.
+EnterpriseAdminExtensionAbility is a mandatory component for Mobile Device Management (MDM) applications. When developing MDM applications for enterprises, you need to inherit EnterpriseAdminExtensionAbility and implement MDM service logic in the EnterpriseAdminExtensionAbility instance. EnterpriseAdminExtensionAbility implements notifications of system management status changes and defines the callbacks for when a device administrator application is enabled or disabled or an application is installed or uninstalled.
## Constraints
-- ***Function constraints***
+- **Function constraints**
- The APIs provided can be used only by device administrator applications.
+ EnterpriseAdminExtensionAbility is applicable only to enterprise administrator applications.
-## Scenarios: Listening for the Enable, Disable, Install, and Uninstall Events of a Device Administrator Application
+## Observing Activation/Deactivation of a Device Administrator Application and Installation/Removal of an Application
### Overview
-**onAdminEnabled**: called when the enterprise administrator or employee deploys an MDM application and enables the DeviceAdmin permission for the application. The MDM application can set the initialization policy in the **onAdminEnabled** callback.
+**onAdminEnabled**: When an enterprise administrator or employee deploys an MDM application and activates the device administrator application, this callback is invoked to notify the MDM application that the DeviceAdmin permission is activated. The initialization policy of the MDM application can set in **onAdminEnabled**.
-**onAdminDisabled**: called when the system or employee disables the DeviceAdmin permission to notify the enterprise administrator that the device is no longer managed.
+**onAdminDisabled**: When the device administrator application is deactivated, the callback is invoked to notify the MDM application that the DeviceAdmin permission is deactivated.
-**onBundleAdded**: called to notify the enterprise administrator that the specified MDM application is installed on the device. In enterprise application administration settings, after the enterprise administrator subscribes to application installation and uninstallation events, the MDM application reports the events through the callbacks.
+**onBundleAdded**: The enterprise administrator can subscribe to application installation and uninstallation events. When an application is installed on an enterprise device, the MDM application reports the event in this callback to notify the enterprise administrator.
-**onBundleRemoved**: called to notify the enterprise administrator that the specified MDM application is uninstalled on the device.
+**onBundleRemoved**: When an application is removed from an enterprise device, the MDM application reports the event in this callback to notify the enterprise administrator.
### Available APIs
-| Class | API | Description |
+| Class | API | Description |
| :------------------------------ | ----------------------------------------- | ---------------------------- |
-| EnterpriseAdminExtensionAbility | onAdminDisabled(): void | Called when the device administrator application is enabled.|
-| EnterpriseAdminExtensionAbility | onBundleAdded(bundleName: string): void | Called when the MDM application is installed. |
-| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | Called when the device administrator application is disabled. |
-| EnterpriseAdminExtensionAbility | onBundleRemoved(bundleName: string): void | Called when the MDM application is uninstalled. |
+| EnterpriseAdminExtensionAbility | onAdminDisabled(): void | Called when a device administrator application is deactivated.|
+| EnterpriseAdminExtensionAbility | onBundleAdded(bundleName: string): void | Called when an application is installed on a device. |
+| EnterpriseAdminExtensionAbility | onAdminEnabled(): void | Called when a device administrator application is activated. |
+| EnterpriseAdminExtensionAbility | onBundleRemoved(bundleName: string): void | Called when an application is removed from a device. |
### How to Develop
-To implement **EnterpriseAdminExtensionAbility**, enable the device administrator application and create an **ExtensionAbility** instance from the code directory of the device administrator application. The procedure is as follows:
+To implement EnterpriseAdminExtensionAbility, you need to activate the device administrator application and create **ExtensionAbility** in the code directory of the device administrator application. The procedure is as follows:
1. In the **ets** directory of the target module, right-click and choose **New > Directory** to create a directory named **EnterpriseExtAbility**.
-2. Right-click the **EnterpriseExtAbility** directory and choose **New > TypeScript File** to create a file named **EnterpriseExtAbility.ts**.
-3. Open the **EnterpriseExtAbility.ts** file and import the **EnterpriseAdminExtensionAbility** module. Customize a class that inherits from **EnterpriseAdminExtensionAbility** and add the required callbacks, such as **onAdminEnabled()** and **onAdminDisabled()**, through which the enterprise administrator can receive notification when the device administrator application is enabled or disabled.
+2. Right-click the **EnterpriseExtAbility** directory, and choose **New > TypeScript File** to create a file named **EnterpriseExtAbility.ts**.
+3. Open the **EnterpriseExtAbility.ts** file and import the **EnterpriseAdminExtensionAbility** module. Inherit the **EnterpriseAdminExtensionAbility** module to the custom class and add application notification callbacks, such as **onAdminEnabled()** and **onAdminDisabled()**. When the device administrator application is activated or deactivated, the device administrator can receive notifications.
```ts
import EnterpriseAdminExtensionAbility from '@ohos.enterprise.EnterpriseAdminExtensionAbility';
-
+
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
-
+
onAdminEnabled() {
console.info("onAdminEnabled");
}
-
+
onAdminDisabled() {
console.info("onAdminDisabled");
}
@@ -56,14 +56,14 @@ To implement **EnterpriseAdminExtensionAbility**, enable the device administrato
onBundleAdded(bundleName: string) {
console.info("EnterpriseAdminAbility onBundleAdded bundleName:" + bundleName)
}
-
+
onBundleRemoved(bundleName: string) {
console.info("EnterpriseAdminAbility onBundleRemoved bundleName" + bundleName)
}
};
```
-4. Register **ServiceExtensionAbility** in the [module.json5](../quick-start/module-configuration-file.md) file of the target module. Among the parameters, set **type** to **enterpriseAdmin** and **srcEntrance** to the code path of the current ExtensionAbility.
+4. Register **ServiceExtensionAbility** in the [**module.json5**](../quick-start/module-configuration-file.md) file corresponding to the project module. Set **type** to **enterpriseAdmin** and **srcEntrance** to the path of the ExtensionAbility code.
```ts
"extensionAbilities": [
@@ -78,7 +78,7 @@ To implement **EnterpriseAdminExtensionAbility**, enable the device administrato
## Example
-Use the **subscribeManagedEvent** and **unsubscribeManagedEvent** APIs in the **@ohos.enterprise.adminManager** module to subscribe to and unsubscribe from the application installation and uninstallation event, respectively. After the subscription is successful, the MDM application notifies the enterprise administrator when it is installed or uninstalled on the device.
+Use **subscribeManagedEvent()** and **unsubscribeManagedEvent()** in the **@ohos.enterprise.adminManager** module to subscribe to application installation and removal events. When an application is installed or removed, the MDM application is notified of the event. Then, the MDM application reports the event in the callback to notify the enterprise administrator.
```ts
@State managedEvents: Array = [0,1]
@@ -108,4 +108,3 @@ Use the **subscribeManagedEvent** and **unsubscribeManagedEvent** APIs in the **
}
```
-
diff --git a/en/application-dev/application-models/hop-cross-device-migration.md b/en/application-dev/application-models/hop-cross-device-migration.md
index a482ae26ced4987d0b0c02382ac132c42ea932c0..d90a10995f0aeba773179fc7807ab25711b4594c 100644
--- a/en/application-dev/application-models/hop-cross-device-migration.md
+++ b/en/application-dev/application-models/hop-cross-device-migration.md
@@ -1,4 +1,4 @@
-# Cross-Device Migration (System Applications Only)]
+# Cross-Device Migration (for System Applications Only)]
## When to Use
diff --git a/en/application-dev/application-models/hop-multi-device-collaboration.md b/en/application-dev/application-models/hop-multi-device-collaboration.md
index 49ef26a7a11ca28273a92786eac230f5801d05cd..f5d82af32da86796d81dc1bebed1d6ff804f2532 100644
--- a/en/application-dev/application-models/hop-multi-device-collaboration.md
+++ b/en/application-dev/application-models/hop-multi-device-collaboration.md
@@ -1,4 +1,4 @@
-# Multi-device Collaboration (System Applications Only)
+# Multi-device Collaboration (for System Applications Only)
## When to Use
@@ -305,7 +305,7 @@ A system application can connect to a service on another device by calling [conn
## Using Cross-Device Ability Call
-The basic principle of cross-device ability call is the same as that of intra-device ability call. For details, see [Using Ability Call to Implement UIAbility Interaction (System Applications Only)](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction-system-applications-only).
+The basic principle of cross-device ability call is the same as that of intra-device ability call. For details, see [Using Ability Call to Implement UIAbility Interaction (for System Applications Only)](uiability-intra-device-interaction.md#using-ability-call-to-implement-uiability-interaction-for-system-applications-only).
The following describes how to implement multi-device collaboration through cross-device ability call.
@@ -319,10 +319,10 @@ The following describes how to implement multi-device collaboration through cros
| startAbilityByCall(want: Want): Promise<Caller>; | Starts a UIAbility in the foreground or background and obtains the caller object for communicating with the UIAbility.|
| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.|
| off(method: string): void | Callback invoked when the callee ability deregisters a method.|
-| call(method: string, data: rpc.Sequenceable): Promise<void> | Sends agreed sequenceable data to the callee ability.|
-| callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel> | Sends agreed sequenceable data to the callee ability and obtains the agreed sequenceable data returned by the callee ability.|
+| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the callee ability.|
+| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>| Sends agreed parcelable data to the callee ability and obtains the agreed parcelable data returned by the callee ability.|
| release(): void | Releases the caller object.|
-| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.|
+| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.|
### How to Develop
@@ -348,16 +348,15 @@ The following describes how to implement multi-device collaboration through cros
For the callee ability, implement the callback to receive data and the methods to marshal and unmarshal data. When data needs to be received, use **on()** to register a listener. When data does not need to be received, use **off()** to deregister the listener.
1. Configure the launch type of the UIAbility.
+ Set **launchType** of the callee ability to **singleton** in the **module.json5** file.
- Set **launchType** of the callee ability to **singleton** in the **module.json5** file.
+ | JSON Field| Description|
+ | -------- | -------- |
+ | "launchType"| Ability launch type. Set this parameter to **singleton**.|
- | JSON Field| Description|
- | -------- | -------- |
- | "launchType"| Ability launch type. Set this parameter to **singleton**.|
+ An example of the UIAbility configuration is as follows:
- An example of the UIAbility configuration is as follows:
-
-
+
```json
"abilities":[{
"name": ".CalleeAbility",
@@ -369,19 +368,18 @@ The following describes how to implement multi-device collaboration through cros
"visible": true
}]
```
-
2. Import the **UIAbility** module.
```ts
import Ability from '@ohos.app.ability.UIAbility';
```
-
- 3. Define the agreed sequenceable data.
-
- The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string.
-
+ 3. Define the agreed parcelable data.
+
+ The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string.
+
+
```ts
- export default class MySequenceable {
+ export default class MyParcelable {
num: number = 0;
str: string = "";
@@ -390,71 +388,69 @@ The following describes how to implement multi-device collaboration through cros
this.str = string;
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num);
- messageParcel.writeString(this.str);
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num);
+ messageSequence.writeString(this.str);
return true;
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt();
- this.str = messageParcel.readString();
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt();
+ this.str = messageSequence.readString();
return true;
}
}
```
-
4. Implement **Callee.on** and **Callee.off**.
-
- In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate()** of the ability and deregistered in **onDestroy()**. After receiving sequenceable data, the application processes the data and returns the data result. You need to implement processing based on service requirements.
-
- ```ts
- const TAG: string = '[CalleeAbility]';
- const MSG_SEND_METHOD: string = 'CallSendMsg';
-
- function sendMsgCallback(data) {
- console.info('CalleeSortFunc called');
-
- // Obtain the sequenceable data sent by the caller ability.
- let receivedData = new MySequenceable(0, '');
- data.readSequenceable(receivedData);
- console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`);
-
- // Process the data.
- // Return the sequenceable data result to the caller ability.
- return new MySequenceable(receivedData.num + 1, `send ${receivedData.str} succeed`);
- }
-
- export default class CalleeAbility extends Ability {
- onCreate(want, launchParam) {
- try {
- this.callee.on(MSG_SEND_METHOD, sendMsgCallback);
- } catch (error) {
- console.info(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`);
- }
- }
+
+ In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate()** of the ability and deregistered in **onDestroy()**. After receiving parcelable data, the application processes the data and returns the data result. You need to implement processing based on service requirements.
- onDestroy() {
- try {
- this.callee.off(MSG_SEND_METHOD);
- } catch (error) {
- console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`);
- }
- }
- }
- ```
-
+ ```ts
+ const TAG: string = '[CalleeAbility]';
+ const MSG_SEND_METHOD: string = 'CallSendMsg';
+
+ function sendMsgCallback(data) {
+ console.info('CalleeSortFunc called');
+
+ // Obtain the parcelable data sent by the caller ability.
+ let receivedData = new MyParcelable(0, '');
+ data.readParcelable(receivedData);
+ console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`);
+
+ // Process the data.
+ // Return the parcelable data result to the caller ability.
+ return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`);
+ }
+
+ export default class CalleeAbility extends Ability {
+ onCreate(want, launchParam) {
+ try {
+ this.callee.on(MSG_SEND_METHOD, sendMsgCallback);
+ } catch (error) {
+ console.info(`${MSG_SEND_METHOD} register failed with error ${JSON.stringify(error)}`);
+ }
+ }
+
+ onDestroy() {
+ try {
+ this.callee.off(MSG_SEND_METHOD);
+ } catch (error) {
+ console.error(TAG, `${MSG_SEND_METHOD} unregister failed with error ${JSON.stringify(error)}`);
+ }
+ }
+ }
+ ```
+
4. Obtain the caller object and access the callee ability.
1. Import the **UIAbility** module.
```ts
import Ability from '@ohos.app.ability.UIAbility';
```
-
2. Obtain the caller object.
-
+
The **context** attribute of the ability implements **startAbilityByCall** to obtain the caller object for communication. The following example uses **this.context** to obtain the **context** attribute of the ability, uses **startAbilityByCall** to start the callee ability, obtain the caller object, and register the **onRelease** listener of the caller ability. You need to implement processing based on service requirements.
-
+
```ts
async onButtonGetRemoteCaller() {
@@ -483,14 +479,14 @@ The following describes how to implement multi-device collaboration through cros
For details about how to implement **getRemoteDeviceId()**, see [Starting UIAbility and ServiceExtensionAbility Across Devices (No Data Returned)](#starting-uiability-and-serviceextensionability-across-devices-no-data-returned).
-5. Sends agreed sequenceable data to the callee ability.
- 1. The sequenceable data can be sent to the callee ability with or without a return value. The method and sequenceable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability.
+5. Sends agreed parcelable data to the callee ability.
+ 1. The parcelable data can be sent to the callee ability with or without a return value. The method and parcelable data must be consistent with those of the callee ability. The following example describes how to send data to the callee ability.
```ts
const MSG_SEND_METHOD: string = 'CallSendMsg';
async onButtonCall() {
try {
- let msg = new MySequenceable(1, 'origin_Msg');
+ let msg = new MyParcelable(1, 'origin_Msg');
await this.caller.call(MSG_SEND_METHOD, msg);
} catch (error) {
console.info(`caller call failed with ${error}`);
@@ -505,12 +501,12 @@ The following describes how to implement multi-device collaboration through cros
backMsg: string = '';
async onButtonCallWithResult(originMsg, backMsg) {
try {
- let msg = new MySequenceable(1, originMsg);
+ let msg = new MyParcelable(1, originMsg);
const data = await this.caller.callWithResult(MSG_SEND_METHOD, msg);
console.info('caller callWithResult succeed');
- let result = new MySequenceable(0, '');
- data.readSequenceable(result);
+ let result = new MyParcelable(0, '');
+ data.readParcelable(result);
backMsg(result.str);
console.info(`caller result is [${result.num}, ${result.str}]`);
} catch (error) {
@@ -521,8 +517,8 @@ The following describes how to implement multi-device collaboration through cros
6. Release the caller object.
- When the caller object is no longer required, use **release()** to release it.
-
+ When the caller object is no longer required, use **release()** to release it.
+
```ts
releaseCall() {
try {
diff --git a/en/application-dev/application-models/mission-set-icon-name-for-task-snapshot.md b/en/application-dev/application-models/mission-set-icon-name-for-task-snapshot.md
index 8d6bbf4eb7d09f66e1d6499c83c3b711e7209572..9fdc03477c0552f523a0ee9c40c6fa5b8d7c4363 100644
--- a/en/application-dev/application-models/mission-set-icon-name-for-task-snapshot.md
+++ b/en/application-dev/application-models/mission-set-icon-name-for-task-snapshot.md
@@ -12,10 +12,10 @@ You can also use [UIAbilityContext.setMissionIcon()](../reference/apis/js-apis-i
This document describes the following operations:
-- [Setting a Mission Snapshot Icon (System Applications Only)](#setting-a-mission-snapshot-icon-system-applications-only)
+- [Setting a Mission Snapshot Icon (for System Applications Only)](#setting-a-mission-snapshot-icon-for-system-applications-only)
- [Setting a Mission Snapshot Name](#setting-a-mission-snapshot-name)
-## Setting a Mission Snapshot Icon (System Applications Only)
+## Setting a Mission Snapshot Icon (for System Applications Only)
Call [UIAbilityContext.setMissionIcon()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#uiabilitycontextsetmissionicon) to set the icon of a mission snapshot. The icon is an object of the [PixelMap](../reference/apis/js-apis-image.md#pixelmap7) type. For details about how to obtain the context, see [Obtaining the Context of UIAbility](uiability-usage.md#obtaining-the-context-of-uiability).
```ts
diff --git a/en/application-dev/application-models/serviceextensionability.md b/en/application-dev/application-models/serviceextensionability.md
index edccb0b736c9ad81f5ae316e7310b6cc35ae34e0..9ff7a0ae5d6df7574da19565c81411236dba3dda 100644
--- a/en/application-dev/application-models/serviceextensionability.md
+++ b/en/application-dev/application-models/serviceextensionability.md
@@ -18,9 +18,9 @@ Each type of ExtensionAbility has its own context. ServiceExtensionAbility has [
This topic describes how to use ServiceExtensionAbility in the following scenarios:
-- [Implementing a Background Service (System Applications Only)](#implementing-a-background-service-system-applications-only)
+- [Implementing a Background Service (for System Applications Only)](#implementing-a-background-service-for-system-applications-only)
-- [Starting a Background Service (System Applications Only)](#starting-a-background-service-system-applications-only)
+- [Starting a Background Service (for System Applications Only)](#starting-a-background-service-for-system-applications-only)
- [Connecting to a Background Service](#connecting-to-a-background-service)
@@ -33,7 +33,7 @@ This topic describes how to use ServiceExtensionAbility in the following scenari
> - Third-party applications can connect to ServiceExtensionAbility provided by the system only when they gain focus in the foreground.
-## Implementing a Background Service (System Applications Only)
+## Implementing a Background Service (for System Applications Only)
[ServiceExtensionAbility](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md) provides the callbacks **onCreate()**, **onRequest()**, **onConnect()**, **onDisconnect()**, and **onDestory()**. Override them as required. The following figure shows the lifecycle of ServiceExtensionAbility.
@@ -164,7 +164,7 @@ To implement a background service, manually create a ServiceExtensionAbility com
```
-## Starting a Background Service (System Applications Only)
+## Starting a Background Service (for System Applications Only)
A system application uses the [startServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartserviceextensionability) method to start a background service. The [onRequest()](../reference/apis/js-apis-app-ability-serviceExtensionAbility.md#serviceextensionabilityonrequest) callback is invoked, and the **Want** object passed by the caller is received through the callback. After the background service is started, its lifecycle is independent of that of the client. In other words, even if the client is destroyed, the background service can still run. Therefore, the background service must be stopped by calling [terminateSelf()](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextterminateself) when its work is complete. Alternatively, another component can call [stopServiceExtensionAbility()](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstopserviceextensionability) to stop the background service.
diff --git a/en/application-dev/application-models/start-remote-pageability.md b/en/application-dev/application-models/start-remote-pageability.md
index 7d270a68058448025def436e71ace635b4a1297c..36ee305b49698c1f6e6cf216174f77212f1d53e4 100644
--- a/en/application-dev/application-models/start-remote-pageability.md
+++ b/en/application-dev/application-models/start-remote-pageability.md
@@ -1,4 +1,4 @@
-# Starting a Remote PageAbility (System Applications Only)
+# Starting a Remote PageAbility (for System Applications Only)
The **startAbility()** method in the **featureAbility** class is used to start a remote PageAbility.
diff --git a/en/application-dev/application-models/static-subscriber-extension-ability.md b/en/application-dev/application-models/static-subscriber-extension-ability.md
deleted file mode 100644
index ae6d9a80b7ab6c693d06e7bfe8bfb11b4db94ab8..0000000000000000000000000000000000000000
--- a/en/application-dev/application-models/static-subscriber-extension-ability.md
+++ /dev/null
@@ -1,107 +0,0 @@
-# StaticSubscriberExtensionAbility Development
-
-## Scenario Description
-
-The common event service provides two subscription modes: dynamic and static. In dynamic subscription mode, a subscriber calls an API during the running period to subscribe to common events. For details, see [Subscribing to Common Events](common-event-subscription.md). In static subscription mode, no common event subscription API is called. A common event is subscribed by configuring a declaration file and implementing a class that inherits from **StaticSubscriberExtensionAbility**. A static subscriber is started once it receives a target event (for example, a power-on event) published by the system or application. At the same time, the **onReceiveEvent** callback is triggered, in which you can implement the service logic. **The static subscriber APIs are system APIs and can be used only by system applications that have passed the system-level power consumption review.**
-
-
-
-## How to Develop
-
-1. Prerequisites
-
- The application must meet the following requirements:
-
- The application is a system application.
-
- The application is developed using the full SDK.
-
- The application's power consumption has passed the system-level power consumption review. If you want to use static subscription in the debugging phase, add the bundle name of your application to the system configuration file **/etc/static_subscriber_config.json**.
-
-
-
-2. Declaring a Static Subscriber
-
- To declare a static subscriber, create an ExtensionAbility, which is derived from the **StaticSubscriberExtensionAbility** class, in the project. The sample code is as follows:
-
- ```ts
- import StaticSubscriberExtensionAbility from '@ohos.application.StaticSubscriberExtensionAbility'
-
- export default class StaticSubscriber extends StaticSubscriberExtensionAbility {
- onReceiveEvent(event) {
- console.log('onReceiveEvent, event:' + event.event);
- }
- }
- ```
-
- You can implement service logic in the **onReceiveEvent** callback.
-
-
-
-3. Project Configuration for a Static Subscriber
-
- After writing the static subscriber code, configure the subscriber in the **module.json5** file. The configuration format is as follows:
-
- ```ts
- {
- "module": {
- ......
- "extensionAbilities": [
- {
- "name": "StaticSubscriber",
- "srcEntrance": "./ets/StaticSubscriber/StaticSubscriber.ts",
- "description": "$string:StaticSubscriber_desc",
- "icon": "$media:icon",
- "label": "$string:StaticSubscriber_label",
- "type": "staticSubscriber",
- "visible": true,
- "metadata": [
- {
- "name": "ohos.extension.staticSubscriber",
- "resource": "$profile:subscribe"
- }
- ]
- }
- ]
- ......
- }
- }
- ```
-
- Pay attention to the following fields in the JSON file:
-
- **srcEntrance**: entry file path of the ExtensionAbility, that is, the file path of the static subscriber declared in Step 2.
-
- **type**: ExtensionAbility type. For a static subscriber, set this field to **staticSubscriber**.
-
- **metadata**: level-2 configuration file information of the ExtensionAbility. The configuration information varies according to the ExtensionAbility type. Therefore, you must use different config files to indicate the specific configuration. The **metadata** field contains two keywords: **name** and **resource**. The **name** field indicates the ExtensionAbility type name. For a static subscriber, declare the name as **ohos.extension.staticSubscriber** for successful identification. The **resource** field indicates the path that stores the ExtensionAbility configuration, which is customizable. In this example, the path is **resources/base/profile/subscribe.json**.
-
- A level-2 configuration file pointed to by **metadata** must be in the following format:
-
- ```ts
- {
- "commonEvents": [
- {
- "name": "xxx",
- "permission": "xxx",
- "events":[
- "xxx"
- ]
- }
- ]
- }
- ```
-
- If the level-2 configuration file is not declared in this format, the file cannot be identified. The fields are described as follows:
-
- **name**: name of the ExtensionAbility, which must be the same as the name of **extensionAbility** declared in **module.json5**.
-
- **permission**: permission required by the publisher. If a publisher without the required permission attempts to publish an event, the event is regarded as invalid and will not be published.
-
- **events**: list of subscribed target events
-
-
-
-## Samples
-
-For details about how to develop StaticSubscriberExtensionAbility, see [StaticSubscriber (ArkTS, API version 9, Full SDK)](https://gitee.com/openharmony/applications_app_samples/tree/master/ability/StaticSubscriber).
diff --git a/en/application-dev/application-models/uiability-intra-device-interaction.md b/en/application-dev/application-models/uiability-intra-device-interaction.md
index 5dc8769e902c6f5eb8c3dfe3241b1287841414c5..25f509e9032a3670664937307fe4691b6a09bc28 100644
--- a/en/application-dev/application-models/uiability-intra-device-interaction.md
+++ b/en/application-dev/application-models/uiability-intra-device-interaction.md
@@ -15,11 +15,11 @@ This topic describes the UIAbility interaction modes in the following scenarios.
- [Starting UIAbility of Another Application and Obtaining the Return Result](#starting-uiability-of-another-application-and-obtaining-the-return-result)
-- [Starting UIAbility with Window Mode Specified (System Applications Only)](#starting-uiability-with-window-mode-specified-system-applications-only)
+- [Starting UIAbility with Window Mode Specified (for System Applications Only)](#starting-uiability-with-window-mode-specified-for-system-applications-only)
- [Starting a Specified Page of UIAbility](#starting-a-specified-page-of-uiability)
-- [Using Ability Call to Implement UIAbility Interaction (System Applications Only)](#using-ability-call-to-implement-uiability-interaction-system-applications-only)
+- [Using Ability Call to Implement UIAbility Interaction (for System Applications Only)](#using-ability-call-to-implement-uiability-interaction-for-system-applications-only)
## Starting UIAbility in the Same Application
@@ -308,7 +308,7 @@ If you want to obtain the return result when using implicit Want to start the UI
})
```
-## Starting UIAbility with Window Mode Specified (System Applications Only)
+## Starting UIAbility with Window Mode Specified (for System Applications Only)
By specifying the window mode when starting the UIAbility of an application, the application can be displayed in different window modes, which can be full-screen, floating window, or split-screen.
@@ -472,7 +472,7 @@ In summary, when a UIAbility instance of application A has been created and the
> When the [launch type of the callee UIAbility](uiability-launch-type.md) is set to **standard**, a new instance is created each time the callee UIAbility is started. In this case, the [onNewWant()](../reference/apis/js-apis-app-ability-uiAbility.md#abilityonnewwant) callback will not be invoked.
-## Using Ability Call to Implement UIAbility Interaction (System Applications Only)
+## Using Ability Call to Implement UIAbility Interaction (for System Applications Only)
Ability call is an extension of the UIAbility capability. It enables the UIAbility to be invoked by and communicate with external systems. The UIAbility invoked can be either started in the foreground or created and run in the background. You can use the ability call to implement data sharing between two UIAbility instances (caller ability and callee ability) through IPC.
@@ -488,7 +488,7 @@ Ability call is usually used in the following scenarios:
- Starting the callee ability in the background
- **Table 1** Terms used in the ability call
+**Table 1** Terms used in the ability call
| **Term**| Description|
| -------- | -------- |
@@ -519,15 +519,15 @@ The following figure shows the ability call process.
The following table describes the main APIs used for the ability call. For details, see [AbilityContext](../reference/apis/js-apis-app-ability-uiAbility.md#caller).
- **Table 2** Ability call APIs
+**Table 2** Ability call APIs
| API| Description|
| -------- | -------- |
| startAbilityByCall(want: Want): Promise<Caller> | Starts a UIAbility in the foreground (through the **want** configuration) or background (default) and obtains the caller object for communication with the UIAbility. For details, see [AbilityContext](../reference/apis/js-apis-inner-application-uiAbilityContext.md#abilitycontextstartabilitybycall) or [ServiceExtensionContext](../reference/apis/js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextstartabilitybycall).|
| on(method: string, callback: CalleeCallBack): void | Callback invoked when the callee ability registers a method.|
| off(method: string): void | Callback invoked when the callee ability deregisters a method.|
-| call(method: string, data: rpc.Sequenceable): Promise<void> | Sends agreed sequenceable data to the callee ability.|
-| callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessageParcel> | Sends agreed sequenceable data to the callee ability and obtains the agreed sequenceable data returned by the callee ability.|
+| call(method: string, data: rpc.Parcelable): Promise<void> | Sends agreed parcelable data to the callee ability.|
+| callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence> | Sends agreed parcelable data to the callee ability and obtains the agreed parcelable data returned by the callee ability.|
| release(): void | Releases the caller object.|
| on(type: "release", callback: OnReleaseCallback): void | Callback invoked when the caller object is released.|
@@ -571,13 +571,13 @@ For the callee ability, implement the callback to receive data and the methods t
import Ability from '@ohos.app.ability.UIAbility';
```
-3. Define the agreed sequenceable data.
+3. Define the agreed parcelable data.
The data formats sent and received by the caller and callee abilities must be consistent. In the following example, the data formats are number and string.
```ts
- export default class MySequenceable {
+ export default class MyParcelable {
num: number = 0
str: string = ""
@@ -586,15 +586,15 @@ For the callee ability, implement the callback to receive data and the methods t
this.str = string
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num)
- messageParcel.writeString(this.str)
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num)
+ messageSequence.writeString(this.str)
return true
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt()
- this.str = messageParcel.readString()
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt()
+ this.str = messageSequence.readString()
return true
}
}
@@ -602,7 +602,7 @@ For the callee ability, implement the callback to receive data and the methods t
4. Implement **Callee.on** and **Callee.off**.
- The time to register a listener for the callee ability depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the ability and deregistered in **onDestroy**. After receiving sequenceable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The sample code is as follows:
+ The time to register a listener for the callee ability depends on your application. The data sent and received before the listener is registered and that after the listener is deregistered are not processed. In the following example, the **MSG_SEND_METHOD** listener is registered in **onCreate** of the ability and deregistered in **onDestroy**. After receiving parcelable data, the application processes the data and returns the data result. You need to implement processing based on service requirements. The sample code is as follows:
```ts
const TAG: string = '[CalleeAbility]';
const MSG_SEND_METHOD: string = 'CallSendMsg';
@@ -610,14 +610,14 @@ For the callee ability, implement the callback to receive data and the methods t
function sendMsgCallback(data) {
console.info('CalleeSortFunc called');
- // Obtain the sequenceable data sent by the caller ability.
- let receivedData = new MySequenceable(0, '');
- data.readSequenceable(receivedData);
+ // Obtain the parcelable data sent by the caller ability.
+ let receivedData = new MyParcelable(0, '');
+ data.readParcelable(receivedData);
console.info(`receiveData[${receivedData.num}, ${receivedData.str}]`);
// Process the data.
- // Return the sequenceable data result to the caller ability.
- return new MySequenceable(receivedData.num + 1, `send ${receivedData.str} succeed`);
+ // Return the parcelable data result to the caller ability.
+ return new MyParcelable(receivedData.num + 1, `send ${receivedData.str} succeed`);
}
export default class CalleeAbility extends Ability {
diff --git a/en/application-dev/application-models/windowextensionability.md b/en/application-dev/application-models/windowextensionability.md
index cf2ce01947412e479d29516601c45aebc2b55b17..069897ad02435070ac470f5d2d3d528c76b417e8 100644
--- a/en/application-dev/application-models/windowextensionability.md
+++ b/en/application-dev/application-models/windowextensionability.md
@@ -14,7 +14,7 @@ the context is [WindowExtensionContext](../reference/apis/js-apis-inner-applicat
>
-## Setting an Embedded Ability (System Applications Only)
+## Setting an Embedded Ability (for System Applications Only)
The **WindowExtensionAbility** class provides **onConnect()**, **onDisconnect()**, and **onWindowReady()** lifecycle callbacks, which can be overridden.
@@ -78,7 +78,7 @@ To implement an embedded application, manually create a WindowExtensionAbility i
```
-## Starting an Embedded Ability (System Applications Only)
+## Starting an Embedded Ability (for System Applications Only)
System applications can load the created WindowExtensionAbility through the AbilityComponent.
diff --git a/en/application-dev/connectivity/http-request.md b/en/application-dev/connectivity/http-request.md
index da1a7e1c517f284037a41a88e2167b6d1d2406aa..a266e285245c932534873440fc777fd86ccd480d 100644
--- a/en/application-dev/connectivity/http-request.md
+++ b/en/application-dev/connectivity/http-request.md
@@ -1,6 +1,6 @@
# HTTP Data Request
-## Use Cases
+## When to Use
An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**.
@@ -14,40 +14,49 @@ For details about how to apply for permissions, see [Access Control Development]
The following table provides only a simple description of the related APIs. For details, see [API Reference](../reference/apis/js-apis-http.md).
-| API | Description |
-| ----------------------------------------- | --------------------------------------------------------- |
-| createHttp() | Creates an HTTP request. |
-| request() | Initiates an HTTP request to a given URL. |
-| destroy() | Destroys an HTTP request. |
+| API | Description |
+| ----------------------------------------- | ----------------------------------- |
+| createHttp() | Creates an HTTP request. |
+| request() | Initiates an HTTP request to a given URL. |
+| request2()10+ | Initiates an HTTP network request based on the URL and returns a streaming response.|
+| destroy() | Destroys an HTTP request. |
| on(type: 'headersReceive') | Registers an observer for HTTP Response Header events. |
-| off(type: 'headersReceive') | Unregisters the observer for HTTP Response Header events. |
+| off(type: 'headersReceive') | Unregisters the observer for HTTP Response Header events.|
+| once\('headersReceive'\)8+ | Registers a one-time observer for HTTP Response Header events.|
+| on\('dataReceive'\)10+ | Registers an observer for events indicating receiving of HTTP streaming responses. |
+| off\('dataReceive'\)10+ | Unregisters the observer for events indicating receiving of HTTP streaming responses. |
+| on\('dataEnd'\)10+ | Registers an observer for events indicating completion of receiving HTTP streaming responses. |
+| off\('dataEnd'\)10+ | Unregisters the observer for events indicating completion of receiving HTTP streaming responses.|
+| on\('dataProgress'\)10+ | Registers an observer for events indicating progress of receiving HTTP streaming responses. |
+| off\('dataProgress'\)10+ | Unregisters the observer for events indicating progress of receiving HTTP streaming responses.|
## How to Develop
-1. Import the required HTTP module.
-2. Create an **HttpRequest** object.
-3. (Optional) Listen for HTTP Response Header events.
-4. Initiate an HTTP request to a given URL.
-5. (Optional) Process the HTTP Response Header event and the return result of the HTTP request.
+1. Import the **http** namespace from **@ohos.net.http.d.ts**.
+2. Call **createHttp()** to create an **HttpRequest** object.
+3. Call **httpRequest.on()** to subscribe to HTTP response header events. This API returns a response earlier than the request. You can subscribe to HTTP response header events based on service requirements.
+4. Call **httpRequest.request()** to initiate a network request. You need to pass in the URL and optional parameters of the HTTP request.
+5. Parse the returned result based on service requirements.
+6. Call **off()** to unsubscribe from HTTP response header events.
+7. Call **httpRequest.destroy()** to release resources after the request is processed.
```js
+// Import the http namespace.
import http from '@ohos.net.http';
-// Each HttpRequest corresponds to an HttpRequestTask object and cannot be reused.
+// Each httpRequest corresponds to an HTTP request task and cannot be reused.
let httpRequest = http.createHttp();
-
-// Subscribe to the HTTP response header, which is returned earlier than HttpRequest. You can subscribe to HTTP Response Header events based on service requirements.
-// on('headerReceive', AsyncCallback) will be replaced by on('headersReceive', Callback) in API version 8. 8+
+// This API is used to listen for the HTTP Response Header event, which is returned earlier than the result of the HTTP request. It is up to you whether to listen for HTTP Response Header events.
+// on('headerReceive', AsyncCallback) is replaced by on('headersReceive', Callback) since API version 8.
httpRequest.on('headersReceive', (header) => {
console.info('header: ' + JSON.stringify(header));
});
-
httpRequest.request(
- // Set the URL of the HTTP request. You need to define the URL. Set the parameters of the request in extraData.
+ // Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL.
"EXAMPLE_URL",
{
method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET.
- // You can add the header field based on service requirements.
+ // You can add header fields based on service requirements.
header: {
'Content-Type': 'application/json'
},
@@ -55,21 +64,33 @@ httpRequest.request(
extraData: {
"data": "data to send",
},
- connectTimeout: 60000, // Optional. The default value is 60000, in ms.
+ expectDataType: http.HttpDataType.STRING, // Optional. This field specifies the type of the return data.
+ usingCache: true, // Optional. The default value is true.
+ priority: 1, // Optional. The default value is 1.
+ connectTimeout: 60000 // Optional. The default value is 60000, in ms.
readTimeout: 60000, // Optional. The default value is 60000, in ms.
+ usingProtocol: http.HttpProtocol.HTTP1_1, // Optional. The default protocol type is automatically specified by the system.
+ usingProxy: false, // Optional. By default, network proxy is not used. This field is supported since API 10.
}, (err, data) => {
if (!err) {
- // data.result contains the HTTP response. Parse the response based on service requirements.
- console.info('Result:' + data.result);
- console.info('code:' + data.responseCode);
- // data.header contains the HTTP response header. Parse the content based on service requirements.
+ // data.result carries the HTTP response. Parse the response based on service requirements.
+ console.info('Result:' + JSON.stringify(data.result));
+ console.info('code:' + JSON.stringify(data.responseCode));
+ // data.header carries the HTTP response header. Parse the content based on service requirements.
console.info('header:' + JSON.stringify(data.header));
- console.info('cookies:' + data.cookies); // 8+
+ console.info('cookies:' + JSON.stringify(data.cookies)); // 8+
} else {
console.info('error:' + JSON.stringify(err));
- // Call the destroy() method to destroy the request if it is no longer needed.
+ // Unsubscribe from HTTP Response Header events.
+ httpRequest.off('headersReceive');
+ // Call the destroy() method to release resources after HttpRequest is complete.
httpRequest.destroy();
}
}
);
```
+
+## Samples
+The following sample is provided to help you better understand how to develop the HTTP data request feature:
+- [`HTTP`: Data Request (ArkTS) (API9)](https://gitee.com/openharmony/applications_app_samples/tree/master/code/BasicFeature/Connectivity/Http)
+- [HTTP Communication (ArkTS) (API9)](https://gitee.com/openharmony/codelabs/tree/master/NetworkManagement/SmartChatEtsOH)
diff --git a/en/application-dev/connectivity/socket-connection.md b/en/application-dev/connectivity/socket-connection.md
index 96c802d565d0e58201b627d18be1e59093919a07..b0c6fcd63d49a6cf9b77662d8340cadc8f82735d 100644
--- a/en/application-dev/connectivity/socket-connection.md
+++ b/en/application-dev/connectivity/socket-connection.md
@@ -49,6 +49,7 @@ TLS Socket connection functions are mainly provided by the **tls_socket** module
| API| Description|
| -------- | -------- |
+| constructTLSSocketInstance() | Creates a **TLSSocket** object.|
| bind() | Binds the IP address and port number.|
| close(type: 'error') | Closes a Socket connection.|
| connect() | Sets up a connection to the specified IP address and port number.|
@@ -189,7 +190,7 @@ TLS Socket connection process on the client:
let tlsTwoWay = socket.constructTLSSocketInstance();
// Subscribe to TLS Socket connection events.
- tcp.on('message', value => {
+ tlsTwoWay.on('message', value => {
console.log("on message")
let buffer = value.message
let dataView = new DataView(buffer)
@@ -199,10 +200,10 @@ TLS Socket connection process on the client:
}
console.log("on connect received:" + str)
});
- tcp.on('connect', () => {
+ tlsTwoWay.on('connect', () => {
console.log("on connect")
});
- tcp.on('close', () => {
+ tlsTwoWay.on('close', () => {
console.log("on close")
});
@@ -245,23 +246,23 @@ TLS Socket connection process on the client:
console.log(data);
});
- // Enable the TLS Socket connection to be automatically closed after use. Then, disable listening for TLS Socket connection events.
- tls.close((err) => {
+ // Enable the TCP Socket connection to be automatically closed after use. Then, disable listening for TCP Socket connection events.
+ tlsTwoWay.close((err) => {
if (err) {
console.log("close callback error = " + err);
} else {
console.log("close success");
}
- tls.off('message');
- tls.off('connect');
- tls.off('close');
+ tlsTwoWay.off('message');
+ tlsTwoWay.off('connect');
+ tlsTwoWay.off('close');
});
// Create a TLS Socket connection (for one-way authentication).
let tlsOneWay = socket.constructTLSSocketInstance(); // One way authentication
// Subscribe to TLS Socket connection events.
- tcp.on('message', value => {
+ tlsTwoWay.on('message', value => {
console.log("on message")
let buffer = value.message
let dataView = new DataView(buffer)
@@ -271,10 +272,10 @@ TLS Socket connection process on the client:
}
console.log("on connect received:" + str)
});
- tcp.on('connect', () => {
+ tlsTwoWay.on('connect', () => {
console.log("on connect")
});
- tcp.on('close', () => {
+ tlsTwoWay.on('close', () => {
console.log("on close")
});
@@ -306,16 +307,16 @@ TLS Socket connection process on the client:
console.log(data);
});
- // Enable the TLS Socket connection to be automatically closed after use. Then, disable listening for TLS Socket connection events.
- tls.close((err) => {
+ // Enable the TCP Socket connection to be automatically closed after use. Then, disable listening for TCP Socket connection events.
+ tlsTwoWay.close((err) => {
if (err) {
console.log("close callback error = " + err);
} else {
console.log("close success");
}
- tls.off('message');
- tls.off('connect');
- tls.off('close');
+ tlsTwoWay.off('message');
+ tlsTwoWay.off('connect');
+ tlsTwoWay.off('close');
});
```
diff --git a/en/application-dev/database/database-datashare-guidelines.md b/en/application-dev/database/database-datashare-guidelines.md
index 1f25dccf2a36f3bbedb5728291e8e11b3292476e..580811158051b5b6d5d2137f4b14654a46e891b9 100644
--- a/en/application-dev/database/database-datashare-guidelines.md
+++ b/en/application-dev/database/database-datashare-guidelines.md
@@ -34,7 +34,7 @@ There are two roles in **DataShare**:
- Data provider: adds, deletes, modifies, and queries data, opens files, and shares data.
- Data consumer: accesses the data provided by the provider using **DataShareHelper**.
-### Data Provider Application Development (Only for System Applications)
+### Data Provider Application Development (for System Applications Only)
[DataShareExtensionAbility](../reference/apis/js-apis-application-dataShareExtensionAbility.md) provides the following APIs. You can override these APIs as required.
diff --git a/en/application-dev/device/pointerstyle-guidelines.md b/en/application-dev/device/pointerstyle-guidelines.md
index cecab92b282e2da7a3bb966bcedeefa84768f22e..bcc09093eed4440a0c5e62c5d4cfe37a3f954c87 100644
--- a/en/application-dev/device/pointerstyle-guidelines.md
+++ b/en/application-dev/device/pointerstyle-guidelines.md
@@ -15,11 +15,11 @@ import pointer from '@ohos.multimodalInput.pointer';
The following table lists the common APIs for mouse pointer management. For details about the APIs, see [ohos.multimodalInput.pointer](../reference/apis/js-apis-pointer.md).
| Instance | API | Description |
-| ------- | ------------------------------------------------------------ | --------------------------------------------------------------- |
-| pointer | function isPointerVisible(callback: AsyncCallback\): void; | Checks the visible status of the mouse pointer. |
-| pointer | function setPointerVisible(visible: boolean, callback: AsyncCallback\): void; | Sets the visible status of the mouse pointer. This setting takes effect for the mouse pointer globally. |
+| ------- | ------------------------------------------------------------ | ------------------------------------------------------------ |
+| pointer | function isPointerVisible(callback: AsyncCallback\): void; | Checks the visible status of the mouse pointer. |
+| pointer | function setPointerVisible(visible: boolean, callback: AsyncCallback\): void; | Sets the visible status of the mouse pointer. This setting takes effect for the mouse pointer globally.|
| pointer | function setPointerStyle(windowId: number, pointerStyle: PointerStyle, callback: AsyncCallback\): void; | Sets the mouse pointer style. This setting takes effect for the mouse pointer style of a specified window. |
-| pointer | function getPointerStyle(windowId: number, callback: AsyncCallback\): void; | Obtains the mouse pointer style. |
+| pointer | function getPointerStyle(windowId: number, callback: AsyncCallback\): void; | Obtains the mouse pointer style. |
## Hiding the Mouse Pointer
@@ -77,43 +77,48 @@ When designing a color picker, you can have the mouse pointer switched to the co
5. Set the mouse pointer to the default style.
```js
+import pointer from '@ohos.multimodalInput.pointer';
import window from '@ohos.window';
// 1. Enable the color pickup function.
// 2. Obtain the window ID.
-window.getTopWindow((error, windowClass) => {
- windowClass.getProperties((error, data) => {
- var windowId = data.id;
- if (windowId < 0) {
- console.log(`Invalid windowId`);
- return;
- }
- try {
- // 3. Set the mouse pointer to the color picker style.
- pointer.setPointerStyle(windowId, pointer.PointerStyle.COLOR_SUCKER).then(() => {
- console.log(`Successfully set mouse pointer style`);
- });
- } catch (error) {
- console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(message)}`);
- }
- });
+window.getLastWindow(this.context, (error, windowClass) => {
+ if (error.code) {
+ console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
+ return;
+ }
+ var windowId = windowClass.getWindowProperties().id;
+ if (windowId < 0) {
+ console.log(`Invalid windowId`);
+ return;
+ }
+ try {
+ // 3. Set the mouse pointer to the color picker style.
+ pointer.setPointerStyle(windowId, pointer.PointerStyle.COLOR_SUCKER).then(() => {
+ console.log(`Successfully set mouse pointer style`);
+ });
+ } catch (error) {
+ console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(`message`)}`);
+ }
});
// 4. End color pickup.
-window.getTopWindow((error, windowClass) => {
- windowClass.getProperties((error, data) => {
- var windowId = data.id;
- if (windowId < 0) {
- console.log(`Invalid windowId`);
- return;
- }
- try {
- // 5. Set the mouse pointer to the default style.
- pointer.setPointerStyle(windowId, pointer.PointerStyle.DEFAULT).then(() => {
- console.log(`Successfully set mouse pointer style`);
- });
- } catch (error) {
- console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(message)}`);
- }
- });
+window.getLastWindow(this.context, (error, windowClass) => {
+ if (error.code) {
+ console.error('Failed to obtain the top window. Cause: ' + JSON.stringify(error));
+ return;
+ }
+ var windowId = windowClass.getWindowProperties().id;
+ if (windowId < 0) {
+ console.log(`Invalid windowId`);
+ return;
+ }
+ try {
+ // 5. Set the mouse pointer to the default style.
+ pointer.setPointerStyle(windowId, pointer.PointerStyle.DEFAULT).then(() => {
+ console.log(`Successfully set mouse pointer style`);
+ });
+ } catch (error) {
+ console.log(`Failed to set the pointer style, error=${JSON.stringify(error)}, msg=${JSON.stringify(`message`)}`);
+ }
});
```
diff --git a/en/application-dev/dfx/hiappevent-guidelines.md b/en/application-dev/dfx/hiappevent-guidelines.md
index 9991e10c731d9130a7c1f52154e18ac19bce336d..640b9185ee236dbe0fb5dfe3808b14322a401a23 100644
--- a/en/application-dev/dfx/hiappevent-guidelines.md
+++ b/en/application-dev/dfx/hiappevent-guidelines.md
@@ -45,7 +45,7 @@ The following table provides only a brief description of related APIs. For detai
The following example illustrates how to log and subscribe to button click events of users.
-1. Create an eTS application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **entryability** > **EntryAbility.ts**, and double-click **EntryAbility.ts**. Then, add an event watcher to subscribe to button click events. The complete sample code is as follows:
+1. Create an ArkTS application project. In the displayed **Project** window, choose **entry** > **src** > **main** > **ets** > **entryability** > **EntryAbility.ts**, and double-click **EntryAbility.ts**. Then, add an event watcher to subscribe to button click events. The complete sample code is as follows:
```js
import hilog from '@ohos.hilog';
diff --git a/en/application-dev/faqs/faqs-device-management.md b/en/application-dev/faqs/faqs-device-management.md
index dd836eb11abfbee3979f5a604eb5aa734d0d9112..ea71edd6c9940437e197be35e60a6638c73ae88d 100644
--- a/en/application-dev/faqs/faqs-device-management.md
+++ b/en/application-dev/faqs/faqs-device-management.md
@@ -2,23 +2,21 @@
## How do I obtain the DPI of a device?
-Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
-
-Import the **\@ohos.display** module and call the **getDefaultDisplay** API.
+Applicable to: OpenHarmony 3.2 Beta5, stage model of API version 9
-Example:
+Import the **@ohos.display** module and call the **getDefaultDisplaySync** API.
+**Example**
```
import display from '@ohos.display';
-display.getDefaultDisplay((err, data) => {
- if (err.code) {
- console.error('Test Failed to obtain the default display object. Code: ' + JSON.stringify(err));
- return;
- }
- console.info('Test Succeeded in obtaining the default display object. Data:' + JSON.stringify(data));
- console.info('Test densityDPI:' + JSON.stringify(data.densityDPI));
-});
+let displayClass = null;
+try {
+ displayClass = display.getDefaultDisplaySync();
+ console.info('Test densityDPI:' + JSON.stringify(data.densityDPI));
+} catch (exception) {
+ console.error('Failed to obtain the default display object. Code: ' + JSON.stringify(exception));
+}
```
## How do I obtain the type of the device where the application is running?
diff --git a/en/application-dev/media/Readme-EN.md b/en/application-dev/media/Readme-EN.md
index 94f8605a284976058c8df8537a5ae9aa4a624740..f6902595cadbea27765ebf1812544821b3c68a09 100755
--- a/en/application-dev/media/Readme-EN.md
+++ b/en/application-dev/media/Readme-EN.md
@@ -12,10 +12,10 @@
- [Audio Routing and Device Management Development](audio-routing-manager.md)
- [AVPlayer Development (Recommended)](avplayer-playback.md)
- [AVRecorder Development (Recommended)](avrecorder.md)
- - [Audio Playback Development (To Be Deprecated)](audio-playback.md)
- - [Audio Recording Development (To Be Deprecated)](audio-recorder.md)
- - [Video Playback Development (To Be Deprecated)](video-playback.md)
- - [Video Recording Development (To Be Deprecated)](video-recorder.md)
+ - [Audio Playback Development (To Be Deprecated Soon)](audio-playback.md)
+ - [Audio Recording Development (To Be Deprecated Soon)](audio-recorder.md)
+ - [Video Playback Development (To Be Deprecated Soon)](video-playback.md)
+ - [Video Recording Development (To Be Deprecated Soon)](video-recorder.md)
- AVSession
- [AVSession Overview](avsession-overview.md)
diff --git a/en/application-dev/media/avplayer-playback.md b/en/application-dev/media/avplayer-playback.md
index 324dd43e6f73d46e5f0d264ae81ba36802ee6021..9a7d9ffa10e2de83e676adbd2c5af7f9b3ba35af 100644
--- a/en/application-dev/media/avplayer-playback.md
+++ b/en/application-dev/media/avplayer-playback.md
@@ -292,13 +292,13 @@ export class AVPlayerDemo {
async avPlayerDemo() {
// Create an AVPlayer instance.
this.avPlayer = await media.createAVPlayer()
- let fdPath = 'fd://'
- let pathDir = "/data/storage/el2/base/haps/entry/files" // The path used here is an example. Obtain the path based on project requirements.
- // The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\H264_AAC.mp4 /data/app/el2/100/base/ohos.acts.multimedia.media.avplayer/haps/entry/files" command.
- let path = pathDir + '/H264_AAC.mp4'
- let file = await fs.open(path)
- fdPath = fdPath + '' + file.fd
- this.avPlayer.url = fdPath
+ let fileDescriptor = undefined
+ // Use getRawFileDescriptor of the resource management module to obtain the media assets in the application, and use the fdSrc attribute of the AVPlayer to initialize the media assets.
+ // For details on the fd/offset/length parameter, see the Media API. The globalThis.abilityContext parameter is a system environment variable and is saved as a global variable on the main page during the system boost.
+ await globalThis.abilityContext.resourceManager.getRawFileDescriptor('H264_AAC.mp4').then((value) => {
+ fileDescriptor = {fd: value.fd, offset: value.offset, length: value.length}
+ })
+ this.avPlayer.fdSrc = fileDescriptor
}
}
```
diff --git a/en/application-dev/media/opensles-capture.md b/en/application-dev/media/opensles-capture.md
index 4e1775e178db20e01f15ee7a9b8f685a5c47b07b..3c33b37076ac14d98b550ba7b1a7e36bfe1cb048 100644
--- a/en/application-dev/media/opensles-capture.md
+++ b/en/application-dev/media/opensles-capture.md
@@ -53,10 +53,10 @@ To use OpenSL ES to develop the audio recording function in OpenHarmony, perform
// Configure the parameters based on the audio file format.
SLDataFormat_PCM format_pcm = {
- SL_DATAFORMAT_PCM,
- OHOS::AudioStandard::AudioChannel::MONO,
- OHOS::AudioStandard::AudioSamplingRate::SAMPLE_RATE_44100,
- OHOS::AudioStandard::AudioSampleFormat::SAMPLE_S16LE,
+ SL_DATAFORMAT_PCM, // Input audio format.
+ 1, // Mono channel.
+ SL_SAMPLINGRATE_44_1, // Sampling rate, 44100 Hz.
+ SL_PCMSAMPLEFORMAT_FIXED_16, // Audio sampling format, a signed 16-bit integer in little-endian format.
0,
0,
0
diff --git a/en/application-dev/notification/Readme-EN.md b/en/application-dev/notification/Readme-EN.md
index bf85581053f30d6aa56e0218c51339ef6ee3f268..55070f9e38666be2c6cd5cf87b3d3680df0293ba 100644
--- a/en/application-dev/notification/Readme-EN.md
+++ b/en/application-dev/notification/Readme-EN.md
@@ -1,7 +1,7 @@
# Notification
- [Notification Overview](notification-overview.md)
-- [Notification Subscription (Open Only to System Applications)](notification-subscription.md)
+- [Notification Subscription (for System Applications)](notification-subscription.md)
- [Enabling Notification](notification-enable.md)
- Publishing a Notification
- [Publishing a Basic Notification](text-notification.md)
diff --git a/en/application-dev/notification/notification-subscription.md b/en/application-dev/notification/notification-subscription.md
index c62b65a25c4d80b37610449e6309e05ef259893f..95fe77de7feead97208082c12519523588cd6521 100644
--- a/en/application-dev/notification/notification-subscription.md
+++ b/en/application-dev/notification/notification-subscription.md
@@ -1,4 +1,4 @@
-# Notification Subscription (Open Only to System Applications)
+# Notification Subscription (for System Applications Only)
To receive notifications, an application must subscribe to notifications first. The notification subsystem provides two types of subscription APIs, allowing applications to subscribe to notifications from all applications or notifications from a specific application.
diff --git a/en/application-dev/notification/text-notification.md b/en/application-dev/notification/text-notification.md
index a9d9bdaaaccc731f0e7cec7e3f7a7e74a3aa41d6..7901a78a4c547ca02caae191b551d27f6cae3e3a 100644
--- a/en/application-dev/notification/text-notification.md
+++ b/en/application-dev/notification/text-notification.md
@@ -127,10 +127,10 @@ The following table describes the APIs for notification publishing. You specify
Below is an example of the multi-line notification.

- - In addition to the parameters in the normal text notification, the picture-attached text notification provides the **picture**, **briefText**, and **expandedTitle** parameters. The value of **picture** is a pixel map that does not exceed 2 MB.
+ - In addition to the parameters in the normal text notification, the picture-attached text notification provides the **picture**, **briefText**, and **expandedTitle** parameters. The value of **picture** is a [PixelMap](../reference/apis/js-apis-image.md#pixelmap7) object that does not exceed 2 MB.
```ts
- let notificationPicture: PixelMap = undefined; // Obtain the pixel map information.
+ let imagePixelMap: PixelMap = undefined; // Obtain the PixelMap information.
let notificationRequest: notificationManager.NotificationRequest = {
id: 1,
content: {
@@ -141,7 +141,7 @@ The following table describes the APIs for notification publishing. You specify
additionalText: 'test_additionalText',
briefText: 'test_briefText',
expandedTitle: 'test_expandedTitle',
- picture: notificationPicture
+ picture: imagePixelMap
}
}
}
diff --git a/en/application-dev/quick-start/Readme-EN.md b/en/application-dev/quick-start/Readme-EN.md
index 439bbdcb9d9455a36c75ceb8ba39e728d1aecebd..91136d49f0db6aa18ecc86447894b922f9c263ff 100644
--- a/en/application-dev/quick-start/Readme-EN.md
+++ b/en/application-dev/quick-start/Readme-EN.md
@@ -1,4 +1,5 @@
# Quick Start
+
- Getting Started
- [Before You Start](start-overview.md)
- [Getting Started with ArkTS in Stage Model](start-with-ets-stage.md)
@@ -10,7 +11,6 @@
- Application Package Structure
- [Application Package Structure in Stage Model](application-package-structure-stage.md)
- [Application Package Structure in FA Model](application-package-structure-fa.md)
- - [HAR File Structure](har-structure.md)
- Multi-HAP Mechanism
- [Multi-HAP Design Objectives](multi-hap-objective.md)
- [Multi-HAP Build View](multi-hap-build-view.md)
@@ -18,6 +18,16 @@
- [Multi-HAP Usage Rules](multi-hap-rules.md)
- [Multi-HAP Operation Mechanism and Data Communication Modes](multi-hap-principles.md)
- [Application Installation and Uninstallation Process](application-package-install-uninstall.md)
+ - [Application Package Update Process](application-package-update.md)
+ - Shared Package
+ - [Shared Package Overview](shared-guide.md)
+ - [HAR](har-package.md)
+ - HSP
+ - [In-Application HSP Development](in-app-hsp.md)
+ - [Inter-Application HSP Development (for System Applications Only)](cross-app-hsp.md)
+ - Quick Fix
+ - [Quick Fix Overview](quickfix-principles.md)
+ - [CLI-based Quick Fix Development](quickfix-debug.md)
- Application Configuration Files in Stage Model
- [Application Configuration File Overview (Stage Model)](application-configuration-file-overview-stage.md)
- [app.json5 Configuration File](app-configuration-file.md)
diff --git a/en/application-dev/quick-start/application-package-structure-stage.md b/en/application-dev/quick-start/application-package-structure-stage.md
index b9bd91d798c6a57c06c74cebb38bf558c8fa011d..cb6dc3b12ef12ff249d8afaa9871f901babd9412 100644
--- a/en/application-dev/quick-start/application-package-structure-stage.md
+++ b/en/application-dev/quick-start/application-package-structure-stage.md
@@ -1,17 +1,17 @@
# Application Package Structure in Stage Model
-To develop an application based on the [stage model](application-configuration-file-overview-stage.md), it is essential to understand the structure of the application package created after the application is built and packaged.
+To develop an application based on the [stage model](application-configuration-file-overview-stage.md), it will be helpful if you have a basic understanding of the structure of the application package created after the application is built and packaged, as well as the related basic concepts.
-- In development, an application contains one or more modules. You can [create modules](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3) in the application project in [DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio/). As a basic functional unit of an OpenHarmony application/service, a module contains source code, resource files, third-party libraries, and application/service configuration files, and can be built and run independently. Modules can be classified as Ability or Library. A module of the Ability type is built into a Harmony Ability Package (HAP) file in .hap format, and a module of the Library type is built into a [Harmony Ability Resources (HAR) file](har-structure.md) in .tgz format.
+- In development, an application contains one or more modules. You can [create modules](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3) in the application project in [DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio/). As a basic functional unit of an OpenHarmony application/service, a module contains source code, resource files, third-party libraries, and application/service configuration files, and can be built and run independently. Modules can be classified as Ability or Library. A module of the Ability type is built into a Harmony Ability Package (HAP) file, and a module of the Library type is built into a [Harmony Archive (HAR)](har-package.md) file or a [Harmony Shared Package (HSP)](shared-guide.md).
A module can contain one or more [UIAbility](../application-models/uiability-overview.md) components, as shown in the figure below.
- **Figure 1** Relationship between modules and UIAbility components
+ **Figure 1** Relationship between modules and UIAbility components

- Unless otherwise specified, the modules described in this document refer to the modules of the Ability type.
+ Unless otherwise specified, the modules described in this document refer to the modules of the Ability type.
- As aforementioned, you can build an application into one or more HAP files. The HAP file is the basic unit for installing an application. It provides code, resources, third-party libraries, and a configuration file. HAP files can be classified as Entry or Feature.
- HAP of the entry type: main module of the application, whose **type** field is set to **"entry"** in the [module.json5](module-configuration-file.md) file. In an application, each type of device supports only one HAP of the entry type, which is typically used to implement the application's entry screen, entry icon, or headline feature.
@@ -27,6 +27,6 @@ To develop an application based on the [stage model](application-configuration-f
- The **module.json** file is the configuration file indispensable in a HAP file. It consists of **module.json5** and **app.json5** in the project configuration. While DevEco Studio provides default configuration, you must modify the configuration as needed. For details about the configuration fields, see [Application Configuration Files in Stage Model](application-configuration-file-overview-stage.md).
- The **pack.info** file describes the HAP attributes in the bundle, for example, **bundleName** and **versionCode** in **app** and **name**, **type**, and **abilities** in **module**. The file is automatically generated when DevEco Studio generates the bundle.
- **Figure 2** Application package structure in stage model
-
- 
\ No newline at end of file
+ **Figure 2** Application package structure in stage model
+
+ 
diff --git a/en/application-dev/quick-start/application-package-update.md b/en/application-dev/quick-start/application-package-update.md
new file mode 100644
index 0000000000000000000000000000000000000000..0137bc47e7ad78345da1128cf423e445d8456f97
--- /dev/null
+++ b/en/application-dev/quick-start/application-package-update.md
@@ -0,0 +1,5 @@
+# Application Package Update Process
+The OpenHarmony bundle manager service allows application packages to be updated under the following scenarios:
+
+1. In the application market: The application market notifies the user of an available update, and the user can install the update by following the onscreen instructions.
+2. In the application: When the application for which an update is available starts up, the application market notifies the user of the update, and the user can install the update by following the onscreen instructions.
diff --git a/en/application-dev/quick-start/cross-app-hsp.md b/en/application-dev/quick-start/cross-app-hsp.md
new file mode 100644
index 0000000000000000000000000000000000000000..15345c966babd31b925d29160325eaf66e5b1140
--- /dev/null
+++ b/en/application-dev/quick-start/cross-app-hsp.md
@@ -0,0 +1,224 @@
+# Inter-Application HSP Development
+
+An inter-application Harmony Shared Package (HSP) is a file used for code and resource sharing between the host application and other applications.
+The host application of an inter-application HSP is a special form of application, which consists of only one HSP. Instead of running independently on a device, the host application runs by being referenced by dependencies of common application modules. When a common application is running, it can invoke capabilities provided by the inter-application HSP dynamically as needed.
+
+## Precautions
+1. The code of an inter-application HSP runs in the application process. When invoking the code, implement an exception capture and fault tolerance mechanism to avoid stability issues caused by malfunctioning of the inter-application HSP.
+2. An application can depend on multiple inter-application HSP files at the same time.
+3. The inter-application HSP may slow down the startup of the application that depends on it. To avoid significant increase in the startup delay, limit the number of inter-application HSP dependencies within 16.
+4. Third-party developers can only use the system-provided inter-application HSP files.
+
+## Inter-Application HSP Usage
+An inter-application HSP works by combining the following parts:
+
+[HAR](har-package.md): contains only objects and methods to be exported and therefore comes in a small size. By integrating the HAR into your application project, you can call the objects and methods therein to implement features.
+
+HSP: contains the actual implementation code, including the JS/TS code, C++ libraries, resources, and configuration files. It is either released to the application market or integrated into the system version.
+
+### Integrating the HAR in an Inter-Application HSP
+Define the interfaces to be exported in the **index.d.ets** file in the HAR, which is the entry to the declaration file exported by the inter-application HSP. The path of the **index.d.ets** file is as follows:
+```
+src
+├── main
+| └── module.json5
+├── index.d.ets
+└── package.json
+```
+Below is an example of the **index.d.ets** file content:
+```ts
+@Component
+export declare struct UIComponent {
+ build():void;
+}
+
+export declare function hello(): string;
+
+export declare function foo1(): string;
+
+export declare function foo2(): string;
+
+export declare function nativeHello(): string;
+```
+In the example, **UIComponent** is an ArkUI component, **hello()**, **foo1()**, and **foo2()** are TS methods, and **nativeHello()** is an native method. Specific implementation is as follows:
+#### ArkUI Components
+The following is an implementation example of ArkUI components in the HSP:
+```ts
+// lib/src/main/ets/ui/MyUIComponent.ets
+@Component
+export struct UIComponent {
+ @State message: string = 'Hello World'
+ build() {
+ Column() {
+ Text(this.message)
+ .fontSize(32)
+ .padding(8)
+ .fontColor(0xffffff)
+ .backgroundColor(0x0000ff)
+ }.padding(8).width('100%')
+ }
+}
+```
+
+#### **TS Methods**
+The following is an implementation example of TS methods in the HSP:
+```ts
+export function hello(name: string): string {
+ return "hello + " + name;
+}
+
+export function foo1() {
+ return "foo1";
+}
+
+export function foo2() {
+ return "foo2";
+}
+```
+#### **Native Methods**
+The following is an implementation example of native methods in the HSP:
+```C++
+#include "napi/native_api.h"
+#include
+#include
+#include
+
+const std::string libname = "liba";
+const std::string version = "v10001";
+
+static napi_value Hello(napi_env env, napi_callback_info info) {
+ napi_value ret;
+ std::string msg = libname + ":native hello, " + version;
+ napi_create_string_utf8(env, msg.c_str(), msg.length(), &ret);
+ return ret;
+}
+
+EXTERN_C_START
+static napi_value Init(napi_env env, napi_value exports) {
+ napi_property_descriptor desc[] = {
+ {"nativeHello", nullptr, Hello, nullptr, nullptr, nullptr, napi_default, nullptr}};
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "liba",
+ .nm_priv = ((void *)0),
+ .reserved = {0},
+};
+
+extern "C" __attribute__((constructor)) void RegisterLibaModule(void) {
+ napi_module_register(&demoModule);
+}
+```
+### Using the Capabilities Exported from the HAR
+To start with, [configure dependency](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391) on the HAR. The dependency information will then be generated in the **module.json** file of the corresponding module, as shown in the following:
+```json
+"dependencies": [
+ {
+ "bundleName": "com.share.liba",
+ "moduleName": "liba",
+ "versionCode": 10001
+ }
+]
+```
+In the preceding information, **bundleName**, **moduleName**, and **versionCode** indicate the bundle name, module name, and version number of the inter-application HSP, respectively.
+#### Referencing ArkUI Components in the HAR
+After configuring the dependency on the HAR, you can reference ArkUI components exported from the HAR by using **import**. The sample code is as follows:
+``` ts
+import { UIComponent } from 'liba'
+
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World'
+ build() {
+ Row() {
+ // Reference the ArkUI component in the HAR.
+ UIComponent()
+ Column() {
+ Text(this.message)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
+
+#### Referencing TS Classes and Methods in the HAR
+To reference the TS classes and methods exported from the HAR, use **import** as follows:
+``` ts
+import { foo1 } from 'liba'
+import { foo2 } from 'liba'
+
+@Component
+struct Index {
+ build() {
+ Row() {
+ Column() {
+ Button('Button')
+ .onClick(()=>{
+ // Reference the TS methods in the HAR.
+ foo1();
+ foo2();
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
+#### Referencing Native Methods in the HAR
+To reference the native methods exported from the HAR, use **import** as follows:
+``` ts
+import { nativeHello } from 'liba'
+
+@Component
+struct Index {
+ build() {
+ Row() {
+ Column() {
+ Button('Button')
+ .onClick(()=>{
+ // Reference the native method in the HAR.
+ nativeHello();
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
+
+## Inter-Application HSP Distribution
+Inter-application HSPs are not completely integrated into an application. They are distributed by being preset in the system version or installed with an application on the device. To be specific:
+1. Some frequently-used inter-application HSPs are preset in the system version.
+2. When a user downloads an application from the application market, if the application market detects that the application depends on one or more inter-application HSPs and any of these HSPs are not installed on the target device, it will download the application as well as the missing HSPs for the user. In this way, the application can use the features shared through the HSPs properly.
+
+### Inter-Application HSP Debugging Mode
+You can debug an inter-application HSP after it is distributed to a device. If the aforementioned distribution methods are not applicable, you can distribute the HSP by running **bm** commands. The procedure is as follows:
+
+> **NOTE**
+>
+> Do not reverse steps 2 and 3. Otherwise, your application will fail to be installed due to a lack of the required inter-application HSP. For more information about the **bm** commands, see [Bundle Management](../../readme/bundle-management.md).
+
+1. Obtain the inter-application HSP installation package.
+2. Run the following **bm** command to install the inter-application HSP.
+```
+bm install -s sharebundle.hsp
+```
+3. Run the following **bm** command to install the HAP file of your application.
+```
+bm install -p feature.hap
+```
+4. Start your application and start debugging.
diff --git a/en/application-dev/quick-start/figures/in-app-hsp-har.png b/en/application-dev/quick-start/figures/in-app-hsp-har.png
new file mode 100644
index 0000000000000000000000000000000000000000..b4473deed92ed251cff11bee403c32cdd39556d8
Binary files /dev/null and b/en/application-dev/quick-start/figures/in-app-hsp-har.png differ
diff --git a/en/application-dev/quick-start/figures/quick-fix-debug.png b/en/application-dev/quick-start/figures/quick-fix-debug.png
new file mode 100644
index 0000000000000000000000000000000000000000..4e7084f30e2d2b26be811c8b8a6c9ec34a005c9e
Binary files /dev/null and b/en/application-dev/quick-start/figures/quick-fix-debug.png differ
diff --git a/en/application-dev/quick-start/figures/quick-fix-devel_release.png b/en/application-dev/quick-start/figures/quick-fix-devel_release.png
new file mode 100644
index 0000000000000000000000000000000000000000..34b701fafe5d319da6b552c5d86305151e8e28b3
Binary files /dev/null and b/en/application-dev/quick-start/figures/quick-fix-devel_release.png differ
diff --git a/en/application-dev/quick-start/figures/quick_fix_bundle_struct.png b/en/application-dev/quick-start/figures/quick_fix_bundle_struct.png
new file mode 100644
index 0000000000000000000000000000000000000000..730414e3ba2fccbb58a27f83ce1afc572544f366
Binary files /dev/null and b/en/application-dev/quick-start/figures/quick_fix_bundle_struct.png differ
diff --git a/en/application-dev/quick-start/figures/quick_fix_gen_abc.png b/en/application-dev/quick-start/figures/quick_fix_gen_abc.png
new file mode 100644
index 0000000000000000000000000000000000000000..3e549ec79cad4a76a55ccab4dbb769b756d9936a
Binary files /dev/null and b/en/application-dev/quick-start/figures/quick_fix_gen_abc.png differ
diff --git a/en/application-dev/quick-start/figures/quick_fix_gen_so.png b/en/application-dev/quick-start/figures/quick_fix_gen_so.png
new file mode 100644
index 0000000000000000000000000000000000000000..31717ca38c7e64983b9b3c95672fe966decf6945
Binary files /dev/null and b/en/application-dev/quick-start/figures/quick_fix_gen_so.png differ
diff --git a/en/application-dev/quick-start/full-sdk-switch-guide.md b/en/application-dev/quick-start/full-sdk-switch-guide.md
index 87289c7776cb3dc33b73abc25cb3ef2da06e6eca..c5b0788516215c4ccd7a53fd0482afa4221b9644 100644
--- a/en/application-dev/quick-start/full-sdk-switch-guide.md
+++ b/en/application-dev/quick-start/full-sdk-switch-guide.md
@@ -16,7 +16,7 @@ Manually download the system-specific full SDK package from the mirror. For deta
## Checking the Local SDK Location
-In this example, an eTS project is used. For a JS project, replace **ets** with **js**.
+In this example, an ArkTS project is used. For a JS project, replace **ets** with **js**.
In DevEco Studio, choose **Tools** > **OpenHarmony SDK Manager** to check the location of the local SDK.
diff --git a/en/application-dev/quick-start/har-package.md b/en/application-dev/quick-start/har-package.md
new file mode 100644
index 0000000000000000000000000000000000000000..71cc22a71f970d6fe9e7d3638b36da0e16b9d8de
--- /dev/null
+++ b/en/application-dev/quick-start/har-package.md
@@ -0,0 +1,172 @@
+# HAR
+A Harmony Archive (HAR) is a static shared package that can contain code, C++ libraries, resources, and configuration files. It enables modules and projects to share code related to ArkUI components, resources, and more. Unlike a Harmony Ability Package (HAP), a HAR cannot be independently installed on a device. Instead, it can be referenced only as the dependency of an application module.
+
+## Creating a HAR Module
+You can kickstart your HAR module development with the module template of the **Library** type in DevEco Studio. By default, obfuscation is disabled for the HAR module. To enable this feature, set **artifactType** in the **build-profile.json5** file of the HAR module to **obfuscation** as follows:
+
+```json
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "artifactType": "obfuscation"
+ }
+}
+```
+The value options of **artifactType** are as follows, and the default value is **original**:
+- **original**: Code is not obfuscated.
+- **obfuscation**: Code is obfuscated using Uglify.
+
+When obfuscation is enabled, DevEco Studio compiles, obfuscates, and compresses code during HAR building, thereby protecting your code assets.
+
+> **NOTE**
+>
+> If **artifactType** is set to **obfuscation**, **apiType** must be set to **stageMode**, because obfuscation is available only in the stage model.
+
+## Precautions for HAR Development
+- The HAR does not support the declaration of **abilities** and **extensionAbilities** in its configuration file.
+- The HAR does not support the declaration of pages in its configuration file.
+- The HAR does not support **worker** configuration under **buildOption** in the **build-profile.json5** file.
+- The HAR of the FA model and that of the stage model cannot be referenced by each other.
+- The HAR of the stage model cannot reference content in the **AppScope** folder. This is because the content in the **AppScope** folder is not packaged into the HAR during compilation and building.
+
+## Exporting ArkUI Components, APIs, and Resources of the HAR
+The **index.ets** file acts as the entry of the HAR export declaration file and is where the HAR exports APIs. This file is automatically generated by DevEco Studio by default. You can specify another file as the entry declaration file in the **main** field in the **package.json** file of the module. The code snippet is as follows:
+```json
+{
+ "main": "index.ets"
+}
+```
+### Exporting ArkUI Components
+Use **export** to export the ArkUI components. The code snippet is as follows:
+```js
+// library/src/main/ets/components/MainPage/MainPage.ets
+@Component
+export struct MainPage {
+ @State message: string = 'Hello World'
+ build() {
+ Row() {
+ Column() {
+ Text(this.message)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
+In the **index.ets** file, declare the APIs that the HAR exposes to external systems. The code snippet is as follows:
+```js
+// library/index.ets
+export { MainPage } from './src/main/ets/components/MainPage/MainPage'
+```
+### Exporting TS Classes and Methods
+Use **export** to export TS classes and methods. Multiple TS classes and methods can be exported at the same time. The code snippet is as follows:
+```js
+// library/src/main/ts/test.ets
+export class Log {
+ static info(msg) {
+ console.info(msg);
+ }
+}
+
+export function func() {
+ return "har func";
+}
+
+export function func2() {
+ return "har func2";
+}
+```
+In the **index.ets** file, declare the APIs that the HAR exposes to external systems. The code snippet is as follows:
+```js
+// library/index.ets
+export { Log } from './src/main/ts/test'
+export { func } from './src/main/ts/test'
+export { func2 } from './src/main/ts/test'
+```
+### Resources
+Resources are packed into the HAR when it is being compiled and packaged. During compilation and building of a HAP, DevEco Studio collects resource files from the HAP module and its dependent modules. If the resource files of different modules have the same name, DevEco Studio overwrites the resource files based on the following priorities (in descending order):
+- AppScope (supported only by the stage model of API version 9)
+- Modules in the HAP file
+- If resource conflicts occur between dependent HAR modules, they are overwritten based on the dependency sequence. (The module that is higher in the dependency sequence list has higher priority.)
+
+## Referencing ArkUI Components, APIs, and Resources in the HAR
+To start with, [configure dependency](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434#section89674298391) on the HAR.
+
+### Reference ArkUI Components in the HAR
+
+After configuring the dependency on the HAR, you can reference ArkUI components exported from the HAR by using **import**. The sample code is as follows:
+```js
+// entry/src/main/ets/pages/index.ets
+import { MainPage } from "@ohos/library"
+
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World'
+ build() {
+ Row() {
+ // Reference the ArkUI component in the HAR.
+ MainPage()
+ Column() {
+ Text(this.message)
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
+### Referencing TS Classes and Methods in the HAR
+To reference the TS classes and methods exported from the HAR, use **import** as follows:
+```js
+// entry/src/main/ets/pages/index.ets
+import { Log } from "@ohos/library"
+import { func } from "@ohos/library"
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Row() {
+ Column() {
+ Button('Button')
+ .onClick(()=>{
+ // Reference TS classes and methods in the HAR.
+ Log.info("har msg");
+ func();
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
+### Referencing Resources in the HAR
+Use **$r** to reference resources in the HAR. For example, add the **name: hello_har** string (defined in the **string.json** file) and **icon_har.png** image to the **src/main/resources** directory of the HAR module, and then reference the string and image in the entry module. The code snippet is as follows:
+```js
+// entry/src/main/ets/pages/index.ets
+@Entry
+@Component
+struct Index {
+ build() {
+ Row() {
+ Column() {
+ // Reference the string in the HAR.
+ Text($r("app.string.hello_har"))
+ .fontSize(50)
+ .fontWeight(FontWeight.Bold)
+ // Reference the image in the HAR.
+ Image($r("app.media.icon_har"))
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
diff --git a/en/application-dev/quick-start/har-structure.md b/en/application-dev/quick-start/har-structure.md
deleted file mode 100644
index 1d479b504a48752fdcb4ff033e81103efa134da2..0000000000000000000000000000000000000000
--- a/en/application-dev/quick-start/har-structure.md
+++ /dev/null
@@ -1,10 +0,0 @@
-# HAR File Structure
-
-
-The OpenHarmony Archive (HAR) file enables code to be shared among multiple modules or projects. Unlike a Harmony Ability Package (HAP) file, a HAR file cannot be independently installed on a device. Instead, it can only be referenced as the dependency of an application module.
-
-
-A HAR file is the build product of a [module](https://developer.harmonyos.com/en/docs/documentation/doc-guides-V3/ohos-adding-deleting-module-0000001218760594-V3) of the Library type in a DevEco Studio project.
-
-
-As a static shared package in OpenHarmony, the [HAR file](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-development-npm-package-0000001222578434) can contain the source code, C++ libraries, resource files, and the **module.json** file (in stage model) or **config.json** file (in FA model).
diff --git a/en/application-dev/quick-start/in-app-hsp.md b/en/application-dev/quick-start/in-app-hsp.md
new file mode 100644
index 0000000000000000000000000000000000000000..05380e9c6f3f3e631c56955128318d394a97f774
--- /dev/null
+++ b/en/application-dev/quick-start/in-app-hsp.md
@@ -0,0 +1,153 @@
+# In-Application HSP Development
+
+An in-application Harmony Shared Package (HSP) is a file used for code and resource sharing within an application (called the host application) and can only be invoked by a HAP or HSP of the same application.
+The in-application HSP is released with the Application Package (App Pack) of the host application and has the same bundle name and lifecycle as the host application.
+
+## Developing an In-Application HSP
+
+You can kickstart your HSP development with the HSP template in DevEco Studio. In this example, an HSP module named **library** is created. The basic project directory structure is as follows:
+```
+library
+├── src
+│ └── main
+│ ├── ets
+│ │ ├── pages
+│ │ └── index.ets
+│ ├── resources
+│ └── module.json5
+└── package.json
+```
+In the **module.json5** file, set **type** to **shared** for the HSP.
+```json
+{
+ "type": "shared"
+}
+```
+
+The HSP provides capabilities for external systems by exporting APIs in the entry file. Specify the entry file in **main** in the **package.json** file. For example:
+```json
+{
+ "main": "./src/main/ets/index.ets"
+}
+```
+
+### Exporting TS Classes and Methods
+Use **export** to export TS classes and methods. The sample code is as follows:
+```ts
+// library/src/main/ets/utils/test.ts
+export class Log {
+ static info(msg) {
+ console.info(msg);
+ }
+}
+
+export function add(a: number, b: number) {
+ return a + b;
+}
+
+export function minus(a: number, b: number) {
+ return a - b;
+}
+```
+In the entry file **index.ets**, declare the APIs to be exposed.
+```ts
+// library/src/main/ets/index.ets
+export { Log, add, minus } from './utils/test'
+```
+
+### Exporting ArkUI Components
+Use **export** to export ArkUI components. The sample code is as follows:
+```ts
+// library/src/main/ets/components/MyTitleBar.ets
+@Component
+export struct MyTitleBar {
+ build() {
+ Row() {
+ Text($r('app.string.library_title'))
+ .fontColor($r('app.color.white'))
+ .fontSize(25)
+ .margin({left:15})
+ }
+ .width('100%')
+ .height(50)
+ .padding({left:15})
+ .backgroundColor('#0D9FFB')
+ }
+}
+```
+In the entry file **index.ets**, declare the APIs to be exposed.
+```ts
+// library/src/main/ets/index.ets
+export { MyTitleBar } from './components/MyTitleBar'
+```
+#### About Using Resources in the HSP
+To reference resources in the **resources** directory of the current HSP module, use **$r** or **$rawfile**.
+If a relative path is used, the resources in the HSP caller are referenced instead. For example,
+if **Image("common/example.png")** is used in the HSP module, the **\** component will reference the resource **entry/src/main/ets/common/example.png** in the HSP caller (which is **entry** in this example).
+
+### Exporting Native Methods
+The HSP can contain .so files compiled in C++. The HSP indirectly exports the native method in the .so file. In this example, the **multi** method in the **libnative.so** file is exported.
+```ts
+// ibrary/src/main/ets/utils/nativeTest.ts
+import native from "libnative.so"
+
+export function nativeMulti(a: number, b: number) {
+ return native.multi(a, b);
+}
+```
+
+In the entry file **index.ets**, declare the APIs to be exposed.
+```ts
+// library/src/main/ets/index.ets
+export { nativeMulti } from './utils/nativeTest'
+```
+
+## Using the In-Application HSP
+To use APIs in the HSP, first configure the dependency on the HSP in the **package.json** file of the module that needs to call the APIs (called the invoking module). If the HSP and the invoking module are in the same project, the APIs can be referenced locally. The sample code is as follows:
+```json
+// entry/src/main/module.json5
+"dependencies": {
+ "library": "file:../library"
+}
+```
+You can now call the external APIs of the HSP in the same way as calling the APIs in the HAR.
+In this example, the external APIs are the following ones exported from **library**:
+```ts
+// library/src/main/ets/index.ets
+export { Log, add, minus } from './utils/test'
+export { MyTitleBar } from './components/MyTitleBar'
+export { nativeMulti } from './utils/nativeTest'
+```
+The APIs can be used as follows in the code of the invoking module:
+```ts
+// entry/src/main/ets/pages/index.ets
+import { Log, add, MyTitleBar, nativeMulti } from "library"
+
+@Entry
+@Component
+struct Index {
+ @State message: string = 'Hello World'
+ build() {
+ Row() {
+ Column() {
+ MyTitleBar()
+ Text(this.message)
+ .fontSize(30)
+ .fontWeight(FontWeight.Bold)
+ Button('add(1, 2)')
+ .onClick(()=>{
+ Log.info("add button click!");
+ this.message = "result: " + add(1, 2);
+ })
+ Button('nativeMulti(3, 4)')
+ .onClick(()=>{
+ Log.info("nativeMulti button click!");
+ this.message = "result: " + nativeMulti(3, 4);
+ })
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+```
diff --git a/en/application-dev/quick-start/module-configuration-file.md b/en/application-dev/quick-start/module-configuration-file.md
index 67361fccfd749495e2f5825d5ccac6efe1505ed9..8fca81167d6d016376877602de947c4c9cc83bd1 100644
--- a/en/application-dev/quick-start/module-configuration-file.md
+++ b/en/application-dev/quick-start/module-configuration-file.md
@@ -72,7 +72,7 @@ As shown above, the **module.json5** file contains several tags.
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| name | Name of the module. The value is a string with a maximum of 31 bytes and must be unique in the entire application. Chinese characters are not allowed.| String| No|
-| type | Type of the module. The value can be **entry** or **feature**. - **entry**: main module of the application. - **feature**: dynamic feature module of the application.| String| No|
+| type | Type of the module. The options are as follows: - **entry**: main module of the application. - **feature**: dynamic feature module of the application. - **har**: static shared module. - **shared**: dynamic shared module.| String| No|
| srcEntry | Code path corresponding to the module. The value is a string with a maximum of 127 bytes.| String| Yes (initial value: left empty)|
| description | Description of the module. The value is a string with a maximum of 255 bytes or a string resource index.| String| Yes (initial value: left empty)|
| process | Process name of the current module. The value is a string with a maximum of 31 bytes. If **process** is configured under **HAP**, all UIAbility, DataShareExtensionAbility, and ServiceExtensionAbility components of the application run in the specified process. **NOTE** This tag applies only to system applications and does not take effect for third-party applications.| String| Yes (initial value: value of **bundleName** under **app** in the **app.json5** file)|
@@ -150,7 +150,7 @@ Define the **main_pages.json** file under **resources/base/profile** in the deve
The **metadata** tag represents the custom metadata of the HAP file. The tag value is an array and contains three subtags: **name**, **value**, and **resource**.
- **Table 3** metadata
+**Table 3** metadata
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
@@ -210,9 +210,10 @@ Touching this icon will direct the user to the application details screen in **S
To hide an application icon from the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).
+
**Setting the application icon to be displayed on the home screen**:
-Set **icon**, **label**, and **skills** under **abilities** in the **module.json5** file. In addition, the **skills** configuration must contain **ohos.want.action.home **and **entity.system.home**.
+Set **icon**, **label**, and **skills** under **abilities** in the **module.json5** file. In addition, make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**.
```
{
@@ -284,7 +285,7 @@ Set **icon**, **label**, and **skills** under **abilities** in the **module.json
| removeMissionAfterTerminate | Whether to remove the relevant task from the task list after the UIAbility component is destroyed. - **true**: Remove the relevant task from the task list after the UIAbility component is destroyed. - **false**: Do not remove the relevant task from the task list after the UIAbility component is destroyed.| Boolean| Yes (initial value: **false**)|
| orientation | Orientation of the UIAbility component when it is started. The options are as follows: - **unspecified**: automatically determined by the system. - **landscape**: landscape mode. - **portrait**: portrait mode. - **landscape_inverted**: inverted landscape mode. - **portrait_inverted**: inverted portrait mode. - **auto_rotation**: determined by the sensor. - **auto_rotation_landscape**: determined by the sensor in the horizontal direction, including landscape and inverted landscape modes. - **auto_rotation_portrait**: determined by the sensor in the vertical direction, including portrait and inverted portrait modes. - **auto_rotation_restricted**: determined by the sensor when the sensor switch is enabled. - **auto_rotation_landscape_restricted**: determined by the sensor in the horizontal direction, including landscape and inverted landscape modes, when the sensor switch is enabled. - **auto_rotation_portrait_restricted**: determined by the sensor in the vertical direction, including portrait and inverted portrait modes, when the sensor switch is enabled. - **locked**: auto rotation disabled.| String| Yes (initial value: **"unspecified"**)|
| supportWindowMode | Window mode supported by the UIAbility component. The options are as follows: - **fullscreen**: full-screen mode. - **split**: split-screen mode. - **floating**: floating window mode.| String array| Yes (initial value: ["fullscreen", "split", "floating"])|
-| priority | Priority of the UIAbility component. This attribute applies only to system applications and does not take effect for third-party applications. In the case of [implicit query](../application-models/explicit-implicit-want-mappings.md), UIAbility components with a higher priority are at the higher place of the returned list. The value is an integer ranging from 0 to 10. The greater the value, the higher the priority.| Number| Yes (initial value: **0**)|
+| priority | Priority of the UIAbility component. In the case of [implicit query](../application-models/explicit-implicit-want-mappings.md), UIAbility components with a higher priority are at the higher place of the returned list. The value is an integer ranging from 0 to 10. The greater the value, the higher the priority. **NOTE** This tag applies only to system applications and does not take effect for third-party applications.| Number| Yes (initial value: **0**)|
| maxWindowRatio | Maximum aspect ratio supported by the UIAbility component. The minimum value is 0.| Number| Yes (initial value: maximum aspect ratio supported by the platform)|
| minWindowRatio | Minimum aspect ratio supported by the UIAbility component. The minimum value is 0.| Number| Yes (initial value: minimum aspect ratio supported by the platform)|
| maxWindowWidth | Maximum window width supported by the UIAbility component, in vp. The minimum value is 0, and the value cannot be less than the value of **minWindowWidth** or greater than the maximum window width allowed by the platform. For details about the window size, see [Constraints](../windowmanager/window-overview.md#constraints).| Number| Yes (initial value: maximum window width supported by the platform)|
@@ -396,22 +397,22 @@ Example of the **skills** structure:
}
```
-**Enhance implicit query**
+**Enhanced implicit query**
URI-level prefix matching is supported.
-When only **scheme** or a combination of **scheme** and **host** or **scheme**, **host**, and **port** are configured in the configuration file, the configuration is successful if the URI prefixed with the configuration file is passed in.
+When only **scheme** or a combination of **scheme** and **host** or **scheme**, **host**, and **port** are configured in the configuration file, the configuration is successful if a URI prefixed with the configuration file is passed in.
* The query enhancement involves the following APIs:
[@ohos.bundle.bundleManager](../reference/apis/js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)
- 1. function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback>): void;
- 2. function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback>): void;
- 3. function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise>;
+ 1. function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback>): void;
+ 2. function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback>): void;
+ 3. function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise>;
* Configuration requirements
abilities -> skills -> uris object
Configuration 1: only **scheme = 'http'**
- Configuration 2: only **(scheme = 'http' ) + ( host = 'example.com')**
- Configuration 3: only **(scheme = 'http' ) + ( host = 'example.com' ) + ( port = '8080')**
+ Configuration 2: only **(scheme = 'http') + (host = 'example.com')**
+ Configuration 3: only **(scheme = 'http') + (host = 'example.com') + (port = '8080')**
* Prefix match
If the value of **uri** under [want](../application-models/want-overview.md) is obtained by calling the **queryAbilityInfo** API:
1. uri = 'https://': No matches
@@ -429,8 +430,6 @@ When only **scheme** or a combination of **scheme** and **host** or **scheme**,
13. uri = 'http://example.com:9180/path': Matches configuration 1 and configuration 2
14. uri = 'http://example.com:8080/path': Matches configuration 1, configuration 2, and configuration 3
-
-
## extensionAbilities
The **extensionAbilities** tag represents the configuration of extensionAbilities, which is valid only for the current extensionAbility.
@@ -446,8 +445,8 @@ The **extensionAbilities** tag represents the configuration of extensionAbilitie
| label | Name of the ExtensionAbility component displayed to users. The value is a string resource index. **NOTE** If **ExtensionAbility** is set to **MainElement** of the current module, this attribute is mandatory and its value must be unique in the application.| String| No|
| type | Type of the ExtensionAbility component. The options are as follows: - **form**: ExtensionAbility of a widget. - **workScheduler**: ExtensionAbility of a Work Scheduler task. - **inputMethod**: ExtensionAbility of an input method. - **service**: service component running in the background. - **accessibility**: ExtensionAbility of an accessibility feature. - **dataShare**: ExtensionAbility for data sharing. - **fileShare**: ExtensionAbility for file sharing. - **staticSubscriber**: ExtensionAbility for static broadcast. - **wallpaper**: ExtensionAbility of the wallpaper. - **backup**: ExtensionAbility for data backup. - **window**: ExtensionAbility of a window. This type of ExtensionAbility creates a window during startup for which you can develop the GUI. The window is then combined with other application windows through **abilityComponent**. - **thumbnail**: ExtensionAbility for obtaining file thumbnails. You can provide thumbnails for files of customized file types. - **preview**: ExtensionAbility for preview. This type of ExtensionAbility can parse the file and display it in a window. You can combine the window with other application windows. - **print**: ExtensionAbility for the print framework. **NOTE** The **service** and **dataShare** types apply only to system applications and do not take effect for third-party applications.| String| No|
| permissions | Permissions required for another application to access the ExtensionAbility component. The value is generally in the reverse domain name notation and contains a maximum of 255 bytes. It is an array of permission names predefined by the system or customized. The name of a customized permission must be the same as the **name** value of a permission defined in the **defPermissions** attribute.| String array| Yes (initial value: left empty)|
-| uri | Data URI provided by the ExtensionAbility component. The value is a string with a maximum of 255 bytes, in the reverse domain name notation. **NOTE** This attribute is mandatory when **type** of the ExtensionAbility component is set to **dataShare**.| String| Yes (initial value: left empty)|
-|skills | Feature set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility component. Configuration rule: In an entry package, you can configure multiple **skills** attributes with the entry capability. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.) The **label** and **icon** in the first ExtensionAbility that has **skills** configured are used as the **label** and **icon** of the entire OpenHarmony service/application. **NOTE** The **skills** attribute with the entry capability can be configured for the feature-type package of an OpenHarmony application, but not for an OpenHarmony service.| Array| Yes (initial value: left empty)|
+| uri | Data URI provided by the ExtensionAbility component. The value is a string with a maximum of 255 bytes, in the reverse domain name notation. **NOTE** This attribute is mandatory when the type of the **ExtensionAbility** component is set to **dataShare**. | String| Yes (initial value: left empty)|
+|skills | Feature set of [wants](../application-models/want-overview.md) that can be received by the ExtensionAbility component. Configuration rule: In an entry package, you can configure multiple **skills** attributes with the entry capability. (A **skills** attribute with the entry capability is the one that has **ohos.want.action.home** and **entity.system.home** configured.) The **label** and **icon** in the first ExtensionAbility that has **skills** configured are used as the **label** and **icon** of the entire OpenHarmony service/application. **NOTE** The **skills** attribute with the entry capability can be configured for the feature-type package of an OpenHarmony application, but not for an OpenHarmony service. | Array| Yes (initial value: left empty)|
| [metadata](#metadata)| Metadata of the ExtensionAbility component.| Object| Yes (initial value: left empty)|
| exported | Whether the ExtensionAbility component can be called by other applications. - **true**: The ExtensionAbility component can be called by other applications. - **false**: The UIAbility component cannot be called by other applications.| Boolean| Yes (initial value: **false**)|
@@ -488,11 +487,12 @@ Example of the **extensionAbilities** structure:
## requestPermissions
-The **requestPermissions** tage represents a set of permissions that the application needs to request from the system for running correctly.
+The **requestPermissions** tag represents a set of permissions that the application needs to request from the system for running correctly.
> **NOTE**
>
-> The permission settings configured in the **requestPermissions** tag apply to the entire application.
+> - The permission settings configured in the **requestPermissions** tag apply to the entire application.
+> - If your application needs to subscribe to an event published by itself and the permissions required for accessing the application are set in the **permissions** tag under **extensionAbilities**, then the application must register the related permissions in the **requestPermissions** tag to receive the event.
**Table 8** requestPermissions
@@ -540,7 +540,7 @@ The **shortcut** information is identified in **metadata**, where:
| shortcutId | ID of the shortcut. The value is a string with a maximum of 63 bytes.| String| No|
| label | Label of the shortcut, that is, the text description displayed for the shortcut. The value can be a string or a resource index to the label, with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| icon | Icon of the shortcut. The value is an icon resource index.| String| Yes (initial value: left empty)|
-| [wants](../application-models/want-overview.md) | Wants to which the shortcut points. Each want consists of the **bundleName** and **abilityName** sub-attributes. **bundleName**: target bundle name of the shortcut. The value is a string. **abilityName**: target component name of the shortcut. The value is a string.| Object| Yes (initial value: left empty)|
+| [wants](../application-models/want-overview.md) | Wants to which the shortcut points. Each want consists of the **bundleName** and **abilityName** sub-attributes. - **bundleName**: target bundle name of the shortcut. The value is a string. - **abilityName**: target component name of the shortcut. The value is a string.| Object| Yes (initial value: left empty)|
1. Configure the **shortcuts_config.json** file in **/resource/base/profile/**.
@@ -699,7 +699,7 @@ Configure **metadata** in the **module** tag in the **module.json5** file.
The **testRunner** tag represents the supported test runner.
- **Table 14** testRunner
+**Table 14** testRunner
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
diff --git a/en/application-dev/quick-start/module-structure.md b/en/application-dev/quick-start/module-structure.md
index e4aee36db107109fcaa7e6d068cbc907009c69d4..352a993d5042116105ef5c50ae9138df51c622c9 100644
--- a/en/application-dev/quick-start/module-structure.md
+++ b/en/application-dev/quick-start/module-structure.md
@@ -21,7 +21,7 @@ The **module** tag contains the HAP configuration.
| reqPermissions | Permissions that the application requests from the system when it is running.| Object array| Yes (initial value: left empty)|
| colorMode | Color mode of the application. The options are as follows: - **dark**: Resources applicable for the dark mode are used. - **light**: Resources applicable for the light mode are used. - **auto**: Resources are used based on the color mode of the system.| String| Yes (initial value: **auto**)|
| distroFilter | Distribution rules of the application. This attribute defines the rules for distributing HAP files based on different device specifications, so that precise matching can be performed when the application market distributes applications. Distribution rules cover three factors: API version, screen shape, and screen resolution. During distribution, a unique HAP is determined based on the mapping between **deviceType** and these three factors.| Object| Yes (initial value: left empty) Set this attribute when an application has multiple entry modules.|
-|commonEvents | Information about the common event static subscriber, which must contain the subscriber name, required permissions, and list of the subscribed common events. When a subscribed event is sent, the static subscriber is started. Unlike the common dynamic subscriber, the static subscriber does not need to actively call the common event subscription API in the service code, and may not be started when the common event is released. In constrast, the dynamic subscriber actively calls the common event subscription API and therefore requires the application to stay active.| Object array| Yes (initial value: left empty)|
+|commonEvents | Information about the common event static subscriber, which must contain the subscriber name, required permissions, and list of the common events subscribed to. When a subscribed event is sent, the static subscriber is started. Unlike the dynamic subscriber, the static subscriber does not need to proactively call the common event subscription API in the service code, and may not be running when the common event is published.| Object array| Yes (initial value: left empty)|
| entryTheme | Keyword of an OpenHarmony internal theme. Set it to the resource index of the name.| String| Yes (initial value: left empty)|
|testRunner | Test runner configuration.| Object| Yes (initial value: left empty)|
@@ -190,12 +190,73 @@ Example of the metadata attribute:
## Internal Structure of the abilities Attribute
+**By default, application icons cannot be hidden from the home screen in OpenHarmony.**
+
+The OpenHarmony system imposes a strict rule on the presence of application icons. If no icon is configured in the HAP file of an application, the system creates a default icon for the application and displays it on the home screen.
+Touching this icon will direct the user to the application details screen in **Settings**.
+To hide an application icon from the home screen, you must configure the **AllowAppDesktopIconHide** privilege. For details, see [Application Privilege Configuration Guide](../../device-dev/subsystems/subsys-app-privilege-config-guide.md).
+
+
+**Setting the application icon to be displayed on the home screen**: Set **icon**, **label**, and **skills** under **abilities** in the **config.json** file. In addition, make sure the **skills** configuration contains **ohos.want.action.home** and **entity.system.home**.
+```
+{
+ "module":{
+
+ ...
+
+ "abilities": [{
+ "icon": "$media:icon",
+ "label": "Login",
+ "skills": [{
+ "actions": ["ohos.want.action.home"],
+ "entities": ["entity.system.home"],
+ "uris": []
+ }]
+ }],
+
+ ...
+
+ }
+}
+```
+
+**Querying an application icon:**
+* The HAP file contains Page ability configuration.
+ * The application icon is set under **abilities** in the **config.json** file.
+ * The application does not have the privilege to hide its icon from the home screen.
+ * The returned home screen icon is the icon configured for the ability.
+ * The returned home screen label is the label configured for the ability. If no label is configured, the bundle name is returned.
+ * The returned component name is the component name of the ability.
+ * When the user touches the home screen icon, the home screen of the ability is displayed.
+ * The application has the privilege to hide its icon from the home screen.
+ * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.
+ * The application icon is not set under **abilities** in the **config.json** file.
+ * The application does not have the privilege to hide its icon from the home screen.
+ * The returned home screen icon is the default icon.
+ *The returned home screen label is the bundle name of the application.
+ * The returned component name is the component name displayed on the application details screen (this component is built in the system).
+ * Touching the home screen icon will direct the user to the application details screen.
+ * The application has the privilege to hide its icon from the home screen.
+ * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.
+* The HAP file does not contain Page ability configuration.
+ * The application does not have the privilege to hide its icon from the home screen.
+ * The returned home screen icon is the default icon.
+ *The returned home screen label is the bundle name of the application.
+ * The returned component name is the component name displayed on the application details screen (this component is built in the system).
+ * Touching the home screen icon will direct the user to the application details screen.
+ * The application has the privilege to hide its icon from the home screen.
+ * The information about the application is not returned during home screen information query, and the icon of the application is not displayed on the home screen.
+
+> **NOTE**
+>
+> The icon and label displayed on the application details page may be different from those displayed on the home screen. For non-Page abilities, they are the entry icon and label set under **abilities**, if any.
+
**Table 8** Internal structure of the abilities attribute
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
| process | Name of the process running the application or ability. If the **process** attribute is configured in the **deviceConfig** tag, all abilities of the application run in this process. You can set the **process** attribute for a specific ability in the **abilities** attribute, so that the ability can run in the particular process. If this attribute is set to the name of the process running other applications, all these applications can run in the same process, provided they have the same unified user ID and the same signature. The value can contain a maximum of 31 bytes.| String| Yes (initial value: left empty)|
-| name | Ability name. The value can be a reverse domain name, in the format of "*bundleName*.*className*", for example, **"com.example.myapplication.EntryAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".EntryAbility"**. The ability name must be unique in an application. Note: If you use DevEco Studio to create the project, an ability named **EntryAbility** will be created by default, and its configuration will be saved to the **config.json** file. The value of this attribute can be customized if you use other IDEs. The value can contain a maximum of 127 bytes.| String| No|
+| name | Ability name. The value can be a reverse domain name, in the format of "*bundleName*.*className*", for example, **"com.example.myapplication.EntryAbility"**. Alternatively, the value can start with a period (.) followed by the class name, for example, **".EntryAbility"**. The ability name must be unique in an application. Note: If you use DevEco Studio to create the project, an ability named **EntryAbility** will be created by default, and its configuration will be saved to the **config.json** file. If you use other IDEs, the value of this attribute can be customized. The value can contain a maximum of 127 bytes.| String| No|
| description | Description of the ability. The value can be a string or a resource index to descriptions in multiple languages. The value can contain a maximum of 255 bytes.| String| Yes (initial value: left empty)|
| icon | Index to the ability icon file. Example value: **$media:ability_icon**. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the icon of the ability is also used as the icon of the application. If multiple abilities address this condition, the icon of the first candidate ability is used as the application icon. Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels.| String| Yes (initial value: left empty)|
| label | Ability name displayed to users. The value can be a name string or a resource index to names in multiple languages. In the **skills** attribute of the ability, if the **actions** value contains **action.system.home** and the **entities** value contains **entity.system.home**, the label of the ability is also used as the label of the application. If multiple abilities address this condition, the label of the first candidate ability is used as the application label. Note: The **icon** and **label** values of an application are visible to users. Ensure that at least one of them is different from any existing icons or labels. The value can be a reference to a string defined in a resource file or a string enclosed in brackets ({}). The value can contain a maximum of 255 characters.| String| Yes (initial value: left empty)|
@@ -212,13 +273,13 @@ Example of the metadata attribute:
| grantPermission | Whether permissions can be granted for any data in the ability.| Boolean| Yes (initial value: left empty)|
| readPermission | Permission required for reading data in the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes. This attribute applies only to the default, tablet, smart TV, head unit, and wearable device types.| String| Yes (initial value: left empty)|
| writePermission | Permission required for writing data to the ability. This attribute applies only to the ability using the Data template. The value is a string with a maximum of 255 bytes.| String| Yes (initial value: left empty)|
-| configChanges | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. The options are as follows: **mcc**: indicates that the mobile country code (MCC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MCC is updated. **mnc**: indicates that the mobile network code (MNC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MNC is updated. **locale**: indicates that the locale is changed. Typical scenario: The user selectes a new language for the text display of the device. **layout**: indicates that the screen layout is changed. Typical scenario: Currently, different display forms are all in the active state. **fontSize**: indicates that font size is changed. Typical scenario: A new global font size is set. **orientation**: indicates that the screen orientation is changed. Typical scenario: The user rotates the device. **density**: indicates that the display density is changed. Typical scenario: The user may specify different display ratios, or different display forms are active at the same time. **size**: indicates that the size of the display window is changed. **smallestSize**: indicates that the length of the shorter side of the display window is changed. **colorMode**: indicates that the color mode is changed.| String array| Yes (initial value: left empty)|
+| configChanges | System configurations that the ability concerns. Upon any changes on the concerned configurations, the **onConfigurationUpdated** callback will be invoked to notify the ability. The options are as follows: **mcc**: indicates that the mobile country code (MCC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MCC is updated. **mnc**: indicates that the mobile network code (MNC) of the IMSI is changed. Typical scenario: A SIM card is detected, and the MNC is updated. **locale**: indicates that the locale is changed. Typical scenario: The user selects a new language for the text display of the device. **layout**: indicates that the screen layout is changed. Typical scenario: Currently, different display forms are all in the active state. **fontSize**: indicates that font size is changed. Typical scenario: A new global font size is set. **orientation**: indicates that the screen orientation is changed. Typical scenario: The user rotates the device. **density**: indicates that the display density is changed. Typical scenario: The user may specify different display ratios, or different display forms are active at the same time. **size**: indicates that the size of the display window is changed. **smallestSize**: indicates that the length of the shorter side of the display window is changed. **colorMode**: indicates that the color mode is changed.| String array| Yes (initial value: left empty)|
| mission | Task stack of the ability. This attribute applies only to the ability using the Page template. By default, all abilities in an application belong to the same task stack.| String| Yes (initial value: bundle name of the application)|
| targetAbility | Target ability that this ability alias points to. This attribute applies only to the ability using the Page template. If the **targetAbility** attribute is set, only **name**, **icon**, **label**, **visible**, **permissions**, and **skills** take effect in the current ability (ability alias). Other attributes use the values of the **targetAbility** attribute. The target ability must belong to the same application as the alias and must be declared in **config.json** ahead of the alias.| String| Yes (initial value: left empty, indicating that the current ability is not an alias)|
| formsEnabled | Whether the ability can provide widgets. This attribute applies only to the ability using the Page template. **true**: This ability can provide widgets. **false**: This ability cannot provide widgets.| Boolean| Yes (initial value: **false**)|
| forms | Information about the widgets used by the ability. This attribute is valid only when **formsEnabled** is set to **true**.| Object array| Yes (initial value: left empty)|
| srcLanguage | Programming language of the ability, which you can specify when creating the project.| String| Yes (initial value: **"js"**)|
-| srcPath | JS code path corresponding to the ability. The value can contain maximum of 127 bytes.| String| No|
+| srcPath | JS code path corresponding to the ability. The value can contain a maximum of 127 bytes.| String| No|
| uriPermission | Application data that the ability can access. This attribute consists of the **mode** and **path** sub-attributes. This attribute is valid only for the capability of the type provider.| Object| Yes (initial value: left empty)|
| startWindowIcon | Index to the icon file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$media:icon**.| String| Yes (initial value: left empty)|
| startWindowBackground | Index to the background color resource file of the ability startup page. This attribute applies only to the ability using the Page template. Example: **$color:red**.| String| Yes (initial value: left empty)|
@@ -351,9 +412,42 @@ Example of the **skills** attribute structure:
]
```
-## reqPermissions Attributes
-
-**Table 12** reqPermissions attributes
+**Enhanced implicit query**
+
+URI-level prefix matching is supported.
+
+When only **scheme** or a combination of **scheme** and **host** or **scheme**, **host**, and **port** are configured in the configuration file, the configuration is successful if a URI prefixed with the configuration file is passed in.
+
+ * The query enhancement involves the following APIs:
+ [@ohos.bundle.bundleManager](../reference/apis/js-apis-bundleManager.md#bundlemanagerqueryabilityinfo)
+ 1. function queryAbilityInfo(want: Want, abilityFlags: number, callback: AsyncCallback>): void;
+ 2. function queryAbilityInfo(want: Want, abilityFlags: number, userId: number, callback: AsyncCallback>): void;
+ 3. function queryAbilityInfo(want: Want, abilityFlags: number, userId?: number): Promise>;
+ * Configuration requirements
+ abilities -> skills -> uris object
+ Configuration 1: only **scheme = 'http'**
+ Configuration 2: only **(scheme = 'http') + (host = 'www.example.com')**
+ Configuration 3: only **(scheme = 'http') + (host = 'www.example.com') + (port = '8080')**
+ * Prefix match
+ If the value of **uri** under [want](../application-models/want-overview.md) is obtained by calling the **queryAbilityInfo** API:
+ 1. uri = 'https://': No matches
+ 2. uri = 'http://': Matches configuration 1
+ 3. uri = 'https://www.example.com': No matches
+ 4. uri = 'https://www.exa.com': No matches
+ 5. uri = 'http://www.exa.com': Matches configuration 1
+ 6. uri = 'http://www.example.com': Matches configuration 1 and configuration 2
+ 7. uri = 'https://www.example.com:8080': No matches
+ 8. uri = 'http://www.exampleaa.com:8080': Matches configuration 1
+ 9. uri = 'http://www.example.com:9180': Matches configuration 1 and configuration 2
+ 10. uri = 'http://www.example.com:8080': Matches configuration 1, configuration 2, and configuration 3
+ 11. uri = 'https://www.example.com:9180/query/student/name' : No matches
+ 12. uri = 'http://www.exampleap.com:8080/query/student/name': Matches configuration 1
+ 13. uri = 'http://www.example.com:9180/query/student/name': Matches configuration 1 and configuration 2
+ 14. uri = 'http://www.example.com:8080/query/student/name': Matches configuration 1, configuration 2, and configuration 3
+
+## Internal Structure of the reqPermissions Attribute
+
+**Table 12** Internal structure of the reqPermissions attribute
| Name| Description| Data Type| Initial Value Allowed|
| -------- | -------- | -------- | -------- |
@@ -687,7 +781,7 @@ Example of the **commonEvents** attribute structure:
| -------- | -------- | -------- | -------- |
| name | Name of a permission. The value can contain a maximum of 255 bytes.| String| No|
| grantMode | Permission grant mode. The options are as follows: - **system_grant**: The permission is automatically granted by the system after the application is installed. - **user_grant**: The permission is dynamically requested when needed and must be granted by the user.| String| Yes (initial value: **"system_grant"**)|
-| availableLevel | Permission type. The options are as follows: - **system_core**: system core permission. - **system_basic**: basic system permission. - **normal**: normal permission, which can be requsted by all applications.| String| Yes (initial value: **"normal"**)|
+| availableLevel | Permission type. The options are as follows: - **system_core**: system core permission. - **system_basic**: basic system permission. - **normal**: normal permission, which can be requested by all applications.| String| Yes (initial value: **"normal"**)|
| provisionEnable | Whether the permission can be requested in provision mode, including high-level permissions. The value **true** means that the permission can be requested in provision mode.| Boolean| Yes (initial value: **true**)|
| distributedSceneEnabled | Whether the permission can be used in distributed scenarios.| Boolean| Yes (initial value: **false**)|
| label | Brief description of the permission. The value is a resource index to the description.| String| Yes (initial value: left empty)|
diff --git a/en/application-dev/quick-start/quickfix-debug.md b/en/application-dev/quick-start/quickfix-debug.md
new file mode 100644
index 0000000000000000000000000000000000000000..b7cdf872c72198e796be1f1b65e635cb52ce04e6
--- /dev/null
+++ b/en/application-dev/quick-start/quickfix-debug.md
@@ -0,0 +1,92 @@
+# CLI-based Quick Fix Development
+
+You can use the command-line tool to develop a quick fix file, an expeditious approach to resolve application bugs. In this document, an application with the bundle name of **com.ohos.quickfix** in version 1000000 is used as an example to describe how to develop a quick fix file with the command-line tool.
+
+## Writing the patch.json File
+
+Write a **patch.json** file that meets your project requirements and place it in any directory of the project. (Configuring the **patch.json** file is not supported in DevEco Studio.) Create a **patch.json** file on the local computer. Below is an example of the file content:
+```json
+{
+ "app" : {
+ "bundleName" : "com.ohos.quickfix",
+ "versionCode": 1000000, // Application version
+ "versionName" : "1.0.0.1",
+ "patchVersionCode": 1000000, // Patch version
+ "patchVersionName" : "1.0.0.1"
+ },
+ "module" : {
+ "name" : "entry",
+ "type" : "patch",
+ "deviceTypes" : [
+ "default",
+ "tablet"
+ ],
+ "originalModuleHash": "11223344556677889900" // SHA-256 value of the HAP file to restore
+ }
+}
+```
+
+## Generating a Quick Fix File
+### Quick Fix for TS Code
+* After modifying the TS code file in DevEco Studio and build it into a HAP file, you can find the corresponding .abc file in the project directory, for example, **build\default\cache\default\LegacyCompileETS\jsbundle\temporary\pages\index.abc**.
+
+### Quick Fix for C++ Code
+
+* In DevEco Studio, build the original C++ code into a .so file. Fix bugs in the code and rebuild the code into a new .so file. You can find this .so file in the project directory, for example, **build\default\intermediates\libs\default\arm64-v8a\libentry.so**.
+* Locate the **diff.exe** tool in the **toolchains** folder in the local OpenHarmony SDK path. Use this tool to generate a quick fix .so file based on the old and new .so files. The command is as follows:
+```shell
+$ diff.exe -s Example.z.so -d Example.z.so -p Example.z.so.diff
+```
+The command contains the following options:
+- -**s**: path to the old .so file
+- -**d**: path to the new .so file
+- -**p**: path of the generated differential file
+
+## Generating a Quick Fix File in .hqf Format
+
+With the preceding **patch.json**, .abc, and .so files, run the following command to generate an .hqf file using the **app_packing_tool.jar** tool in the **toolchains** folder in the local OpenHarmony SDK path:
+```shell
+$ java -jar app_packing_tool.jar --mode hqf --json-path patch.json --lib-path libs --ets-patch patchs --out-path entry-default-unsigned.hqf --force true
+```
+
+The command contains the following options.
+| Option|Description | Remarks|
+| --- | --- |---|
+| mode |Mode. | Mandatory|
+| json-path|Path to the **patch.json** file.|Mandatory|
+| lib-path|Path to the quick fix .so file. For details about the path, see [Structure of the Quick Fix Package](quickfix-principles.md#structure-of-the-quick-fix-package).|Optional|
+| ets-path|Path to the quick fix .abc file.|Optional|
+
+## Signing the Quick Fix File
+
+Use the [hapsigner](../security/hapsigntool-guidelines.md) tool to sign the **entry-default-unsigned.hqf** file, in the same way you sign a HAP file. To be specific, run the following command to use **hap-sign-tool.jar** in the **toolchains** folder in the local OpenHarmony SDK path:
+
+```shell
+$ java -jar hap-sign-tool.jar sign-app -keyAlias "OpenHarmony Application Release" -signAlg "SHA256withECDSA" -mode "localSign" -appCertFile "OpenHarmonyApplication.pem" -profileFile "ohos_provision_release.p7b" -inFile "entry-default-unsigned.hqf" -keystoreFile "OpenHarmony.p12" -outFile "entry-signed-release.hqf" -keyPwd "123456" -keystorePwd "123456"
+```
+
+## Installing the Quick Fix File
+
+Push the **entry-signed-release.hqf** file to the device.
+```shell
+hdc.exe file send .\entry-signed-release.hqf /data/
+```
+
+Run the following command to install the quick fix file as a patch:
+```shell
+$ bm quickfix -a -f /data/entry-signed-release.hqf
+```
+
+The complete commands are as follows:
+```
+$ bm quickfix -h
+usage: bm quickfix
+options list:
+-h, --help list available commands
+-q, --query indicates query quickfix, used with -b or --bundle-name
+-b, --bundle-name query quickfix status and information by a specified bundle name
+-a, --apply indicates apply quickfix, used with -f or --file-path
+-f, --file-path apply a quickfix file by a specified path
+-f, --file-path ... apply some quickfix files of one bundle
+-f, --file-path apply quickfix files by direction, under which are quickfix files
+```
diff --git a/en/application-dev/quick-start/quickfix-principles.md b/en/application-dev/quick-start/quickfix-principles.md
new file mode 100644
index 0000000000000000000000000000000000000000..4c0a1f684cfc1ff71c5ad9a2594ae8823e178e82
--- /dev/null
+++ b/en/application-dev/quick-start/quickfix-principles.md
@@ -0,0 +1,105 @@
+# Quick Fix Overview
+
+Quick fix is a technical means provided by the OpenHarmony system for developers to fix application bugs in a manner that is far faster than application upgrades. Compared with the full application upgrade, the quick fix provides a better user experience by being smaller and faster. It allows users to fix application bugs quickly, without restarting their application.
+
+## Rules for Using Quick Fix
+
+* The quick fix only works for TypeScript (TS) and C++ code of applications, that is, .abc files (created after TS code compilation) and .so files (created after C++ code compilation). It does not work for resource files.
+* No new .abc and .so files are allowed.
+* Before deploying a quick fix package, make sure the corresponding application has been installed. Otherwise, the deployment will fail.
+* The bundle name and application version number configured in the quick fix package must be the same as those of the installed application. Otherwise, the deployment will fail.
+* Make sure the version of the quick fix package to deploy is later than that of the one previously deployed. Otherwise, the deployment will fail.
+* The signature information of the quick fix package must be the same as that of the application to be fixed. Otherwise, the deployment will fail.
+* Installing an application update will delete quick fix package.
+
+## Structure of the Quick Fix Package
+
+
+ The preceding figure shows the structure of the quick fix package released by an OpenHarmony application.
+* As shown in the figure, the quick fix package comes in two formats:
+ * .appqf (Application Quick Fix)
+ There is a one-to-one mapping between the .appqf file and App Pack of an application. For details, see [Application Package Structure in Stage Model](application-package-structure-stage).
+ * The .appqf file is used to release OpenHarmony applications to the application market and cannot be directly installed on devices.
+ * An .appqf file consists of one or more .hqf (Harmony Ability Package Quick Fix) files, which are extracted from the .appqf file by the application market and then distributed to specific devices.
+ * The .appqf file must contain the developer's signature information before being released to the application market. For details about how to sign the file, see [hapsigner Overview](../security/hapsigntool-overview.md).
+ * .hqf (Harmony Ability Package Quick Fix)
+ The .hqf file is a quick fix to bugs in a HAP file. It can be installed on devices. An .hqf file contains .abc and .so files. The .abc files provide the quick fix, and the .so files provide package configuration information as well as the quick fix.
+ * .abc file: modified TS code in the application, which is a bytecode file created after the build.
+ * **libs** directory: a collection of .so.diff files, which are differential files of the .so library files, organized by system CPU architecture, such as arm and x86.
+ * **patch.json**:
+ This file is used to describe the version information of the .hqf file and is filled in by developers. The details are as follows:
+ ```json
+ {
+ "app" : {
+ "bundleName" : "com.ohos.quickfix",
+ "versionCode" : 1000000,
+ "versionName" : "1.0.0",
+ "patchVersionCode" : 1000000,
+ "patchVersionName" : "1.0.0"
+ },
+ "module" : {
+ "name" : "entry",
+ "type" : "patch",
+ "deviceTypes" : [
+ "default",
+ "tablet"
+ ],
+ "originalModuleHash" : "11223344556677889900"
+ }
+ }
+ ```
+ The following describes the parameters:
+ | Parameter|Type |Description |Initial Value Allowed|
+ | --- | --- | --- | --- |
+ |bundleName | string | Bundle name of the application. | No|
+ |versionCode | int |Version of the application. | No |
+ |versionName |string |Version name of the application.| No for the patch|
+ |patchVersionCode |int |Version of the patch. | No|
+ |patchVersionName |string |Version name of the patch.| No for the patch|
+ |name |string |Module name of the application, which is used to restore the module.| No|
+ |type | string|Type of the patch. The value can only be **patch**.| No|
+ |deviceTypes |array |Device types supported by the patch.| No|
+ |originalModuleHash| string |Hash value of the bundle corresponding to the original module name.| No|
+
+## Quick Fix to .abc Files Created After TS Code Compilation
+
+
+
+The preceding figure shows the process of creating an .abc file quick fix using the TS compiler.
+* An application build creates .abc and .map files. The .abc file is a bytecode file created after TS code compilation. It is used when the application is running. The .map file is an intermediate file created when the TS code is compiled using the TS compiler. It stores information such as functions and classes in the code.
+* After bugs in the application are fixed, the application code is compiled again. During the compilation, the difference between the source and the target is obtained based on the preceding .map file and the current TS code, and an .abc file for quick fix is generated based on the difference. This .abc file will be placed in the .hqf file.
+
+## Quick Fix to .so Files Created After C++ Code Compilation
+
+
+
+The preceding figure shows the process of creating a .so file quick fix using the differential tool.
+* The C++ source code of the original application is built into a .so file by using a compiler. The .so file is used when the application is running.
+* After bugs in the application are fixed, the C++ code is compiled again into a .so file. With the two .so files before and after bug fixes, the differential tool generates a .so file for quick fix. This .so file will also be placed in the .hqf file.
+
+## Quick Fix Release and Deployment Process
+
+
+
+As shown above, the modules involved in the release process are as follows:
+* DevEco Studio: an integrated development environment for developing code projects. It can be used to create a quick fix file based on the original application code and the code after bug fixes, and sign the created quick repair file for release to the application market.
+* Application market server: place where you release the quick fix file. It verifies the signature, scans for risks, unpacks and resigns the file, and then distributes the file to the client.
+* Application market client: tool that receives the quick fix file from the application market server and triggers installation.
+* Bundle manager service: system service used to manage the installation and uninstallation of application packages and quick fix files on the device.
+* Quick fix engine: system service used to manage switching to quick fix code on the device. If the target application is running, the quick fix engine instructs it to switch to the quick fix file upon completion of the quick fix file deployment.
+* File system: location where the application package and quick repair file are deployed on the device.
+
+In the end-to-end release and deployment process of the quick repair file:
+1. DevEco Studio is used to create a quick fix file through building and packaging based on the original application source code and the source code after bug fixes, and sign the created quick fix file.
+2. The signed quick repair file is released to the application market, which then distributes the file after verifying the signature, scanning for risks, and unpacking and resigning the file.
+3. When the on-device application market client detects that a new quick fix file is available on the application market server, it downloads the file, and then installs and deploys the file through the bundle manager service in the system.
+4. After the quick fix file is deployed, the quick fix engine triggers the application to switch to the quick fix file, ensuring that the user can instantly use the functions where bugs are fixed.
+
+## Quick Fix File Debugging Process
+
+
+
+* As the quick fix capability is not yet available in DevEco Studio, for the time being, you can use the provided command-line tool to develop a quick fix file. The procedure is as follows:
+1. With the original application source code and the source code after bug fixes, use the command-line tool to build and create quick fix files in .hpf format. Sign the .hpf files before installing them on the device. As aforementioned, the .appqf file cannot be installed on the device.
+2. Install and deploy the .hqf files on the device using the command-line tool.
+3. After the .hqf files are deployed, a callback is called to instruct the quick fix engine to trigger the application to switch to the quick fix file, ensuring that the user can instantly use the functions where bugs are fixed.
diff --git a/en/application-dev/quick-start/shared-guide.md b/en/application-dev/quick-start/shared-guide.md
new file mode 100644
index 0000000000000000000000000000000000000000..b73ad743a97d97b1ba9fc286c68e3b25d6f053d4
--- /dev/null
+++ b/en/application-dev/quick-start/shared-guide.md
@@ -0,0 +1,20 @@
+# Shared Package Overview
+
+OpenHarmony provides two types of shared packages: [Harmony Achive (HAR)](har-package.md) static shared package and Harmony Shared Package (HSP) dynamic shared package.
+
+Both the HAR and HSP are used to share code and resources and can contain code, C++ libraries, resources, and configuration files. The biggest differences between them are as follows: The code and resources in the HAR are compiled with the invoking module, and if there are multiple invoking modules, the build product contains multiple copies of the same code and resources; the code and resources in the HSP can be compiled independently, and the build product contains only one copy of the code and resources.
+
+**Figure 1** HAR and HSP in the App Pack
+
+
+
+The HSP is designed to solve the following issues with the HAR:
+- When multiple HAPs reference the same HAR, the size of the App Pack swells.
+- When multiple HAPs reference the same HAR, some state variables in the HAR cannot be shared.
+
+Restrictions on the HSP:
+- The HSP and its invoking modules must be in the stage model.
+- The HSP and its invoking modules must use the **esmodule **compilation mode.
+- The HSP does not support the declaration of **abilities** and **extensionAbilities** in its configuration file.
+
+The HSP can be classified as [in-application HSP](in-app-hsp.md) or [inter-application HSP](cross-app-hsp.md), depending on the configuration files and usage methods.
diff --git a/en/application-dev/quick-start/stage-structure.md b/en/application-dev/quick-start/stage-structure.md
deleted file mode 100644
index ff66e3d405738a44f0c645593ffb0dbfb5beca97..0000000000000000000000000000000000000000
--- a/en/application-dev/quick-start/stage-structure.md
+++ /dev/null
@@ -1,25 +0,0 @@
-# Application Configuration File Overview (Stage Model)
-
-
-Each application project must have configuration files in its code directory. These configuration files provide basic application information for build tools, operating systems, and application markets.
-
-
-In the code directory of an application project developed in stage model, there are two types of configuration files: one **app.json5** file and one or more **module.json5** files.
-
-
-The [app.json5](app-configuration-file.md) file contains the following contents:
-
-
-- Application-wide configuration, including the bundle name, developer, and version number.
-
-- Device-specific configuration.
-
-
-The [module.json5](module-configuration-file.md) file contains the following contents:
-
-
-- Basic module configuration, such as the name, type, description, and supported device types of the module.
-
-- Information about the [application components](../application-models/stage-model-development-overview.md), including the descriptions of the UIAbility and ExtensionAbility components.
-
-- Information about the permissions required during application running.
diff --git a/en/application-dev/quick-start/start-with-ets-fa.md b/en/application-dev/quick-start/start-with-ets-fa.md
index 23709abc5c2ba7e9b14ef9f396e9731a9f94e136..c806eebac3e5f266cd0ba6859ef7eb75727af243 100644
--- a/en/application-dev/quick-start/start-with-ets-fa.md
+++ b/en/application-dev/quick-start/start-with-ets-fa.md
@@ -20,7 +20,7 @@
> **NOTE**
>
- > If you are using DevEco Studio V3.0 Beta3 or later, you can use the [low-code development](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652) mode apart from the traditional coding approach.
+ > If you are using DevEco Studio V3.0 Beta3 or later, you can use the low-code development mode apart from the traditional coding approach.
>
> On the low-code development pages, you can design your application UI in an efficient, intuitive manner, with a wide array of UI editing features.
>
@@ -34,7 +34,7 @@

- **entry**: OpenHarmony project module, which can be built into an OpenHarmony Ability Package ([HAP](../../glossary.md#hap)).
- - **src > main > ets**: a collection of eTS source code.
+ - **src > main > ets**: a collection of ArkTS source code.
- **src > main > ets > MainAbility**: entry to your application/service.
- **src > main > ets > MainAbility > pages**: pages contained in **MainAbility**.
- **src > main > ets > MainAbility > pages > index.ets**: the first page in the **pages** list, also referred to as the entry to the application.
diff --git a/en/application-dev/quick-start/start-with-ets-stage.md b/en/application-dev/quick-start/start-with-ets-stage.md
index d9527e8fe83bf0173e688296c5cab2e8aff651b8..eece0ad295ee138ccf353345a78fc1eca7cf3715 100644
--- a/en/application-dev/quick-start/start-with-ets-stage.md
+++ b/en/application-dev/quick-start/start-with-ets-stage.md
@@ -20,7 +20,7 @@
> **NOTE**
>
- > You can use the [low-code development](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652) mode apart from the traditional coding approach.
+ > You can use the low-code development mode apart from the traditional coding approach.
>
> On the low-code development pages, you can design your application UI in an efficient, intuitive manner, with a wide array of UI editing features.
>
@@ -34,7 +34,7 @@

- **entry**: OpenHarmony project module, which can be built into an OpenHarmony Ability Package ([HAP](../../glossary.md#hap)).
- - **src > main > ets**: a collection of eTS source code.
+ - **src > main > ets**: a collection of ArkTS source code.
- **src > main > ets > entryability**: entry to your application/service.
- **src > main > ets > pages**: pages included in your application/service.
- **src > main > resources**: a collection of resource files used by your application/service, such as graphics, multimedia, character strings, and layout files. For details about resource files, see [Resource Categories and Access](resource-categories-and-access.md#resource-categories).
diff --git a/en/application-dev/quick-start/start-with-js-fa.md b/en/application-dev/quick-start/start-with-js-fa.md
index 7e1123d97f8af188bbb97849551cd6a499042a9f..15af85cd0dfadab9573d38e3d95e3671448550de 100644
--- a/en/application-dev/quick-start/start-with-js-fa.md
+++ b/en/application-dev/quick-start/start-with-js-fa.md
@@ -18,7 +18,7 @@
> **NOTE**
>
- > If you are using DevEco Studio V2.2 Beta1 or later, you can use the [low-code development](https://developer.harmonyos.com/en/docs/documentation/doc-guides/ohos-low-code-development-0000001218440652) mode apart from the traditional coding approach.
+ > If you are using DevEco Studio V2.2 Beta1 or later, you can use the low-code development mode apart from the traditional coding approach.
>
> On the low-code development pages, you can design your application UI in an efficient, intuitive manner, with a wide array of UI editing features.
>
diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index 3c8f9de264e357fcf595ec2b3f82ec6842f55b50..6346094a14fbcea248a6bb9865155c2901e4f847 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -187,19 +187,19 @@
- [WebGL](js-apis-webgl.md)
- [WebGL2](js-apis-webgl2.md)
-- Media
+- Multimedia
- [@ohos.multimedia.audio (Audio Management)](js-apis-audio.md)
- [@ohos.multimedia.avsession (AVSession Management)](js-apis-avsession.md)
- [@ohos.multimedia.camera (Camera Management)](js-apis-camera.md)
- [@ohos.multimedia.image (Image Processing)](js-apis-image.md)
- [@ohos.multimedia.media (Media)](js-apis-media.md)
-- Resource Management
+- Resource Manager
- [@ohos.i18n (Internationalization)](js-apis-i18n.md)
- [@ohos.intl (Internationalization)](js-apis-intl.md)
- [@ohos.resourceManager (Resource Manager)](js-apis-resource-manager.md)
-- Background Tasks
+- Background Task
- [@ohos.distributedMissionManager (Distributed Mission Management)](js-apis-distributedMissionManager.md)
- [@ohos.reminderAgentManager (Reminder Agent Management)](js-apis-reminderAgentManager.md)
- [@ohos.resourceschedule.backgroundTaskManager (Background Task Management)](js-apis-resourceschedule-backgroundTaskManager.md)
@@ -208,7 +208,7 @@
- [@ohos.WorkSchedulerExtensionAbility (Work Scheduler Callbacks)](js-apis-WorkSchedulerExtensionAbility.md)
- application
- [WorkSchedulerExtensionContext](js-apis-inner-application-WorkSchedulerExtensionContext.md)
-
+
- Security
- [@ohos.abilityAccessCtrl (Ability Access Control)](js-apis-abilityAccessCtrl.md)
- [@ohos.privacyManager (Privacy Management)](js-apis-privacyManager.md)
@@ -217,7 +217,6 @@
- [@ohos.security.huks (HUKS)](js-apis-huks.md)
- [@ohos.userIAM.faceAuth (Facial Authentication)](js-apis-useriam-faceauth.md)
- [@ohos.userIAM.userAuth (User Authentication)](js-apis-useriam-userauth.md)
- - [@system.cipher (Cipher Algorithm)](js-apis-system-cipher.md)
- security
- [PermissionRequestResult](js-apis-permissionrequestresult.md)
@@ -238,15 +237,16 @@
- [@ohos.file.environment (Directory Environment Capability)](js-apis-file-environment.md)
- [@ohos.file.fileAccess (User File Access and Management)](js-apis-fileAccess.md)
- [@ohos.file.fileExtensionInfo (User File Extension Information)](js-apis-fileExtensionInfo.md)
+ - [@ohos.file.fileUri (File URI)](js-apis-file-fileUri.md)
- [@ohos.file.fs (File Management)](js-apis-file-fs.md)
- [@ohos.file.hash (File Hash Processing)](js-apis-file-hash.md)
- - [@ohos.file.picker (Picker)](js-apis-file-picker.md)
+ - [@ohos.file.picker (File Picker)](js-apis-file-picker.md)
- [@ohos.file.securityLabel (Data Label)](js-apis-file-securityLabel.md)
- [@ohos.file.statvfs (File System Space Statistics)](js-apis-file-statvfs.md)
- [@ohos.file.storageStatistics (Application Storage Statistics)](js-apis-file-storage-statistics.md)
- [@ohos.file.volumeManager (Volume Management)](js-apis-file-volumemanager.md)
- [@ohos.filemanagement.userFileManager (User Data Management)](js-apis-userFileManager.md)
- - [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md)
+ - [@ohos.fileShare (File Sharing)](js-apis-fileShare.md)
- Telephony Service
- [@ohos.contact (Contacts)](js-apis-contact.md)
@@ -276,8 +276,8 @@
- [@ohos.rpc (RPC)](js-apis-rpc.md)
- [@ohos.wifiManager (WLAN)](js-apis-wifiManager.md)
- [@ohos.wifiManagerExt (WLAN Extension)](js-apis-wifiManagerExt.md)
- - [@ohos.wifi (To Be Deprecated)](js-apis-wifi.md)
- - [@ohos.wifiext (To Be Deprecated)](js-apis-wifiext.md)
+ - [@ohos.wifi (To Be Deprecated Soon)](js-apis-wifi.md)
+ - [@ohos.wifiext (To Be Deprecated Soon)](js-apis-wifiext.md)
- tag
- [nfctech (Standard NFC Technologies)](js-apis-nfctech.md)
- [tagSession (Standard NFC Tag Session)](js-apis-tagSession.md)
@@ -318,6 +318,7 @@
- [@ohos.batteryInfo (Battery Information)](js-apis-battery-info.md)
- [@ohos.batteryStatistics (Battery Statistics)](js-apis-batteryStatistics.md)
- [@ohos.brightness (Screen Brightness)](js-apis-brightness.md)
+ - [@ohos.charger (Charging Type)](js-apis-charger.md)
- [@ohos.deviceInfo (Device Information)](js-apis-device-info.md)
- [@ohos.distributedHardware.deviceManager (Device Management)](js-apis-device-manager.md)
- [@ohos.geoLocationManager (Geolocation Manager)](js-apis-geoLocationManager.md)
@@ -349,7 +350,7 @@
- [@ohos.account.distributedAccount (Distributed Account Management)](js-apis-distributed-account.md)
- [@ohos.account.osAccount (OS Account Management)](js-apis-osAccount.md)
-- Custom Management
+- Customization
- [@ohos.configPolicy (Configuration Policy)](js-apis-configPolicy.md)
- [@ohos.enterprise.accountManager (Account Management)](js-apis-enterprise-accountManager.md)
- [@ohos.enterprise.adminManager (Enterprise Device Management)](js-apis-enterprise-adminManager.md)
@@ -403,6 +404,7 @@
- [@ohos.fileio (File Management)](js-apis-fileio.md)
- [@ohos.geolocation (Geolocation)](js-apis-geolocation.md)
- [@ohos.hiAppEvent (Application Event Logging)](js-apis-hiappevent.md)
+ - [@ohos.multimedia.medialibrary (Media Library Management)](js-apis-medialibrary.md)
- [@ohos.prompt (Prompt)](js-apis-prompt.md)
- [@ohos.reminderAgent (Reminder Agent)](js-apis-reminderAgent.md)
- [@ohos.statfs (statfs)](js-apis-statfs.md)
@@ -414,6 +416,7 @@
- [@system.battery (Battery Information)](js-apis-system-battery.md)
- [@system.bluetooth (Bluetooth)](js-apis-system-bluetooth.md)
- [@system.brightness (Screen Brightness)](js-apis-system-brightness.md)
+ - [@system.cipher (Cipher Algorithm)](js-apis-system-cipher.md)
- [@system.configuration (Application Configuration)](js-apis-system-configuration.md)
- [@system.device (Device Information)](js-apis-system-device.md)
- [@system.fetch (Data Request)](js-apis-system-fetch.md)
diff --git a/en/application-dev/reference/apis/figures/Colorsucker.png b/en/application-dev/reference/apis/figures/Colorsucker.png
new file mode 100644
index 0000000000000000000000000000000000000000..40e19e94e129682fdeb461cceef0f0a57c64d66d
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Colorsucker.png differ
diff --git a/en/application-dev/reference/apis/figures/Copy.png b/en/application-dev/reference/apis/figures/Copy.png
new file mode 100644
index 0000000000000000000000000000000000000000..212517131bf176661ae85c7513def022dbb50559
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Copy.png differ
diff --git a/en/application-dev/reference/apis/figures/Cross.png b/en/application-dev/reference/apis/figures/Cross.png
new file mode 100644
index 0000000000000000000000000000000000000000..58625855d1cd96ea8a29ab9c3c201d90ac717e83
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Cross.png differ
diff --git a/en/application-dev/reference/apis/figures/Default.png b/en/application-dev/reference/apis/figures/Default.png
new file mode 100644
index 0000000000000000000000000000000000000000..6308171fe9d612050376f6a5dfdc870e51bc92db
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Default.png differ
diff --git a/en/application-dev/reference/apis/figures/East.png b/en/application-dev/reference/apis/figures/East.png
new file mode 100644
index 0000000000000000000000000000000000000000..4942bc948a17e78c68538ccc3ae886bc0a548737
Binary files /dev/null and b/en/application-dev/reference/apis/figures/East.png differ
diff --git a/en/application-dev/reference/apis/figures/Forbid.png b/en/application-dev/reference/apis/figures/Forbid.png
new file mode 100644
index 0000000000000000000000000000000000000000..c5c43d4b4b8aaf6d53931586e519a583d064fec7
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Forbid.png differ
diff --git a/en/application-dev/reference/apis/figures/Hand_Grabbing.png b/en/application-dev/reference/apis/figures/Hand_Grabbing.png
new file mode 100644
index 0000000000000000000000000000000000000000..09ab3121d15e27a975fbaa228aadb2399e4492b9
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Grabbing.png differ
diff --git a/en/application-dev/reference/apis/figures/Hand_Open.png b/en/application-dev/reference/apis/figures/Hand_Open.png
new file mode 100644
index 0000000000000000000000000000000000000000..e1cb7a972ec2d372f0d75cbe80159c4a66e74e10
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Open.png differ
diff --git a/en/application-dev/reference/apis/figures/Hand_Pointing.png b/en/application-dev/reference/apis/figures/Hand_Pointing.png
new file mode 100644
index 0000000000000000000000000000000000000000..f0daa0dad6154a1846fb9fe4b7f441b3ab6f8b5b
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Hand_Pointing.png differ
diff --git a/en/application-dev/reference/apis/figures/Help.png b/en/application-dev/reference/apis/figures/Help.png
new file mode 100644
index 0000000000000000000000000000000000000000..ffea2f1c072f1682ca8e837ddb947352a553917e
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Help.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_East.png b/en/application-dev/reference/apis/figures/MID_Btn_East.png
new file mode 100644
index 0000000000000000000000000000000000000000..921cd4ceea8d97ffb6d4c45008d6428cda998cce
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_East.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North.png b/en/application-dev/reference/apis/figures/MID_Btn_North.png
new file mode 100644
index 0000000000000000000000000000000000000000..5769575ddb435f5e8f5f8993d9edc13749376293
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_East.png b/en/application-dev/reference/apis/figures/MID_Btn_North_East.png
new file mode 100644
index 0000000000000000000000000000000000000000..3daf141241dec309c98ae10266bb153af163f3d9
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_East.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_South.png b/en/application-dev/reference/apis/figures/MID_Btn_North_South.png
new file mode 100644
index 0000000000000000000000000000000000000000..1f56c4cd8f1498293f5fc4a5ab2c321159fb07dd
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_South.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png b/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png
new file mode 100644
index 0000000000000000000000000000000000000000..b45dbde27e59121bdfc4e1752759176fb835027c
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_South_West_East.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_North_West.png b/en/application-dev/reference/apis/figures/MID_Btn_North_West.png
new file mode 100644
index 0000000000000000000000000000000000000000..bde82d08f7a098106b4f4c31d55a84a989e25a8d
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_North_West.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South.png b/en/application-dev/reference/apis/figures/MID_Btn_South.png
new file mode 100644
index 0000000000000000000000000000000000000000..e7d5afb6f8f8b1b2939b9e18bdb8b8b3d9729f4d
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South_East.png b/en/application-dev/reference/apis/figures/MID_Btn_South_East.png
new file mode 100644
index 0000000000000000000000000000000000000000..44284a6e04a19ca8453b46ea81db099ad84cfaa2
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South_East.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_South_West.png b/en/application-dev/reference/apis/figures/MID_Btn_South_West.png
new file mode 100644
index 0000000000000000000000000000000000000000..c8632f09160c51ca573d58d3ffb1370058b880ce
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_South_West.png differ
diff --git a/en/application-dev/reference/apis/figures/MID_Btn_West.png b/en/application-dev/reference/apis/figures/MID_Btn_West.png
new file mode 100644
index 0000000000000000000000000000000000000000..7460bc18d63e000689755b39b8ead3c3609ee4f5
Binary files /dev/null and b/en/application-dev/reference/apis/figures/MID_Btn_West.png differ
diff --git a/en/application-dev/reference/apis/figures/Move.png b/en/application-dev/reference/apis/figures/Move.png
new file mode 100644
index 0000000000000000000000000000000000000000..00f64e54dca0d0731b595b4ddc9e0f7294c40c72
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Move.png differ
diff --git a/en/application-dev/reference/apis/figures/North.png b/en/application-dev/reference/apis/figures/North.png
new file mode 100644
index 0000000000000000000000000000000000000000..b022ac2e92d4cfb07efde7f3bf4b7ada8454e594
Binary files /dev/null and b/en/application-dev/reference/apis/figures/North.png differ
diff --git a/en/application-dev/reference/apis/figures/North_East.png b/en/application-dev/reference/apis/figures/North_East.png
new file mode 100644
index 0000000000000000000000000000000000000000..f6134237f38cd681b319c95bf1b77017bc1524b4
Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_East.png differ
diff --git a/en/application-dev/reference/apis/figures/North_East_South_West.png b/en/application-dev/reference/apis/figures/North_East_South_West.png
new file mode 100644
index 0000000000000000000000000000000000000000..908886aeb3f8df976bb67b2261e8e52e7222e622
Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_East_South_West.png differ
diff --git a/en/application-dev/reference/apis/figures/North_South.png b/en/application-dev/reference/apis/figures/North_South.png
new file mode 100644
index 0000000000000000000000000000000000000000..b15678a6b178ca0d9b13f7c7f58d025ab7a1ce12
Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_South.png differ
diff --git a/en/application-dev/reference/apis/figures/North_West.png b/en/application-dev/reference/apis/figures/North_West.png
new file mode 100644
index 0000000000000000000000000000000000000000..cfbe4c8910575c12afde4b5904d79b5beda0c162
Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_West.png differ
diff --git a/en/application-dev/reference/apis/figures/North_West_South_East.png b/en/application-dev/reference/apis/figures/North_West_South_East.png
new file mode 100644
index 0000000000000000000000000000000000000000..09fa728fbb45082a0524c284b8906b91d7b3a6f7
Binary files /dev/null and b/en/application-dev/reference/apis/figures/North_West_South_East.png differ
diff --git a/en/application-dev/reference/apis/figures/Resize_Left_Right.png b/en/application-dev/reference/apis/figures/Resize_Left_Right.png
new file mode 100644
index 0000000000000000000000000000000000000000..83e7671e3ffea65260bdb36d8b392fa78d55cd4e
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Resize_Left_Right.png differ
diff --git a/en/application-dev/reference/apis/figures/Resize_Up_Down.png b/en/application-dev/reference/apis/figures/Resize_Up_Down.png
new file mode 100644
index 0000000000000000000000000000000000000000..db8bccf89b6e5260db3875a22b5200fabd30c23c
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Resize_Up_Down.png differ
diff --git a/en/application-dev/reference/apis/figures/Screenshot_Cross.png b/en/application-dev/reference/apis/figures/Screenshot_Cross.png
new file mode 100644
index 0000000000000000000000000000000000000000..27460c082507e71082d11cd8a20eee2fc24da28d
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Screenshot_Cross.png differ
diff --git a/en/application-dev/reference/apis/figures/Screenshot_Cursor.png b/en/application-dev/reference/apis/figures/Screenshot_Cursor.png
new file mode 100644
index 0000000000000000000000000000000000000000..71abea4ca351988a92b8a5b2b2228321df31aecc
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Screenshot_Cursor.png differ
diff --git a/en/application-dev/reference/apis/figures/South.png b/en/application-dev/reference/apis/figures/South.png
new file mode 100644
index 0000000000000000000000000000000000000000..205f5cf5f59ce8318357e168eee0d66c119c233d
Binary files /dev/null and b/en/application-dev/reference/apis/figures/South.png differ
diff --git a/en/application-dev/reference/apis/figures/South_East.png b/en/application-dev/reference/apis/figures/South_East.png
new file mode 100644
index 0000000000000000000000000000000000000000..f4a70d2d068271bfe10e4ce724ae27e4e5ba96d9
Binary files /dev/null and b/en/application-dev/reference/apis/figures/South_East.png differ
diff --git a/en/application-dev/reference/apis/figures/South_West.png b/en/application-dev/reference/apis/figures/South_West.png
new file mode 100644
index 0000000000000000000000000000000000000000..2ae8e9a9fa396bb6ed0f385b7b99b66830357a40
Binary files /dev/null and b/en/application-dev/reference/apis/figures/South_West.png differ
diff --git a/en/application-dev/reference/apis/figures/Text_Cursor.png b/en/application-dev/reference/apis/figures/Text_Cursor.png
new file mode 100644
index 0000000000000000000000000000000000000000..7cd8d2200bc7455e562da003069702832db4eb20
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Text_Cursor.png differ
diff --git a/en/application-dev/reference/apis/figures/West.png b/en/application-dev/reference/apis/figures/West.png
new file mode 100644
index 0000000000000000000000000000000000000000..2cad91aca31f2e2b257c523e80e6fc2d71fa2cee
Binary files /dev/null and b/en/application-dev/reference/apis/figures/West.png differ
diff --git a/en/application-dev/reference/apis/figures/West_East.png b/en/application-dev/reference/apis/figures/West_East.png
new file mode 100644
index 0000000000000000000000000000000000000000..6be4aa9d05f22a10cd00fa6aec36f95aee2b332d
Binary files /dev/null and b/en/application-dev/reference/apis/figures/West_East.png differ
diff --git a/en/application-dev/reference/apis/figures/Zoom_In.png b/en/application-dev/reference/apis/figures/Zoom_In.png
new file mode 100644
index 0000000000000000000000000000000000000000..2e928ec070fcd05a44cd9b1abd041128287b0528
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Zoom_In.png differ
diff --git a/en/application-dev/reference/apis/figures/Zoom_Out.png b/en/application-dev/reference/apis/figures/Zoom_Out.png
new file mode 100644
index 0000000000000000000000000000000000000000..d675d0e517ba436724540a39f60dfa75c256f0d0
Binary files /dev/null and b/en/application-dev/reference/apis/figures/Zoom_Out.png differ
diff --git a/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md b/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
index a55ab990ef39072d83989526e66723eab794ca63..3b42c32bc9e19c19810017a2a7d7cab637619dc6 100644
--- a/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
@@ -105,3 +105,55 @@ export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbil
}
};
```
+
+## EnterpriseAdminExtensionAbility.onAppStart10+
+
+onAppStart(bundleName: string): void
+
+Called when an application is started.
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Parameter | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| bundleName | string | Yes | Bundle name of the application started.|
+
+**Example**
+
+```ts
+export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
+ onAppStart(bundleName: string) {
+ console.log("started bundle name: " + bundleName);
+ }
+};
+```
+
+## EnterpriseAdminExtensionAbility.onAppStop10+
+
+onAppStop(bundleName: string): void
+
+Called when an application is stopped.
+
+**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
+
+**System API**: This is a system API.
+
+**Parameters**
+
+| Parameter | Type | Mandatory | Description |
+| ----- | ----------------------------------- | ---- | ------- |
+| bundleName | string | Yes | Bundle name of the application stopped.|
+
+**Example**
+
+```ts
+export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
+ onAppStop(bundleName: string) {
+ console.log("stopped bundle name: " + bundleName);
+ }
+};
+```
diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
index 54cea921d80648b17fe5384e4ea9e57336d32fc1..874518b0e5ca7692fd902f26bcf49b07719eefc5 100644
--- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
+++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
@@ -504,8 +504,8 @@ For details about the error codes, see [Application Access Control Error Codes](
| ID| Error Message|
| -------- | -------- |
-| 12100001 | The parameter is invalid. The tokenID in list is all invalid, or the permissionName in list is all invalid. |
-| 12100004 | The API is not used together with "on()". |
+| 12100001 | The parameter is invalid. The tokenIDs or permissionNames in the list are all invalid. |
+| 12100004 | The interface is not used together with "on". |
| 12100007 | Service is abnormal. |
| 12100008 | Out of memory. |
@@ -532,7 +532,9 @@ verifyAccessToken(tokenID: number, permissionName: Permissions): Promise<Gran
Verifies whether a permission is granted to an application. This API uses a promise to return the result.
-> **NOTE** You are advised to use [checkAccessToken](#checkaccesstoken9).
+> **NOTE**
+>
+> You are advised to use [checkAccessToken](#checkaccesstoken9).
**System capability**: SystemCapability.Security.AccessToken
@@ -619,7 +621,7 @@ Requests permissions from the user in a dialog box. This API uses a promise to
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| context | Context | Yes| Ability context of the application that requests the permissions. |
-| permissionList | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md). |
+| permissionList | Array<Permissions> | Yes| Permissions requested. For details about the permissions, see the [Application Permission List](../../security/permission-list.md).|
**Return value**
@@ -659,7 +661,9 @@ verifyAccessToken(tokenID: number, permissionName: string): Promise<GrantStat
Verifies whether a permission is granted to an application. This API uses a promise to return the result.
-> NOTE This API is deprecated since API version 9. You are advised to use [checkAccessToken](#checkaccesstoken9).
+> **NOTE**
+>
+> This API is no longer maintained since API version 9. You are advised to use [checkAccessToken](#checkaccesstoken9).
**System capability**: SystemCapability.Security.AccessToken
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md b/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md
index d03dcb8185338c328e279df4b03849c434f1da6d..6931cfe50da06cdd9b7526344a47eae29c3c8ef8 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-appRecovery.md
@@ -4,7 +4,7 @@ The **appRecovery** module provides APIs for recovering faulty applications.
> **NOTE**
>
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. In the current version, only applications with a single ability in a single process can be recovered.
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version. In API version 9, only applications with a single ability in a process can be recovered. In API version 10, applications with multiple abilities in a process can be recovered.
## Modules to Import
```ts
@@ -51,7 +51,7 @@ Enumerates the application state saving modes. This enum is used as an input par
enableAppRecovery(restart?: [RestartFlag](#apprecoveryrestartflag), saveOccasion?: [SaveOccasionFlag](#apprecoverysaveoccasionflag), saveMode?: [SaveModeFlag](#apprecoverysavemodeflag)) : void;
-Enables application recovery.
+Enables application recovery. After this API is called, the first ability that is displayed when the application is started from the initiator can be restored.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -63,8 +63,8 @@ Enables application recovery.
| saveOccasion | [SaveOccasionFlag](#apprecoverysaveoccasionflag) | No| Scenario for saving the application state. By default, the state is saved when a fault occurs.|
| saveMode | [SaveModeFlag](#apprecoverysavemodeflag) | No| Application state saving mode. By default, the application state is written to the local file cache.|
-**Example**
-
+**Example**
+
```ts
import appRecovery from '@ohos.app.ability.appRecovery';
import AbilityStage from '@ohos.app.ability.AbilityStage';
@@ -84,13 +84,22 @@ export default class MyAbilityStage extends AbilityStage {
restartApp(): void;
-Restarts the application. This API can be used together with APIs of [errorManager](js-apis-app-ability-errorManager.md).
+Restarts the current process and starts the first ability that is displayed when the application is started. If the state of this ability is saved, the saved state data is passed into the **wantParam** attribute in the **want** parameter of the **OnCreate** lifecycle callback of the ability.
+
+In API version 10, the ability specified by [setRestartWant](#apprecoverysetrestartwant) is started. If no ability is specified, the following rules are used:
+
+- If the ability of the current application running in the foreground supports recovery, that ability is started.
+
+- If multiple abilities that support recovery is running in the foreground, only the last ability is started.
+
+- If no ability is running in the foreground, none of them is started.
+
+This API can be used together with the APIs of [errorManager](js-apis-app-ability-errorManager.md).
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**Example**
-**Example**
-
```ts
import appRecovery from '@ohos.app.ability.appRecovery';
import errorManager from '@ohos.app.ability.errorManager';
@@ -113,7 +122,7 @@ try {
saveAppState(): boolean;
-Saves the application state. This API can be used together with APIs of [errorManager](js-apis-app-ability-errorManager.md).
+Saves the application state. This API can be used together with the APIs of [errorManager](js-apis-app-ability-errorManager.md).
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -123,8 +132,8 @@ Saves the application state. This API can be used together with APIs of [errorMa
| -------- | -------- |
| boolean | Whether the application state is saved. The value **true** is returned if the application state is saved, and **false** is returned otherwise.|
-**Example**
-
+**Example**
+
```ts
import appRecovery from '@ohos.app.ability.appRecovery';
import errorManager from '@ohos.app.ability.errorManager';
@@ -142,3 +151,53 @@ try {
console.error('error: ${paramError.code}, ${paramError.message}');
}
```
+
+## appRecovery.saveAppState10+
+
+saveAppState(context?: UIAbilityContext): boolean;
+
+Saves the ability state, which will be used for recovery. This API can be used together with the APIs of [errorManager](js-apis-app-ability-errorManager.md).
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Whether the application state is saved. The value **true** is returned if the application state is saved, and **false** is returned otherwise.|
+
+**Example**
+
+```ts
+import appRecovery from '@ohos.app.ability.appRecovery';
+onBackground() {
+ hilog.info(0x0000, '[demo]', '%{public}s', 'EntryAbility onBackground');
+ appRecovery.saveAppState(this.context)
+}
+```
+
+## appRecovery.setRestartWant10+
+
+setRestartWant(want: Want): void;
+
+Sets an ability that will be recovered. The ability must be a UIAbility in the current bundle.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Example**
+
+```ts
+import appRecovery from '@ohos.app.ability.appRecovery';
+Button ("Start to Recover Ability")
+ .fontSize(40)
+ .fontWeight(FontWeight.Bold)
+ .onClick(()=> {
+ // set restart want
+ let want = {
+ bundleName: "ohos.samples.recovery",
+ abilityName: "RecoveryAbility"
+ };
+
+ appRecovery.setRestartWant(want);
+ })
+```
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md
index 1224636ae4c0aa4ceb8634b244cd088257b64331..3304f535b5fd5fe52562e237a9f48c60cd794067 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-missionManager.md
@@ -290,7 +290,7 @@ Obtains the information about a given mission. This API uses an asynchronous cal
| -------- | -------- | -------- | -------- |
| deviceId | string | Yes| Device ID. It is a null string by default for the local device.|
| missionId | number | Yes| Mission ID.|
- | callback | AsyncCallback<[MissionInfo](./js-apis-inner-application-missionInfo.md))> | Yes| Callback used to return the mission information obtained.|
+ | callback | AsyncCallback<[MissionInfo](./js-apis-inner-application-missionInfo.md)> | Yes| Callback used to return the mission information obtained.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
index a77fe119ca0f5de161bb0e3d65e4be15e871dcc5..b85364df96d39f3b8bd66f64910f3e15e5867ca7 100644
--- a/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
+++ b/en/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
@@ -319,7 +319,7 @@ Sends sequenceable data to the target ability.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
-| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Sequenceable data. You need to customize the data.|
+| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Parcelable data. You need to customize the data.|
**Return value**
@@ -338,7 +338,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
**Example**
```ts
- class MyMessageAble{ // Custom sequenceable data structure.
+ class MyMessageAble{ // Custom parcelable data structure.
name:''
str:''
num: 1
@@ -346,15 +346,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
this.name = name;
this.str = str;
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num);
- messageParcel.writeString(this.str);
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num);
+ messageSequence.writeString(this.str);
console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]');
return true;
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt();
- this.str = messageParcel.readString();
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt();
+ this.str = messageSequence.readString();
console.log('MyMessageAble unmarshalling num[${this.num}] str[${this.str}]');
return true;
}
@@ -369,7 +369,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
deviceId: ''
}).then((obj) => {
caller = obj;
- let msg = new MyMessageAble('msg', 'world'); // See the definition of Sequenceable.
+ let msg = new MyMessageAble('msg', 'world'); // See the definition of Parcelable.
caller.call(method, msg)
.then(() => {
console.log('Caller call() called');
@@ -387,7 +387,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
## Caller.callWithResult
-callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageParcel>;
+callWithResult(method: string, data: rpc.Parcelable): Promise<rpc.MessageSequence>;
Sends sequenceable data to the target ability and obtains the sequenceable data returned by the target ability.
@@ -398,13 +398,13 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities. The message is used to instruct the callee to register a function to receive the sequenceable data.|
-| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Sequenceable data. You need to customize the data.|
+| data | [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Yes| Parcelable data. You need to customize the data.|
**Return value**
| Type| Description|
| -------- | -------- |
-| Promise<[rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)> | Promise used to return the sequenceable data from the target ability.|
+| Promise<[rpc.MessageSequence](js-apis-rpc.md#messagesequence9)> | Promise used to return the sequenceable data from the target ability.|
**Error codes**
@@ -425,15 +425,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
this.name = name;
this.str = str;
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num);
- messageParcel.writeString(this.str);
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num);
+ messageSequence.writeString(this.str);
console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]');
return true;
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt();
- this.str = messageParcel.readString();
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt();
+ this.str = messageSequence.readString();
console.log('MyMessageAble unmarshalling num[${this.num] str[${this.str}]');
return true;
}
@@ -453,7 +453,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
.then((data) => {
console.log('Caller callWithResult() called');
let retmsg = new MyMessageAble(0, '');
- data.readSequenceable(retmsg);
+ data.readParcelable(retmsg);
})
.catch((callErr) => {
console.log('Caller.callWithResult catch error, error.code: ${JSON.stringify(callErr.code)}, error.message: ${JSON.stringify(callErr.message)}');
@@ -712,7 +712,7 @@ Registers a caller notification callback, which is invoked when the target abili
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| method | string | Yes| Notification message string negotiated between the two abilities.|
-| callback | [CalleeCallback](#calleecallback) | Yes| JS notification synchronization callback of the [rpc.MessageParcel](js-apis-rpc.md#messageparceldeprecated) type. The callback must return at least one empty [rpc.Sequenceable](js-apis-rpc.md#sequenceabledeprecated) object. Otherwise, the function execution fails.|
+| callback | [CalleeCallback](#calleecallback) | Yes| JS notification synchronization callback of the [rpc.MessageSequence](js-apis-rpc.md#messagesequence9) type. The callback must return at least one empty [rpc.Parcelable](js-apis-rpc.md#parcelable9) object. Otherwise, the function execution fails.|
**Error codes**
@@ -733,15 +733,15 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
this.name = name;
this.str = str;
}
- marshalling(messageParcel) {
- messageParcel.writeInt(this.num);
- messageParcel.writeString(this.str);
+ marshalling(messageSequence) {
+ messageSequence.writeInt(this.num);
+ messageSequence.writeString(this.str);
console.log('MyMessageAble marshalling num[${this.num}] str[${this.str}]');
return true;
}
- unmarshalling(messageParcel) {
- this.num = messageParcel.readInt();
- this.str = messageParcel.readString();
+ unmarshalling(messageSequence) {
+ this.num = messageSequence.readInt();
+ this.str = messageSequence.readString();
console.log('MyMessageAble unmarshalling num[${this.num}] str[${this.str}]');
return true;
}
@@ -750,7 +750,7 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
function funcCallBack(pdata) {
console.log('Callee funcCallBack is called ${pdata}');
let msg = new MyMessageAble('test', '');
- pdata.readSequenceable(msg);
+ pdata.readParcelable(msg);
return new MyMessageAble('test1', 'Callee test');
}
export default class MainUIAbility extends UIAbility {
@@ -816,10 +816,10 @@ For details about the error codes, see [Ability Error Codes](../errorcodes/error
## CalleeCallback
-(indata: rpc.MessageParcel): rpc.Parcelable;
+(indata: rpc.MessageSequence): rpc.Parcelable;
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
| Name| Readable| Writable| Type| Description|
| -------- | -------- | -------- | -------- | -------- |
-| (indata: [rpc.MessageParcel](js-apis-rpc.md#sequenceabledeprecated)) | Yes| No| [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Prototype of the listener function registered by the callee.|
+| (indata: [rpc.MessageSequence](js-apis-rpc.md#messagesequence9)) | Yes| No| [rpc.Parcelable](js-apis-rpc.md#parcelable9) | Prototype of the listener function registered by the callee.|
diff --git a/en/application-dev/reference/apis/js-apis-app-form-formInfo.md b/en/application-dev/reference/apis/js-apis-app-form-formInfo.md
index 09a6ae02c63c18073836925ad9b6399e48fdd67d..ab73d920af1c1b76825049c63b5560d8e82390ac 100644
--- a/en/application-dev/reference/apis/js-apis-app-form-formInfo.md
+++ b/en/application-dev/reference/apis/js-apis-app-form-formInfo.md
@@ -47,7 +47,7 @@ Enumerates the widget types.
| Name | Value | Description |
| ----------- | ---- | ------------ |
| JS | 1 | JS widget. |
-| eTS | 2 | eTS widget.|
+| eTS | 2 | ArkTS widget.|
## ColorMode
diff --git a/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md
index ee7ba37cdd08795b0ea33e09dc687b7ccd4712bc..0a97689f23cdf69527c61dfc8dfba28e6869badf 100644
--- a/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-application-dataShareExtensionAbility.md
@@ -81,7 +81,7 @@ export default class DataShareExtAbility extends DataShareExtensionAbility {
console.log('getRdbStore done, data : ${data}');
rdbStore = data;
rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) {
- console.log('executeSql done, error message : ${err}');
+ console.error('executeSql done, error message : ${err}');
});
if (callback) {
callback();
diff --git a/en/application-dev/reference/apis/js-apis-avsession.md b/en/application-dev/reference/apis/js-apis-avsession.md
index c614dddd308d3cb727c8c1acb2ce474380b3ccc5..b89eb42bc8793b9d28f1682ab87b1ac9f157c14d 100644
--- a/en/application-dev/reference/apis/js-apis-avsession.md
+++ b/en/application-dev/reference/apis/js-apis-avsession.md
@@ -3741,7 +3741,7 @@ Subscribes to playlist item changes.
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------- | ---- | ---------------------------------------------------------------------------- |
| type | string | Yes | Event type. The event **'queueItemsChange'** is reported when one or more items in the playlist changes.|
-| callback | (items: Array<[AVQueueItem](#avqueueitem10)\>) => void | Yes | Callback used for subscription. **items** in the callback indicates the names of the items that change, and **args** indicates the parameters carried in the event. |
+| callback | (items: Array<[AVQueueItem](#avqueueitem10)\>) => void | Yes | Callback used for subscription. The **items** parameter in the callback indicates the changed items in the playlist. |
**Error codes**
@@ -3775,7 +3775,7 @@ Subscribes to playlist name changes.
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------------------------------------------------------------------- |
| type | string | Yes | Event type. The event **'queueTitleChange'** is reported when the playlist name changes.|
-| callback | (title: string) => void | Yes | Callback used for subscription. **items** in the callback indicates the name of the playlist that changes, and **args** indicates the parameters carried in the event. |
+| callback | (title: string) => void | Yes | Callback used for subscription. The **title** parameter in the callback indicates the changed playlist name. |
**Error codes**
diff --git a/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md b/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md
index 775bc6665152c9d2870e28f677022d8734a551fe..325b32ef4780b5a884cdb2f07b0eaf73c124fcc4 100644
--- a/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md
+++ b/en/application-dev/reference/apis/js-apis-backgroundTaskManager.md
@@ -161,7 +161,7 @@ Requests a continuous task from the system. This API uses an asynchronous callba
| Name | Type | Mandatory| Description |
| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
@@ -253,7 +253,7 @@ Requests a continuous task from the system. This API uses a promise to return th
| Name | Type | Mandatory| Description |
| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| bgMode | [BackgroundMode](#backgroundmode8) | Yes | Background mode requested. |
| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | Yes | Notification parameter, which is used to specify the target page that is redirected to when a continuous task notification is clicked. |
@@ -339,7 +339,7 @@ Requests to cancel a continuous task. This API uses an asynchronous callback to
| Name | Type | Mandatory | Description |
| -------- | ------------------------- | ---- | ---------------------------------------- |
-| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Example**
@@ -395,7 +395,7 @@ Requests to cancel a continuous task. This API uses a promise to return the resu
| Name | Type | Mandatory | Description |
| ------- | ------- | ---- | ---------------------------------------- |
-| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-context.md).|
**Return value**
diff --git a/en/application-dev/reference/apis/js-apis-batteryStatistics.md b/en/application-dev/reference/apis/js-apis-batteryStatistics.md
index 89cd4ab39ee2d9a7c7e0a4f9b03a4755b55b864f..721a432caaf67116a6df882c0e8995e76b893a7e 100644
--- a/en/application-dev/reference/apis/js-apis-batteryStatistics.md
+++ b/en/application-dev/reference/apis/js-apis-batteryStatistics.md
@@ -18,7 +18,7 @@ import batteryStats from '@ohos.batteryStatistics';
getBatteryStats(): Promise
-Obtains the power consumption information list, using a promise to return the result.
+Obtains the power consumption information list. This API uses a promise to return the result.
**System API**: This is a system API.
@@ -34,9 +34,9 @@ Obtains the power consumption information list, using a promise to return the re
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
-| Code| Error Message |
-| -------- | -------------- |
-| 4600101 | Operation failed. Cannot connect to service.|
+| Code | Error Message |
+|---------|---------|
+| 4600101 | Operation failed. Cannot connect to service.|
**Example**
@@ -64,15 +64,15 @@ Obtains the power consumption information list. This API uses an asynchronous ca
| Name | Type | Mandatory| Description |
| -------- | ----------------------------------------------------------- | ---- | ------------------------------------------------------------ |
-| callback | AsyncCallback> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the array of power consumption information obtained. If the operation failed, **err** is an error object.|
+| callback | AsyncCallback> | Yes | Callback used to return the result. If the operation is successful, **err** is **undefined** and **data** is the array of power consumption information obtained (that is, **Array<[BatteryStatsInfo](#batterystatsinfo)>>**). If the operation failed, **err** is an error object.|
**Error codes**
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
-| Code| Error Message |
-| -------- | -------------- |
-| 4600101 | Operation failed. Cannot connect to service.|
+| Code | Error Message |
+|---------|---------|
+| 4600101 | Operation failed. Cannot connect to service.|
**Example**
@@ -112,9 +112,9 @@ Obtains the power consumption of an application.
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
-| Code| Error Message |
-| -------- | -------------- |
-| 4600101 | Operation failed. Cannot connect to service.|
+| Code | Error Message |
+|---------|---------|
+| 4600101 | Operation failed. Cannot connect to service.|
**Example**
@@ -153,9 +153,9 @@ Obtains the proportion of the power consumption of an application.
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
-| Code| Error Message |
-| -------- | -------------- |
-| 4600101 | Operation failed. Cannot connect to service.|
+| Code | Error Message |
+|---------|---------|
+| 4600101 | Operation failed. Cannot connect to service.|
**Example**
@@ -194,16 +194,16 @@ Obtains the power consumption of a hardware unit according to the consumption ty
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
-| Code| Error Message |
-| -------- | -------------- |
-| 4600101 | Operation failed. Cannot connect to service.|
+| Code | Error Message |
+|---------|---------|
+| 4600101 | Operation failed. Cannot connect to service.|
**Example**
```js
try {
var value = batteryStats.getHardwareUnitPowerValue(ConsumptionType.CONSUMPTION_TYPE_SCREEN);
- console.info('battery statistics percent of hardware is: ' + percent);
+ console.info('battery statistics value of hardware is: ' + value);
} catch(err) {
console.error('get battery statistics percent of hardware failed, err: ' + err);
}
@@ -235,15 +235,15 @@ Obtains the proportion of the power consumption of a hardware unit according to
For details about the error codes, see [Thermal Manager Error Codes](../errorcodes/errorcode-batteryStatistics.md).
-| Code| Error Message |
-| -------- | -------------- |
-| 4600101 | Operation failed. Cannot connect to service.|
+| Code | Error Message |
+|---------|---------|
+| 4600101 | Operation failed. Cannot connect to service.|
**Example**
```js
try {
- var value = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN);
+ var percent = batteryStats.getHardwareUnitPowerPercent(ConsumptionType.CONSUMPTION_TYPE_SCREEN);
console.info('battery statistics percent of hardware is: ' + percent);
} catch(err) {
console.error('get battery statistics percent of hardware failed, err: ' + err);
diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md
new file mode 100644
index 0000000000000000000000000000000000000000..5e16b3342c0f6a196c3da5362f950eecacf4c4a5
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bundleManager-overlayModuleInfo.md
@@ -0,0 +1,19 @@
+# OverlayModuleInfo
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+The **OverlayModuleInfo** module provides information about a module with the overlay feature. A system application can obtain such information of the specified application through [overlay.getOverlayModuleInfoByBundleName](js-apis-overlay.md#overlaygetoverlaymoduleinfobybundlename), and a third-party application can obtain such information of the current application through [overlay.getOverlayModuleInfo](js-apis-overlay.md#overlaygetoverlaymoduleinfo).
+
+## OverlayModuleInfo
+
+ **System capability**: SystemCapability.BundleManager.BundleFramework.Overlay
+
+| Name | Type | Readable| Writable| Description |
+| --------------------- | ---------------------------------------------------| ---- | ---- | ---------------------------------------------- |
+| bundleName | string | Yes | No | Bundle name of the application to which the module with the overlay feature belongs. |
+| moduleName | string | Yes | No | HAP name of the module with the overlay feature. |
+| targetModuleName | string | Yes | No | HAP name of the target module specified by the module with the overlay feature. |
+| priority | number | Yes | No | Priority of the module with the overlay feature. |
+| state | number | Yes | No | Whether the module with the overlay feature is disabled. The value **0** means that the module is disabled, and **1** means the opposite. |
diff --git a/en/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md b/en/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md
new file mode 100644
index 0000000000000000000000000000000000000000..ad5ee9f5503d04a49060f69b40f4883a0af0773e
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bundleManager-sharedBundleInfo.md
@@ -0,0 +1,33 @@
+# SharedBundleInfo
+
+The **SharedBundleInfo** module provides information about the shared bundle. The information can be obtained by calling [bundleManager.getSharedBundleInfo](js-apis-bundleManager.md).
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 10. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## SharedBundleInfo
+
+Defines the shared bundle information.
+
+**System capability**: SystemCapability.BundleManager.BundleFramework.Core
+
+| Name | Type | Readable| Writable| Description |
+| ---------------- | ------------------------------ | ---- | ---- | ---------------------- |
+| name | string | Yes | No | Name of the shared bundle. |
+| compatiblePolicy | bundleManager.CompatiblePolicy | Yes | No | Compatibility type of the shared bundle.|
+| sharedModuleInfo | Array\ | Yes | No | Information about the shared module. |
+
+## SharedModuleInfo
+
+Defines the shared module information.
+
+**System capability**: SystemCapability.BundleManager.BundleFramework.Core
+
+| Name | Type | Readable| Writable| Description |
+| ------------- | ------ | ---- | ---- | -------------------------- |
+| name | string | Yes | No | Module name of the shared bundle. |
+| versionCode | number | Yes | No | Version number of the shared bundle. |
+| versionName | string | Yes | No | Version description of the shared bundle.|
+| description | string | Yes | No | Description of the shared bundle. |
+| descriptionId | number | Yes | No | Description ID of the shared bundle. |
diff --git a/en/application-dev/reference/apis/js-apis-bundleManager.md b/en/application-dev/reference/apis/js-apis-bundleManager.md
index 1503f821c413923f28e11a31a77c5cd2eb07c101..a05187320802cde128cfacbd9105c23a13ea5269 100644
--- a/en/application-dev/reference/apis/js-apis-bundleManager.md
+++ b/en/application-dev/reference/apis/js-apis-bundleManager.md
@@ -112,6 +112,7 @@ Enumerates the types of Extension abilities.
| ENTERPRISE_ADMIN | 11 | [EnterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md): provides APIs for processing enterprise management events, such as application installation events on devices and events indicating too many incorrect screen-lock password attempts.|
| THUMBNAIL | 13 | ThumbnailExtensionAbility: provides thumbnails for files. This ability is reserved.|
| PREVIEW | 14 | PreviewExtensionAbility: provides APIs for file preview so that other applications can be embedded and displayed in the current application. This ability is reserved.|
+| PRINT10+ | 15 | PrintExtensionAbility: provides APIs for printing images. Printing documents is not supported yet.|
| UNSPECIFIED | 255 | No type is specified. It is used together with **queryExtensionAbilityInfo** to query all types of Extension abilities.|
@@ -2861,6 +2862,191 @@ try {
}
```
+### bundleManager.getSharedBundleInfo10+
+
+getSharedBundleInfo(bundleName: string, moduleName: string, callback: AsyncCallback\\>): void;
+
+Obtains the shared bundle information based on the given bundle name. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
+
+**System capability**: SystemCapability.BundleManager.BundleFramework.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| bundleName | string | Yes | Bundle name. |
+| moduleName | string | Yes | Module name. |
+| callback | AsyncCallback\\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is the shared bundle information obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------- |
+| 17700001 | The specified bundleName is not found. |
+| 17700002 | The specified moduleName is not found. |
+
+**Example**
+
+```ts
+import bundleManager from '@ohos.bundle.bundleManager';
+import hilog from '@ohos.hilog';
+let bundleName = 'com.example.myapplication';
+let moduleName = 'library';
+
+try {
+ bundleManager.getSharedBundleInfo(bundleName, moduleName, (err, data) => {
+ if (err) {
+ hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed: %{public}s', err.message);
+ } else {
+ hilog.info(0x0000, 'testTag', 'getSharedBundleInfo successfully: %{public}s', JSON.stringify(data));
+ }
+ });
+} catch (err) {
+ hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed: %{public}s', err.message);
+}
+```
+
+### bundleManager.getSharedBundleInfo10+
+
+function getSharedBundleInfo(bundleName: string, moduleName: string): Promise\\>;
+
+Obtains the shared bundle information based on the given bundle name. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
+
+**System capability**: SystemCapability.BundleManager.BundleFramework.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------ | ---- | -------------------------- |
+| bundleName | string | Yes | Bundle name.|
+| moduleName | string | Yes | Module name.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------------------ | ----------------------------------- |
+| Promise\\> | Promise used to return the shared bundle information obtained.|
+
+**Error codes**
+
+For details about the error codes, see [Bundle Error Codes](../errorcodes/errorcode-bundle.md).
+
+| ID| Error Message |
+| -------- | -------------------------------------- |
+| 17700001 | The specified bundleName is not found. |
+| 17700002 | The specified moduleName is not found. |
+
+**Example**
+
+```ts
+import bundleManager from '@ohos.bundle.bundleManager';
+import hilog from '@ohos.hilog';
+let bundleName = 'com.example.myapplication';
+let moduleName = 'library';
+
+try {
+ bundleManager.getSharedBundleInfo(bundleName, moduleName).then((data) => {
+ hilog.info(0x0000, 'testTag', 'getSharedBundleInfo successfully. Data: %{public}s', JSON.stringify(data));
+ }).catch(err => {
+ hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed. Cause: %{public}s', err.message);
+ });
+} catch (err) {
+ hilog.error(0x0000, 'testTag', 'getSharedBundleInfo failed. Cause: %{public}s', err.message);
+}
+```
+
+### bundleManager.getAllSharedBundleInfo10+
+
+getAllSharedBundleInfo(callback: AsyncCallback\\>): void;
+
+Obtains the information about all shared bundles. This API uses an asynchronous callback to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
+
+**System capability**: SystemCapability.BundleManager.BundleFramework.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| callback | AsyncCallback\\> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **null** and **data** is an array of the shared bundle information obtained.|
+
+**Example**
+
+```ts
+import bundleManager from '@ohos.bundle.bundleManager';
+import hilog from '@ohos.hilog';
+
+try {
+ bundleManager.getAllSharedBundleInfo((err, data) => {
+ if (err) {
+ hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed: %{public}s', err.message);
+ } else {
+ hilog.info(0x0000, 'testTag', 'getAllSharedBundleInfo successfully: %{public}s', JSON.stringify(data));
+ }
+ });
+} catch (err) {
+ hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed: %{public}s', err.message);
+}
+```
+
+### bundleManager.getAllSharedBundleInfo10+
+
+function getAllSharedBundleInfo(): Promise\\>;
+
+Obtains the information about all shared bundles. This API uses a promise to return the result.
+
+**System API**: This is a system API.
+
+**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
+
+**System capability**: SystemCapability.BundleManager.BundleFramework.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------------------ | ----------------------------------- |
+| Promise\\> | Promise used to return an array of the shared bundle information obtained.|
+
+**Example**
+
+```ts
+import bundleManager from '@ohos.bundle.bundleManager';
+import hilog from '@ohos.hilog';
+
+try {
+ bundleManager.getAllSharedBundleInfo().then((data) => {
+ hilog.info(0x0000, 'testTag', 'getAllSharedBundleInfo successfully. Data: %{public}s', JSON.stringify(data));
+ }).catch(err => {
+ hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message);
+ });
+} catch (err) {
+ hilog.error(0x0000, 'testTag', 'getAllSharedBundleInfo failed. Cause: %{public}s', err.message);
+}
+```
+
+## CompatiblePolicy
+
+Defines the version compatibility type of the shared library.
+
+ **System capability**: SystemCapability.BundleManager.BundleFramework.Core
+
+| Name | Value | Description |
+| ---------------------- | ---- | -------------------------------- |
+| BACKWARD_COMPATIBILITY | 1 | The shared library is backward compatible.|
+
## ModuleType
Enumerates the module types.
diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md
index 6b6222abe96a415e28290892f8e6a215c1e98478..b6b2bddb6306e577053b5ea9e34c21acf23c9477 100644
--- a/en/application-dev/reference/apis/js-apis-call.md
+++ b/en/application-dev/reference/apis/js-apis-call.md
@@ -20,6 +20,10 @@ dial\(phoneNumber: string, callback: AsyncCallback\): void
Initiates a call. This API uses an asynchronous callback to return the result.
+>**NOTE**
+>
+>This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9).
+
**Required Permissions**: ohos.permission.PLACE_CALL
**System capability**: SystemCapability.Telephony.CallManager
@@ -46,6 +50,10 @@ dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback**NOTE**
+>
+>This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9).
+
**Required Permissions**: ohos.permission.PLACE_CALL
**System capability**: SystemCapability.Telephony.CallManager
@@ -75,6 +83,10 @@ dial\(phoneNumber: string, options?: DialOptions\): Promise
Initiates a call. You can set call options as needed. This API uses a promise to return the result.
+>**NOTE**
+>
+>This parameter is supported since API version 6 and deprecated since API version 9. You are advised to use [dialCall](#calldialcall9).
+
**Required Permissions**: ohos.permission.PLACE_CALL
**System capability**: SystemCapability.Telephony.CallManager
@@ -121,11 +133,12 @@ Initiates a call. This API uses an asynchronous callback to return the result.
**Parameters**
| Name | Type | Mandatory| Description |
-| ----------- | ---------------------------- | ---- | --------------------------------------- |
+| ----------- | ---------------------------- | ---- | -------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
-| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -140,8 +153,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.dialCall("138xxxxxxxx", (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.dialCall("138xxxxxxxx", (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -161,12 +174,13 @@ Initiates a call. You can set call options as needed. This API uses an asynchron
**Parameters**
| Name | Type | Mandatory| Description |
-| ----------- | ----------------------------------- | ---- | ------------------------------------ |
+| ----------- | ----------------------------------- | ---- | ----------------------------------- |
| phoneNumber | string | Yes | Phone number. |
| options | [DialCallOptions](#dialcalloptions9)| Yes | Call options, which carry other configuration information of the call. |
-| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -186,8 +200,8 @@ call.dialCall("138xxxxxxxx", {
videoState: 0,
dialScene: 0,
dialType: 0,
-}, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+}, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -209,15 +223,16 @@ Initiates a call. You can set call options as needed. This API uses a promise to
| Name | Type | Mandatory| Description |
| ----------- | ----------------------------------- | ---- | -------------------------------------- |
| phoneNumber | string | Yes | Phone number. |
-| options | [DialCallOptions](#dialcalloptions9)| No | Call option, which indicates whether the call is a voice call or video call.|
+| options | [DialCallOptions](#dialcalloptions9)| No | Call options, which carry other configuration information of the call.|
**Return value**
-| Type | Description |
-| ---------------------- | ------------------------------------------------------------ |
-| Promise<void> | Promise used to return the result. |
+| Type | Description |
+| ---------------------- | ---------------------------- |
+| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -232,12 +247,17 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-try {
- call.dialCall('138xxxxxxxx');
- console.log(`dialCall success, promise: data->${JSON.stringify(data)}`);
-} catch (error) {
- console.log(`dialCall fail, promise: err->${JSON.stringify(error)}`);
-}
+let promise = call.dialCall("138xxxxxxxx", {
+ accountId: 0,
+ videoState: 0,
+ dialScene: 0,
+ dialType: 0,
+});
+promise.then(() => {
+ console.log(`dialCall success.`);
+}).catch((err) => {
+ console.error(`dialCall fail, promise: err->${JSON.stringify(err)}`);
+});
```
@@ -257,6 +277,7 @@ Launches the call screen and displays the dialed number. This API uses an asynch
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -297,6 +318,7 @@ Launches the call screen and displays the dialed number. This API uses a promise
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -450,6 +472,7 @@ Checks whether the called number is an emergency number. This API uses an asynch
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. - **true**: The called number is an emergency number. - **false**: The called number is not an emergency number.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -486,6 +509,7 @@ Checks whether the called number is an emergency number based on the phone numbe
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. - **true**: The called number is an emergency number. - **false**: The called number is not an emergency number.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -527,6 +551,7 @@ Checks whether the called number is an emergency number based on the phone numbe
| Promise<boolean> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -566,6 +591,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
| callback | AsyncCallback<string> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -603,6 +629,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
| callback | AsyncCallback<string> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -648,6 +675,7 @@ A formatted phone number is a standard numeric string, for example, 555 0100.
| Promise<string> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -690,6 +718,7 @@ The phone number must match the specified country code. For example, for a China
| callback | AsyncCallback<string> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -735,6 +764,7 @@ All country codes are supported.
| Promise<string> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -775,10 +805,12 @@ Mutes the ringtone while it is playing. It does not work if the ringtone has bee
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
+| 201 | Permission denied. |
| 401 | Parameter error. |
| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
@@ -788,8 +820,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.muteRinger((err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.muteRinger((err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -813,13 +845,12 @@ Mutes the ringtone while it is playing. It does not work if the ringtone has bee
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
-| 401 | Parameter error. |
-| 8300001 | Invalid parameter value. |
| 8300002 | Operation failed. Cannot connect to service. |
| 8300003 | System internal error. |
| 8300999 | Unknown error code. |
@@ -827,16 +858,15 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.muteRinger();
-promise.then(data => {
- console.log(`muteRinger success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.muteRinger().then(() => {
+ console.log(`muteRinger success.`);
+}).catch((err) => {
console.error(`muteRinger fail, promise: err->${JSON.stringify(err)}`);
});
```
-## call.answerCall7+
+## call.answerCall9+
answerCall\(callId: number, callback: AsyncCallback\): void
@@ -856,6 +886,7 @@ Answers a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -870,13 +901,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.answerCall(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.answerCall(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
-## call.answerCall7+
+## call.answerCall9+
answerCall(callId?: number\): Promise
@@ -901,6 +932,7 @@ Answers a call. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -915,10 +947,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.answerCall(1);
-promise.then(data => {
- console.log(`answerCall success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.answerCall(1).then(() => {
+ console.log(`answerCall success.`);
+}).catch((err) => {
console.error(`answerCall fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -943,6 +974,7 @@ Answers a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -957,13 +989,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.answerCall((err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.answerCall((err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
-## call.hangUpCall7+
+## call.hangUpCall9+
hangUpCall\(callId: number, callback: AsyncCallback\): void
@@ -983,6 +1015,7 @@ Ends a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -997,13 +1030,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.hangUpCall(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.hangUpCall(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
-## call.hangUpCall7+
+## call.hangUpCall9+
hangUpCall\(callId?: number\): Promise
@@ -1028,6 +1061,7 @@ Ends a call. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1042,10 +1076,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.hangUpCall(1);
-promise.then(data => {
- console.log(`hangUpCall success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.hangUpCall(1).then(() => {
+ console.log(`hangUpCall success.`);
+}).catch((err) => {
console.error(`hangUpCall fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -1070,6 +1103,7 @@ Ends a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1085,13 +1119,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.hangUpCall((err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.hangUpCall((err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
-## call.rejectCall7+
+## call.rejectCall9+
rejectCall(callId: number, callback: AsyncCallback\): void
@@ -1111,6 +1145,7 @@ Rejects a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1126,13 +1161,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.rejectCall(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.rejectCall(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
-## call.rejectCall7+
+## call.rejectCall9+
rejectCall\(callId: number, options: RejectMessageOptions, callback: AsyncCallback\): void
@@ -1153,6 +1188,7 @@ Rejects a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1170,13 +1206,13 @@ For details about the following error codes, see [Telephony Error Codes](../../r
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
-call.rejectCall(1, rejectMessageOptions, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.rejectCall(1, rejectMessageOptions, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
-## call.rejectCall7+
+## call.rejectCall9+
rejectCall(callId?: number, options?: RejectMessageOptions\): Promise
@@ -1202,6 +1238,7 @@ Rejects a call. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1219,11 +1256,10 @@ For details about the following error codes, see [Telephony Error Codes](../../r
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
-let promise = call.rejectCall(1, rejectMessageOptions);
-promise.then(data => {
- console.log(`rejectCall success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
- console.error(`rejectCall fail, promise: err->${JSON.stringify(err)}`);
+call.reject(1, rejectMessageOptions).then(() => {
+ console.log(`reject success.`);
+}).catch((err) => {
+ console.error(`reject fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -1247,6 +1283,7 @@ Rejects a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1261,8 +1298,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.rejectCall((err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.rejectCall((err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -1287,6 +1324,7 @@ Rejects a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1304,8 +1342,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
let rejectMessageOptions={
messageContent: "Unknown number blocked"
}
-call.rejectCall(rejectMessageOptions, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.rejectCall(rejectMessageOptions, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -1330,6 +1368,7 @@ Holds a call based on the specified call ID. This API uses an asynchronous callb
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1344,8 +1383,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.holdCall(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.holdCall(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -1375,6 +1414,7 @@ Holds a call based on the specified call ID. This API uses a promise to return t
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1389,10 +1429,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.holdCall(1);
-promise.then(data => {
- console.log(`holdCall success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.holdCall(1).then(() => {
+ console.log(`holdCall success.`);
+}).catch((err) => {
console.error(`holdCall fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -1417,6 +1456,7 @@ Unholds a call based on the specified call ID. This API uses an asynchronous cal
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1431,8 +1471,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.unHoldCall(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.unHoldCall(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -1462,6 +1502,7 @@ Unholds a call based on the specified call ID. This API uses a promise to return
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1476,10 +1517,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.unHoldCall(1);
-promise.then(data => {
- console.log(`unHoldCall success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.unHoldCall(1).then(() => {
+ console.log(`unHoldCall success.`);
+}).catch((err) => {
console.error(`unHoldCall fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -1504,6 +1544,7 @@ Switches a call. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1518,8 +1559,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.switchCall(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.switchCall(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -1549,6 +1590,7 @@ Switches a call. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1563,10 +1605,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.switchCall(1);
-promise.then(data => {
- console.log(`switchCall success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.switchCall(1).then(() => {
+ console.log(`switchCall success.`);
+}).catch((err) => {
console.error(`switchCall fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -1589,6 +1630,7 @@ Combines two calls into a conference call. This API uses an asynchronous callbac
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1602,8 +1644,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.combineConference(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.combineConference(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -1631,6 +1673,7 @@ Combines two calls into a conference call. This API uses a promise to return the
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1644,10 +1687,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.combineConference(1);
-promise.then(data => {
- console.log(`combineConference success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.combineConference(1).then(() => {
+ console.log(`combineConference success.`);
+}).catch((err) => {
console.error(`combineConference fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -1670,6 +1712,7 @@ Obtains the main call ID. This API uses an asynchronous callback to return the r
| callback | AsyncCallback<number> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1713,6 +1756,7 @@ Obtains the main call ID. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1752,6 +1796,7 @@ Obtains the list of subcall IDs. This API uses an asynchronous callback to retur
| callback | AsyncCallback\> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1794,6 +1839,7 @@ Obtains the list of subcall IDs. This API uses a promise to return the result.
| Promise<Array> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1833,6 +1879,7 @@ Obtains the list of call IDs in a conference. This API uses an asynchronous call
| callback | AsyncCallback<Array> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1875,6 +1922,7 @@ Obtains the list of call IDs in a conference. This API uses a promise to return
| Promise<Array> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1916,6 +1964,7 @@ Obtains the call waiting status. This API uses an asynchronous callback to retur
| callback | AsyncCallback<[CallWaitingStatus](#callwaitingstatus7)\> | Yes | Callback used to return the result.
- **0**: Call waiting is disabled. - **1**: Call waiting is enabled.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -1961,6 +2010,7 @@ Obtains the call waiting status. This API uses a promise to return the result.
| Promise<[CallWaitingStatus](#callwaitingstatus7)> | Promise used to return the result. - **0**: Call waiting is disabled. - **1**: Call waiting is enabled.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2004,6 +2054,7 @@ Sets the call waiting switch. This API uses an asynchronous callback to return t
| callback | AsyncCallback | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2018,8 +2069,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.setCallWaiting(0, true, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.setCallWaiting(0, true, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -2050,6 +2101,7 @@ Sets the call waiting switch. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2064,10 +2116,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.setCallWaiting(0, true);
-promise.then(data => {
- console.log(`setCallWaiting success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.setCallWaiting(0, true).then(() => {
+ console.log(`setCallWaiting success.`);
+}).catch((err) => {
console.error(`setCallWaiting fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -2091,6 +2142,7 @@ Enables DTMF. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2104,8 +2156,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.startDTMF(1, "0", (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.startDTMF(1, "0", (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -2134,6 +2186,7 @@ Enables DTMF. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2147,10 +2200,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.startDTMF(1, "0");
-promise.then(data => {
- console.log(`startDTMF success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.startDTMF(1, "0").then(() => {
+ console.log(`startDTMF success.`);
+}).catch((err) => {
console.error(`startDTMF fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -2173,6 +2225,7 @@ Stops DTMF. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2186,8 +2239,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.stopDTMF(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.stopDTMF(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -2215,6 +2268,7 @@ Stops DTMF. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2228,10 +2282,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.stopDTMF(1);
-promise.then(data => {
- console.log(`stopDTMF success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.stopDTMF(1).then(() => {
+ console.log(`stopDTMF success.`);
+}).catch((err) => {
console.error(`stopDTMF fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -2255,6 +2308,7 @@ Checks whether a call is an emergency call. This API uses an asynchronous callba
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2294,6 +2348,7 @@ Checks whether a call is an emergency call. This API uses a promise to return th
| Promise<boolean> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2332,10 +2387,11 @@ Subscribes to **callDetailsChange** events. This API uses an asynchronous callba
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------- | ---- | -------------------------- |
-| type | string | Yes | Call details change during a call.|
-| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. |
+| type | string | Yes | Event type. This field has a fixed value of **callDetailsChange**.|
+| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2371,10 +2427,11 @@ Subscribes to **callEventChange** events. This API uses an asynchronous callback
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | -------------------------- |
-| type | string | Yes | Call event change during a call.|
+| type | string | Yes | This interface is used to monitor the change of call events during a call. The parameter has a fixed value of callEventChange.|
| callback | Callback<[CallEventOptions](#calleventoptions8)> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2410,10 +2467,11 @@ Subscribes to **callDisconnectedCause** events. This API uses an asynchronous ca
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------------ | ---- | -------------------------- |
-| type | string | Yes | Cause of the call disconnection.|
+| type | string | Yes | Event type. The field has a fixed value of **callDisconnectedCause**.|
| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2449,10 +2507,11 @@ Subscribes to **mmiCodeResult** events. This API uses an asynchronous callback t
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------- | ---- | --------------------- |
-| type | string | Yes | Man-machine interface (MMI) code result.|
+| type | string | Yes | Event type. The field has a fixed value of **mmiCodeResult**.|
| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2488,10 +2547,11 @@ Unsubscribes from **callDetailsChange** events. This API uses an asynchronous ca
| Name | Type | Mandatory| Description |
| -------- | -------------------------------------------------------- | ---- | ---------------------------------- |
-| type | string | Yes | IMS registration status changes.|
+| type | string | Yes | Event type. The field has a fixed value of **callDetailsChange**.|
| callback | Callback<[CallAttributeOptions](#callattributeoptions7)> | No | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2527,10 +2587,11 @@ Unsubscribes from **callEventChange** events. This API uses an asynchronous call
| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ---------------------------------- |
-| type | string | Yes | Unsubscription from call event changes when a call ends.|
+| type | string | Yes | Event type. The field has a fixed value of **callEventChange**.|
| callback | Callback<[CallEventOptions](#calleventoptions8)> | No | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2565,11 +2626,12 @@ Unsubscribes from **callDisconnectedCause** events. This API uses an asynchronou
**Parameters**
| Name | Type | Mandatory| Description |
-| -------- | ---------------------------------------------------------- | ---- | -------------------- |
-| type | 'callDisconnectedCause' | Yes | Unsubscription from the call disconnection cause when a call ends.|
-| callback | Callback**<**[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. |
+| -------- | ---------------------------------------------------------- | ---- | ------------------- |
+| type | string | Yes | Event type. The field has a fixed value of **callDisconnectedCause**.|
+| callback | Callback<[DisconnectedDetails](#disconnecteddetails9)> | No | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2603,12 +2665,13 @@ Unsubscribes from **mmiCodeResult** events. This API uses an asynchronous callba
**Parameters**
-| Name | Type | Mandatory| Description |
+| Name | Type | Mandatory| Description |
| -------- | ------------------------------------------------ | ---- | ----------- |
-| type | 'mmiCodeResult' | Yes | MMI code result.|
-| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. |
+| type | string | Yes | Event type. The field has a fixed value of **mmiCodeResult**.|
+| callback | Callback<[MmiCodeResults](#mmicoderesults9)> | No | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2645,6 +2708,7 @@ Checks whether a new call is allowed. This API uses an asynchronous callback to
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2681,6 +2745,7 @@ Checks whether a new call is allowed. This API uses a promise to return the resu
| Promise<boolean> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2720,6 +2785,7 @@ Separates calls from a conference call. This API uses an asynchronous callback t
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2733,8 +2799,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.separateConference(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.separateConference(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -2762,6 +2828,7 @@ Separates calls from a conference call. This API uses a promise to return the re
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2775,10 +2842,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.separateConference(1);
-promise.then(data => {
- console.log(`separateConference success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.separateConference(1).then(() => {
+ console.log(`separateConference success.`);
+}).catch((err) => {
console.error(`separateConference fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -2804,6 +2870,7 @@ Obtains the call restriction status. This API uses an asynchronous callback to r
| callback | AsyncCallback<[RestrictionStatus](#restrictionstatus8)> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2850,6 +2917,7 @@ Obtains the call restriction status. This API uses a promise to return the resul
| Promise<[RestrictionStatus](#restrictionstatus8)> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2893,6 +2961,7 @@ Sets the call restriction status. This API uses an asynchronous callback to retu
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2912,8 +2981,8 @@ let callRestrictionInfo={
password: "123456",
mode: 1
}
-call.setCallRestriction(0, callRestrictionInfo, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.setCallRestriction(0, callRestrictionInfo, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -2944,6 +3013,7 @@ Sets the call restriction status. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -2963,10 +3033,9 @@ let callRestrictionInfo={
password: "123456",
mode: 1
}
-let promise = call.setCallRestriction(0, callRestrictionInfo);
-promise.then(data => {
- console.log(`setCallRestriction success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.setCallRestriction(0, callRestrictionInfo).then(() => {
+ console.log(`setCallRestriction success.`);
+}).catch((err) => {
console.error(`setCallRestriction fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -2992,6 +3061,7 @@ Obtains call transfer information. This API uses an asynchronous callback to ret
| callback | AsyncCallback<[CallTransferResult](#calltransferresult8)> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3038,6 +3108,7 @@ Obtains call transfer information. This API uses a promise to return the result.
| Promise<[CallTransferResult](#calltransferresult8)> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3081,6 +3152,7 @@ Sets call transfer information. This API uses an asynchronous callback to return
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3100,8 +3172,8 @@ let callTransferInfo={
type: 1,
settingType: 1
}
-call.setCallTransfer(0, callTransferInfo, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.setCallTransfer(0, callTransferInfo, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3132,6 +3204,7 @@ Sets call transfer information. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3151,10 +3224,9 @@ let callTransferInfo={
type: 1,
settingType: 1
}
-let promise = call.setCallTransfer(0, callTransferInfo);
-promise.then(data => {
- console.log(`setCallTransfer success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.setCallTransfer(0, callTransferInfo).then(() => {
+ console.log(`setCallTransfer success.`);
+}).catch((err) => {
console.error(`setCallTransfer fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -3178,6 +3250,7 @@ Checks whether the ringtone is playing. This API uses an asynchronous callback t
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3217,6 +3290,7 @@ Checks whether the ringtone is playing. This API uses a promise to return the re
| Promise<boolean> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3256,6 +3330,7 @@ Sets call muting. This API uses an asynchronous callback to return the result.
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3269,8 +3344,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.setMuted((err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.setMuted((err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3292,6 +3367,7 @@ Sets call muting. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3305,10 +3381,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.setMuted();
-promise.then(data => {
- console.log(`setMuted success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.setMuted().then(() => {
+ console.log(`setMuted success.`);
+}).catch((err) => {
console.error(`setMuted fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -3330,6 +3405,7 @@ Cancels call muting. This API uses an asynchronous callback to return the result
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3343,8 +3419,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.cancelMuted((err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.cancelMuted((err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3366,6 +3442,7 @@ Cancels call muting. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3379,10 +3456,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.cancelMuted();
-promise.then(data => {
- console.log(`cancelMuted success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.cancelMuted().then(() => {
+ console.log(`cancelMuted success.`);
+}).catch((err) => {
console.error(`cancelMuted fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -3405,6 +3481,7 @@ Sets the audio device for a call. This API uses an asynchronous callback to retu
| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3418,8 +3495,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.setAudioDevice(1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.setAudioDevice(1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3443,6 +3520,7 @@ Sets the audio device for a call based on the specified options. This API uses a
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3459,8 +3537,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
let audioDeviceOptions={
bluetoothAddress: "IEEE 802-2014"
}
-call.setAudioDevice(1, audioDeviceOptions, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.setAudioDevice(1, audioDeviceOptions, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3489,6 +3567,7 @@ Sets the audio device for a call based on the specified options. This API uses a
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3505,10 +3584,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
let audioDeviceOptions={
bluetoothAddress: "IEEE 802-2014"
}
-let promise = call.setAudioDevice(1, audioDeviceOptions);
-promise.then(data => {
- console.log(`setAudioDevice success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.setAudioDevice(1, audioDeviceOptions).then(() => {
+ console.log(`setAudioDevice success.`);
+}).catch((err) => {
console.error(`setAudioDevice fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -3532,6 +3610,7 @@ Joins a conference call. This API uses an asynchronous callback to return the re
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3548,8 +3627,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
let callNumberList: Array = [
"138XXXXXXXX"
];
-call.joinConference(1, callNumberList, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.joinConference(1, callNumberList, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3577,6 +3656,7 @@ Joins a conference call. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3593,10 +3673,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
let callNumberList: Array = [
"138XXXXXXXX"
];
-let promise = call.joinConference(1, callNumberList);
-promise.then(data => {
- console.log(`joinConference success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.joinConference(1, callNumberList).then(() => {
+ console.log(`joinConference success.`);
+}).catch((err) => {
console.error(`joinConference fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -3620,6 +3699,7 @@ Updates the IMS call mode. This API uses an asynchronous callback to return the
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3633,8 +3713,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.updateImsCallMode(1, 1, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.updateImsCallMode(1, 1, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3662,6 +3742,7 @@ Updates the IMS call mode. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3675,10 +3756,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.updateImsCallMode(1, 1);
-promise.then(data => {
- console.log(`updateImsCallMode success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.updateImsCallMode(1, 1).then(() => {
+ console.log(`updateImsCallMode success.`);
+}).catch((err) => {
console.error(`updateImsCallMode fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -3703,6 +3783,7 @@ Enables the IMS switch. This API uses an asynchronous callback to return the res
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3717,8 +3798,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.enableImsSwitch(0, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.enableImsSwitch(0, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3747,6 +3828,7 @@ Enables the IMS switch. This API uses a promise to return the result.
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3761,10 +3843,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.enableImsSwitch(0);
-promise.then(data => {
- console.log(`enableImsSwitch success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.enableImsSwitch(0).then(() => {
+ console.log(`enableImsSwitch success.`);
+}).catch((err) => {
console.error(`enableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -3789,6 +3870,7 @@ Disables the IMS switch. This API uses an asynchronous callback to return the re
| callback | AsyncCallback<void> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3803,8 +3885,8 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-call.disableImsSwitch(0, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+call.disableImsSwitch(0, (err) => {
+ console.log(`callback: err->${JSON.stringify(err)}`);
});
```
@@ -3822,20 +3904,21 @@ Disables the IMS switch. This API uses a promise to return the result.
**Parameters**
-| Name| Type | Mandatory| Description |
+| Name| Type | Mandatory| Description |
| ------ | ------ | ---- | -------------------------------------- |
-| slotId | number | Yes | Card slot ID. - **0**: card slot 1 - **1**: card slot 2|
+| slotId | number | Yes | Card slot ID. - **0**: card slot 1 - **1**: card slot 2 |
**Return value**
-| Type | Description |
+| Type | Description |
| ------------------- | --------------------------- |
-| Promise<void> | Promise used to return the result.|
+| Promise<void> | Promise used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
-| ID| Error Message |
+| ID| Error Message |
| -------- | -------------------------------------------- |
| 201 | Permission denied. |
| 401 | Parameter error. |
@@ -3847,10 +3930,9 @@ For details about the following error codes, see [Telephony Error Codes](../../r
**Example**
```js
-let promise = call.disableImsSwitch(0);
-promise.then(data => {
- console.log(`disableImsSwitch success, promise: data->${JSON.stringify(data)}`);
-}).catch(err => {
+call.disableImsSwitch(0).then(() => {
+ console.log(`disableImsSwitch success.`);
+}).catch((err) => {
console.error(`disableImsSwitch fail, promise: err->${JSON.stringify(err)}`);
});
```
@@ -3873,6 +3955,7 @@ Checks whether the IMS switch is enabled. This API uses an asynchronous callback
| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. |
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
@@ -3914,6 +3997,7 @@ Checks whether the IMS switch is enabled. This API uses a promise to return the
| Promise<void> | Promise used to return the result.|
**Error codes**
+
For details about the following error codes, see [Telephony Error Codes](../../reference/errorcodes/errorcode-telephony.md).
| ID| Error Message |
diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md
index ec4684a53f03a85706e29f6fc918371ab54d5363..4238ee5df2b8a9bf894b83d23b9fcb11ddb9325d 100644
--- a/en/application-dev/reference/apis/js-apis-camera.md
+++ b/en/application-dev/reference/apis/js-apis-camera.md
@@ -31,6 +31,15 @@ Obtains a **CameraManager** instance. This API returns the result synchronously.
| ----------------------------------------------- | ---------------------------- |
| [CameraManager](#cameramanager) | **CameraManager** instance obtained. |
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -255,6 +264,14 @@ Creates a **CameraInput** instance with the specified **CameraDevice** object. T
| ---------- | ----------------------------- |
| [CameraInput](#camerainput) | **CameraInput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+
**Example**
```js
@@ -291,6 +308,14 @@ Creates a **CameraInput** instance with the specified camera position and type.
| ---------- | ----------------------------- |
| [CameraInput](#camerainput) | **CameraInput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+
**Example**
```js
@@ -327,6 +352,14 @@ Creates a **PreviewOutput** instance. This API returns the result synchronously.
| ---------- | ----------------------------- |
| [PreviewOutput](#previewoutput) | **PreviewOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+
**Example**
```js
@@ -361,6 +394,14 @@ Creates a **PhotoOutput** instance. This API returns the result synchronously.
| ---------- | ----------------------------- |
| [PhotoOutput](#photooutput) | **PhotoOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+
**Example**
```js
@@ -395,6 +436,14 @@ Creates a **VideoOutput** instance. This API returns the result synchronously.
| ---------- | ----------------------------- |
| [VideoOutput](#videooutput) | **VideoOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+
**Example**
```js
@@ -428,6 +477,14 @@ Creates a **MetadataOutput** instance. This API returns the result synchronously
| ---------- | ----------------------------- |
| [MetadataOutput](#metadataoutput) | **MetadataOutput** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+
**Example**
```js
@@ -455,6 +512,14 @@ Creates a **CaptureSession** instance. This API returns the result synchronously
| ---------- | ----------------------------- |
| [CaptureSession](#capturesession) | **CaptureSession** instance created. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -630,6 +695,16 @@ Opens this camera. This API uses an asynchronous callback to return the result.
| -------- | -------------------- | ---- | ------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400107 | Can not use camera cause of conflict. |
+| 7400108 | Camera disabled cause of security reason. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -656,6 +731,16 @@ Opens this camera. This API uses a promise to return the result.
| -------------- | ----------------------- |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400107 | Can not use camera cause of conflict. |
+| 7400108 | Camera disabled cause of security reason. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -680,6 +765,14 @@ Closes this camera. This API uses an asynchronous callback to return the result.
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -706,6 +799,14 @@ Closes this camera. This API uses a promise to return the result.
| -------------- | ----------------------- |
| Promise| Promise used to return the result.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -823,6 +924,14 @@ Starts configuration for the session.
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400105 | Session config locked. |
+
**Example**
```js
@@ -848,6 +957,15 @@ Commits the configuration for this **CaptureSession** instance. This API uses an
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400102 | Operation not allow. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -874,6 +992,15 @@ Commits the configuration for this **CaptureSession** instance. This API uses a
| -------------- | ------------------------ |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400102 | Operation not allow. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -905,6 +1032,15 @@ Adds a [CameraInput](#camerainput) instance to the session.
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+| 7400102 | Operation not allow. |
+
**Example**
```js
@@ -936,6 +1072,15 @@ Removes a [CameraInput](#camerainput) instance from the session.
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+| 7400102 | Operation not allow. |
+
**Example**
```js
@@ -967,6 +1112,15 @@ Adds a [CameraOutput](#cameraoutput) instance to the session.
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+| 7400102 | Operation not allow. |
+
**Example**
```js
@@ -998,6 +1152,15 @@ Removes a [CameraOutput](#cameraoutput) instance from the session.
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+| 7400102 | Operation not allow. |
+
**Example**
```js
@@ -1023,6 +1186,15 @@ Starts this **CaptureSession**. This API uses an asynchronous callback to return
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -1049,6 +1221,15 @@ Starts this **CaptureSession**. This API uses a promise to return the result.
| -------------- | ------------------------ |
| Promise| Promise used to return the result.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -1073,6 +1254,14 @@ Stops this **CaptureSession**. This API uses an asynchronous callback to return
| -------- | -------------------- | ---- | ------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -1099,6 +1288,14 @@ Stops this **CaptureSession**. This API uses a promise to return the result.
| -------------- | ----------------------- |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -1123,6 +1320,14 @@ Releases this **CaptureSession**. This API uses an asynchronous callback to retu
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -1149,6 +1354,14 @@ Releases this **CaptureSession**. This API uses a promise to return the result.
| -------------- | ------------------------ |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -1173,6 +1386,14 @@ Checks whether the device has flash. This API uses an asynchronous callback to r
| ---------- | ----------------------------- |
| boolean | Returns **true** if the device has flash; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1204,6 +1425,14 @@ Checks whether a flash mode is supported.
| ---------- | ----------------------------- |
| boolean | Returns **true** if the flash mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1240,6 +1469,14 @@ Before the setting, do the following checks:
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1265,6 +1502,14 @@ Obtains the flash mode in use.
| ---------- | ----------------------------- |
| [FlashMode](#flashmode) | Flash mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1296,6 +1541,14 @@ Checks whether an exposure mode is supported.
| ---------- | ----------------------------- |
| boolean | Returns **true** if the exposure mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1321,6 +1574,14 @@ Obtains the exposure mode in use.
| ---------- | ----------------------------- |
| [ExposureMode](#exposuremode) | Exposure mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1352,6 +1613,14 @@ Sets an exposure mode for the device.
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1377,6 +1646,14 @@ Obtains the metering point of the device.
| ---------- | ----------------------------- |
| [Point](#point) | Metering point obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1410,6 +1687,14 @@ The coordinate system is based on the horizontal device direction with the devic
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1436,6 +1721,14 @@ Obtains the exposure compensation values of the device.
| ---------- | ----------------------------- |
| Array | An array of compensation values. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1463,6 +1756,14 @@ Before the setting, you are advised to use **[getExposureBiasRange](#getexposure
| -------- | -------------------------------| ---- | ------------------- |
| exposureBias | number | Yes | Exposure bias to set, which must be within the range obtained by running **getExposureBiasRange** interface. If the API call fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1489,6 +1790,14 @@ Obtains the exposure value in use.
| ---------- | ----------------------------- |
| number | Exposure value obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1520,6 +1829,14 @@ Checks whether a focus mode is supported.
| ---------- | ----------------------------- |
| boolean | Returns **true** if the focus mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1553,6 +1870,14 @@ Before the setting, use **[isFocusModeSupported](#isfocusmodesupported)** to che
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1578,6 +1903,14 @@ Obtains the focus mode in use.
| ---------- | ----------------------------- |
| [FocusMode](#focusmode) | Focus mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1611,6 +1944,14 @@ The coordinate system is based on the horizontal device direction with the devic
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1637,6 +1978,14 @@ Obtains the focal point of the device.
| ---------- | ----------------------------- |
| [Point](#point) | Focal point obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1662,6 +2011,14 @@ Obtains the focal length of the device.
| ---------- | ----------------------------- |
| number | Focal length obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1687,6 +2044,14 @@ Obtains the supported zoom ratio range.
| ---------- | ----------------------------- |
| Array | Callback used to return an array containing the minimum and maximum zoom ratios. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1718,6 +2083,14 @@ Sets a zoom ratio, with a maximum precision of two decimal places.
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1744,6 +2117,14 @@ Obtains the zoom ratio in use.
| ---------- | ----------------------------- |
| number | Zoom ratio obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1775,6 +2156,14 @@ Checks whether the specified video stabilization mode is supported.
| ---------- | ----------------------------- |
| boolean | Returns **true** if the video stabilization mode is supported; returns **false** otherwise. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1800,6 +2189,14 @@ Obtains the video stabilization mode in use.
| ---------- | ----------------------------- |
| VideoStabilizationMode | Video stabilization mode obtained. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1831,6 +2228,14 @@ Sets a video stabilization mode for the device.
| ---------- | ----------------------------- |
| [CameraErrorCode](#cameraerrorcode) | If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1910,6 +2315,14 @@ Starts to output preview streams. This API uses an asynchronous callback to retu
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -1936,6 +2349,14 @@ Starts to output preview streams. This API uses a promise to return the result.
| -------------- | ----------------------- |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+
**Example**
```js
@@ -2010,6 +2431,14 @@ Releases output resources. This API uses an asynchronous callback to return the
| -------- | -------------------- | ---- | ------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2036,6 +2465,14 @@ Releases output resources. This API uses a promise to return the result.
| -------------- | ----------------------- |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2184,6 +2621,15 @@ Captures a photo with the default shooting parameters. This API uses an asynchro
| -------- | -------------------- | ---- | ------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400104 | Session not running. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2210,6 +2656,15 @@ Captures a photo with the default shooting parameters. This API uses a promise t
| -------------- | ------------------------ |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400104 | Session not running. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2235,6 +2690,16 @@ Captures a photo with the specified shooting parameters. This API uses an asynch
| setting | [PhotoCaptureSetting](#photocapturesetting) | Yes | Shooting settings. |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned. |
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+| 7400104 | Session not running. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2278,6 +2743,15 @@ Captures a photo with the specified shooting parameters. This API uses a promise
| -------------- | ------------------------ |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400101 | Parameter missing or parameter type incorrect |
+| 7400104 | Session not running. |
+| 7400201 | Camera service fatal error. |
**Example**
@@ -2323,6 +2797,14 @@ Releases output resources. This API uses an asynchronous callback to return the
| -------- | -------------------- | ---- | ------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2349,6 +2831,14 @@ Releases output resources. This API uses a promise to return the result.
| -------------- | ----------------------- |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2493,6 +2983,15 @@ Starts video recording. This API uses an asynchronous callback to return the res
| -------- | -------------------- | ---- | -------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2519,6 +3018,14 @@ Starts video recording. This API uses a promise to return the result.
| -------------- | ----------------------- |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+| 7400201 | Camera service fatal error. |
**Example**
@@ -2594,6 +3101,14 @@ Releases output resources. This API uses an asynchronous callback to return the
| -------- | -------------------- | ---- | ------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2620,6 +3135,14 @@ Releases output resources. This API uses a promise to return the result.
| -------------- | ----------------------- |
| Promise| Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2717,6 +3240,15 @@ Starts to output metadata. This API uses an asynchronous callback to return the
| -------- | -------------------------- | ---- | ------------------- |
| callback | AsyncCallback | Yes | Callback used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
@@ -2743,6 +3275,15 @@ Starts to output metadata. This API uses a promise to return the result.
| ---------------------- | ------------------------ |
| Promise | Promise used to return the result. If the operation fails, an error code defined in [CameraErrorCode](#cameraerrorcode) is returned.|
+**Error codes**
+
+For details about the error codes, see [CameraErrorCode](#cameraerrorcode).
+
+| ID | Error Message |
+| --------------- | --------------- |
+| 7400103 | Session not config. |
+| 7400201 | Camera service fatal error. |
+
**Example**
```js
diff --git a/en/application-dev/reference/apis/js-apis-commonEventManager.md b/en/application-dev/reference/apis/js-apis-commonEventManager.md
index 8f150f4bbf02a8c11f81beddecd2e7edf89ab431..c94524533f8795ee22ebb328ce7ecd1f2ce1ad2c 100644
--- a/en/application-dev/reference/apis/js-apis-commonEventManager.md
+++ b/en/application-dev/reference/apis/js-apis-commonEventManager.md
@@ -86,8 +86,8 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco
```ts
// Attributes of a common event.
let options = {
- code: 0, // Initial code of the common event.
- data: "initial data",// Initial data of the common event.
+ code: 0, // Result code of the common event.
+ data: "initial data",// Result data of the common event.
isOrdered: true // The common event is an ordered one.
}
@@ -186,8 +186,8 @@ For details about the error codes, see [Event Error Codes](../errorcodes/errorco
```ts
// Attributes of a common event.
let options = {
- code: 0, // Initial code of the common event.
- data: "initial data",// Initial data of the common event.
+ code: 0, // Result code of the common event.
+ data: "initial data",// Result data of the common event.
}
// Callback for common event publication.
@@ -224,7 +224,7 @@ Creates a subscriber. This API uses an asynchronous callback to return the resul
| Name | Type | Mandatory| Description |
| ------------- | ------------------------------------------------------------ | ---- | -------------------------- |
-| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information. |
+| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information. |
| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | Yes | Callback used to return the result.|
**Example**
@@ -270,7 +270,7 @@ Creates a subscriber. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| ------------- | ----------------------------------------------------- | ---- | -------------- |
-| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information.|
+| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | Yes | Subscriber information.|
**Return value**
| Type | Description |
@@ -327,7 +327,7 @@ let subscribeInfo = {
// Callback for common event subscription.
function SubscribeCB(err, data) {
- if (err.code) {
+ if (err) {
console.error(`subscribe failed, code is ${err.code}, message is ${err.message}`);
} else {
console.info("subscribe ");
diff --git a/en/application-dev/reference/apis/js-apis-contact.md b/en/application-dev/reference/apis/js-apis-contact.md
index 2778a143c65125eca650324e67a220ab60f64ead..bcc8b36fc9a93191258ed78edb68df61ccce4c28 100644
--- a/en/application-dev/reference/apis/js-apis-contact.md
+++ b/en/application-dev/reference/apis/js-apis-contact.md
@@ -166,6 +166,7 @@ Updates a contact based on the specified contact information. This API uses an a
```js
contact.updateContact({
+ id: 1,
name: {fullName: 'xxx'},
phoneNumbers: [{phoneNumber: '138xxxxxxxx'}]
}, (err) => {
@@ -200,6 +201,7 @@ Updates a contact based on the specified contact information and attributes. Thi
```js
contact.updateContact({
+ id: 1,
name: {fullName: 'xxx'},
phoneNumbers: [{phoneNumber: '138xxxxxxxx'}]
}, {
@@ -241,6 +243,7 @@ Updates a contact based on the specified contact information and attributes. Thi
```js
let promise = contact.updateContact({
+ id: 1,
name: {fullName: 'xxx'},
phoneNumbers: [{phoneNumber: '138xxxxxxxx'}]
}, {
diff --git a/en/application-dev/reference/apis/js-apis-data-relationalStore.md b/en/application-dev/reference/apis/js-apis-data-relationalStore.md
index 1b9948db2d3decf6b7d21d17cb74b53450ae3865..e49fa27eb58c01d5ccfaa905159c9124f7812687 100644
--- a/en/application-dev/reference/apis/js-apis-data-relationalStore.md
+++ b/en/application-dev/reference/apis/js-apis-data-relationalStore.md
@@ -8,7 +8,7 @@ The **relationalStore** module provides the following functions:
- [RdbStore](#rdbstore): provides APIs for managing data in an RDB store.
- [Resultset](#resultset): provides APIs for accessing the result set obtained from the RDB store.
-> **NOTE**
+> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -30,7 +30,7 @@ Obtains an RDB store. This API uses an asynchronous callback to return the resul
| Name | Type | Mandatory| Description |
| -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).|
| config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. |
| callback | AsyncCallback<[RdbStore](#rdbstore)> | Yes | Callback invoked to return the RDB store obtained. |
@@ -108,7 +108,7 @@ Obtains an RDB store. This API uses a promise to return the result. You can set
| Name | Type | Mandatory| Description |
| ------- | -------------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).|
| config | [StoreConfig](#storeconfig) | Yes | Configuration of the RDB store. |
**Return value**
@@ -188,7 +188,7 @@ Deletes an RDB store. This API uses an asynchronous callback to return the resul
| Name | Type | Mandatory| Description |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).|
| name | string | Yes | Name of the RDB store to delete. |
| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
@@ -249,7 +249,7 @@ Deletes an RDB store. This API uses a promise to return the result.
| Name | Type | Mandatory| Description |
| ------- | ------- | ---- | ------------------------------------------------------------ |
-| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-ability-context.md).|
+| context | Context | Yes | Application context. For details about the application context of the FA model, see [Context](js-apis-inner-app-context.md). For details about the application context of the stage model, see [Context](js-apis-inner-application-uiAbilityContext.md).|
| name | string | Yes | Name of the RDB store to delete. |
**Return value**
@@ -2612,9 +2612,9 @@ Synchronizes data between devices. This API uses a promise to return the result.
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.inDevices(['12345678abcde']);
let promise = store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates);
-promise.then((resultSet) =>{
+promise.then((result) =>{
console.info(`Sync done.`);
- for (let i = 0; i < resultSet.length; i++) {
+ for (let i = 0; i < result.length; i++) {
console.info(`device= ${result[i][0]}, status= ${result[i][1]}`);
}
}).catch((err) => {
@@ -2693,10 +2693,12 @@ Provides APIs to access the result set obtained by querying the RDB store. A res
Obtain the **resultSet** object first.
```js
+let resultSet = null;
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("AGE", 18);
let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
-promise.then((resultSet) => {
+promise.then((result) => {
+ resultSet = result;
console.info(`resultSet columnNames: ${resultSet.columnNames}`);
console.info(`resultSet columnCount: ${resultSet.columnCount}`);
});
@@ -2867,7 +2869,7 @@ For details about the error codes, see [RDB Error Codes](../errorcodes/errorcode
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => {
- resultSet.(5);
+ resultSet.goToRow(5);
resultSet.close();
}).catch((err) => {
console.error(`query failed, err: ${err}`);
diff --git a/en/application-dev/reference/apis/js-apis-device-manager.md b/en/application-dev/reference/apis/js-apis-device-manager.md
index bd78aa4b4965436b5a570e69d62bbbd522b9d710..5d6b71b99b23044250b231f34630a973f0705515 100644
--- a/en/application-dev/reference/apis/js-apis-device-manager.md
+++ b/en/application-dev/reference/apis/js-apis-device-manager.md
@@ -96,7 +96,7 @@ Enumerates the device types.
| CAR | 0x83 | Car. |
| UNKNOWN_TYPE | 0 | Unknown device type.|
-## AuthForm
+## AuthForm10+
Enumerates the device authentication types.
@@ -262,8 +262,6 @@ getTrustedDeviceListSync(): Array<DeviceInfo>
Obtains all trusted devices synchronously.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value**
@@ -296,8 +294,6 @@ getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): voi
Obtains all trusted devices. This API uses an asynchronous callback to return the result.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -336,8 +332,6 @@ getTrustedDeviceList(): Promise<Array<DeviceInfo>>
Obtains all trusted devices. This API uses a promise to return the result.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value**
@@ -370,8 +364,6 @@ getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo)
Obtains local device information synchronously.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value**
@@ -404,8 +396,6 @@ getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void
Obtains local device information. This API uses an asynchronous callback to return the result.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -444,8 +434,6 @@ getLocalDeviceInfo(): Promise<DeviceInfo>
Obtains local device information. This API uses a promise to return the result.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Return value**
@@ -478,8 +466,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
Starts to discover peripheral devices.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -524,8 +510,6 @@ startDeviceDiscovery(subscribeInfo: SubscribeInfo, filterOptions?: string): void
Starts to discover peripheral devices and filters discovered devices.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -580,8 +564,6 @@ stopDeviceDiscovery(subscribeId: number): void
Stops device discovery.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -616,8 +598,6 @@ publishDeviceDiscovery(publishInfo: PublishInfo): void
Publishes device information for discovery purposes.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -659,8 +639,6 @@ unPublishDeviceDiscovery(publishId: number): void
Stops publishing device information.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -695,8 +673,6 @@ authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: Async
Authenticates a device.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -757,8 +733,6 @@ unAuthenticateDevice(deviceInfo: DeviceInfo): void
Deauthenticates a device.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -798,8 +772,6 @@ verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string,
Verifies authentication information.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -844,8 +816,6 @@ setUserOperation(operateAction: number, params: string): void;
Sets a user operation.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -880,8 +850,6 @@ requestCredentialRegisterInfo(requestInfo: string, callback: AsyncCallback<{regi
Obtains the registration information of the credential.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -917,8 +885,6 @@ importCredential(credentialInfo: string, callback: AsyncCallback<{resultInfo: st
Imports credential information.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -970,8 +936,6 @@ deleteCredential(queryInfo: string, callback: AsyncCallback<{resultInfo: string}
Deletes credential information.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1008,8 +972,6 @@ on(type: 'uiStateChange', callback: Callback<{ param: string}>): void;
Subscribes to UI status changes.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1040,8 +1002,6 @@ off(type: 'uiStateChange', callback?: Callback<{ param: string}>): void;
Unsubscribes from UI status changes.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1067,8 +1027,6 @@ on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChange
Subscribes to changes in the device state.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1096,8 +1054,6 @@ off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChang
Unsubscribes from changes in the device state.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1125,8 +1081,6 @@ on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: Dev
Subscribes to device discovery events.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1154,8 +1108,6 @@ off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: D
Unsubscribes from device discovery events.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1183,8 +1135,6 @@ on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: nu
Subscribes to device discovery failures.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1212,8 +1162,6 @@ off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason:
Unsubscribes from device discovery failures.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1241,8 +1189,6 @@ on(type: 'publishSuccess', callback: Callback<{ publishId: number }>): voi
Subscribes to device information publication success events.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1271,8 +1217,6 @@ off(type: 'publishSuccess', callback?: Callback<{ publishId: number }>): v
Unsubscribes from device information publication success events.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1300,8 +1244,6 @@ on(type: 'publishFail', callback: Callback<{ publishId: number, reason: numbe
Subscribes to device information publication failures.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1329,8 +1271,6 @@ off(type: 'publishFail', callback?: Callback<{ publishId: number, reason: num
Unsubscribes from device information publication failures.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1358,8 +1298,6 @@ on(type: 'serviceDie', callback: () => void): void
Subscribes to dead events of the **DeviceManager** service.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
@@ -1387,8 +1325,6 @@ off(type: 'serviceDie', callback?: () => void): void
Unsubscribes from dead events of the **DeviceManager** service.
-**Required permissions**: ohos.permission.ACCESS_SERVICE_DM (available only to system applications)
-
**System capability**: SystemCapability.DistributedHardware.DeviceManager
**Parameters**
diff --git a/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md b/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md
index 05b3f1f716f675a5eb876acec6e321b9b0dc762d..a29988585ec509bbd1948e101324dbf253991873 100644
--- a/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md
+++ b/en/application-dev/reference/apis/js-apis-enterprise-adminManager.md
@@ -953,5 +953,7 @@ Enumerates the system management events that can be subscribed to.
| Name | Value | Description |
| -------------------------- | ---- | ------------- |
-| MANAGED_EVENT_BUNDLE_ADDED | 0 | Application installation event.|
-| MANAGED_EVENT_BUNDLE_REMOVED | 1 | Application uninstallation event.|
+| MANAGED_EVENT_BUNDLE_ADDED | 0 | Bundle added.|
+| MANAGED_EVENT_BUNDLE_REMOVED | 1 | Bundle removed.|
+| MANAGED_EVENT_APP_START | 2 | Application started.|
+| MANAGED_EVENT_APP_STOP | 3 | Application stopped.|
diff --git a/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md b/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md
index 44ed633f182665681e3dbb844c38406113bf9ff7..4e19154377bb2b91e8f47af1b92a126f5c429cbd 100644
--- a/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md
+++ b/en/application-dev/reference/apis/js-apis-enterprise-wifiManager.md
@@ -86,8 +86,8 @@ For details about the error codes, see [Enterprise Device Management Error Codes
| ID| Error Message |
| ------- | ---------------------------------------------------------------------------- |
-| 9200001 | The application is not an administrator application of the device. |
-| 9200002 | The administrator application does not have permission to manage the device.|
+| 9200001 | The application is not an administrator application of the device. |
+| 9200002 | The administrator application does not have permission to manage the device. |
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-faultLogger.md b/en/application-dev/reference/apis/js-apis-faultLogger.md
index ea9be4cbb8e141c716e92ded6d839651bae9bf7f..98ddcfd6e20d64d4ef664fec43637b29e207bca5 100644
--- a/en/application-dev/reference/apis/js-apis-faultLogger.md
+++ b/en/application-dev/reference/apis/js-apis-faultLogger.md
@@ -40,11 +40,9 @@ Defines the data structure of the fault log information.
| summary | string | Yes| Summary of the fault.|
| fullLog | string | Yes| Full log text.|
-## faultLogger.querySelfFaultLog(deprecated)
-
-querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void
+## faultLogger.query9+
-> **NOTE** This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9) instead.
+query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void
Obtains the fault information about the current process. This API uses an asynchronous callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
@@ -57,6 +55,14 @@ Obtains the fault information about the current process. This API uses an asynch
| faultType | [FaultType](#faulttype) | Yes| Fault type.|
| callback | AsyncCallback<Array<[FaultLogInfo](#faultloginfo)>> | Yes| Callback used to return the fault information array. The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
+**Error codes**
+
+For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md).
+
+| ID| Error Message|
+| --- | --- |
+| 10600001 | The service is not started or is faulty |
+
**Example**
```js
@@ -79,14 +85,16 @@ function queryFaultLogCallback(error, value) {
}
}
}
-faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback);
+try {
+ faultLogger.query(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback);
+} catch (err) {
+ console.error(`code: ${err.code}, message: ${err.message}`);
+}
```
-## faultLogger.querySelfFaultLog(deprecated)
-
-querySelfFaultLog(faultType: FaultType) : Promise<Array<FaultLogInfo>>
+## faultLogger.query9+
-> **NOTE** This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9-1) instead.
+query(faultType: FaultType) : Promise<Array<FaultLogInfo>>
Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
@@ -104,32 +112,48 @@ Obtains the fault information about the current process. This API uses a promise
| -------- | -------- |
| Promise<Array<[FaultLogInfo](#faultloginfo)>> | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**. The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
+**Error codes**
+
+For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md).
+
+| ID| Error Message|
+| --- | --- |
+| 10600001 | The service is not started or is faulty |
+
**Example**
```js
async function getLog() {
- let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH);
- if (value) {
- console.info("value length is " + value.length);
- let len = value.length;
- for (let i = 0; i < len; i++) {
- console.info("log: " + i);
- console.info("Log pid: " + value[i].pid);
- console.info("Log uid: " + value[i].uid);
- console.info("Log type: " + value[i].type);
- console.info("Log timestamp: " + value[i].timestamp);
- console.info("Log reason: " + value[i].reason);
- console.info("Log module: " + value[i].module);
- console.info("Log summary: " + value[i].summary);
- console.info("Log text: " + value[i].fullLog);
+ try {
+ let value = await faultLogger.query(faultLogger.FaultType.JS_CRASH);
+ if (value) {
+ console.info("value length is " + value.length);
+ let len = value.length;
+ for (let i = 0; i < len; i++) {
+ console.info("log: " + i);
+ console.info("Log pid: " + value[i].pid);
+ console.info("Log uid: " + value[i].uid);
+ console.info("Log type: " + value[i].type);
+ console.info("Log timestamp: " + value[i].timestamp);
+ console.info("Log reason: " + value[i].reason);
+ console.info("Log module: " + value[i].module);
+ console.info("Log summary: " + value[i].summary);
+ console.info("Log text: " + value[i].fullLog);
+ }
}
+ } catch (err) {
+ console.error(`code: ${err.code}, message: ${err.message}`);
}
}
```
-## faultLogger.query9+
+## faultLogger.querySelfFaultLog(deprecated)
-query(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void
+querySelfFaultLog(faultType: FaultType, callback: AsyncCallback<Array<FaultLogInfo>>) : void
+
+> **NOTE**
+>
+> This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9) instead.
Obtains the fault information about the current process. This API uses an asynchronous callback to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
@@ -142,14 +166,6 @@ Obtains the fault information about the current process. This API uses an asynch
| faultType | [FaultType](#faulttype) | Yes| Fault type.|
| callback | AsyncCallback<Array<[FaultLogInfo](#faultloginfo)>> | Yes| Callback used to return the fault information array. The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval. In this case, an error string will be returned.
-**Error codes**
-
-For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md).
-
-| ID| Error Message|
-| --- | --- |
-| 10600001 | The service is not started or is faulty |
-
**Example**
```js
@@ -172,16 +188,16 @@ function queryFaultLogCallback(error, value) {
}
}
}
-try {
- faultLogger.query(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback);
-} catch (err) {
- console.error(`code: ${err.code}, message: ${err.message}`);
-}
+faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH, queryFaultLogCallback);
```
-## faultLogger.query9+
+## faultLogger.querySelfFaultLog(deprecated)
-query(faultType: FaultType) : Promise<Array<FaultLogInfo>>
+querySelfFaultLog(faultType: FaultType) : Promise<Array<FaultLogInfo>>
+
+> **NOTE**
+>
+> This API is deprecated since API version 9. You are advised to use [faultLogger.query](#faultloggerquery9-1) instead.
Obtains the fault information about the current process. This API uses a promise to return the fault information array obtained, which contains a maximum of 10 pieces of fault information.
@@ -199,37 +215,25 @@ Obtains the fault information about the current process. This API uses a promise
| -------- | -------- |
| Promise<Array<[FaultLogInfo](#faultloginfo)>> | Promise used to return the fault information array. You can obtain the fault information instance in its **then()** method or use **await**. The value is the fault information array obtained. If the value is **undefined**, an exception occurs during the information retrieval.|
-**Error codes**
-
-For details about the error codes, see [FaultLogger Error Codes](../errorcodes/errorcode-faultlogger.md).
-
-| ID| Error Message|
-| --- | --- |
-| 10600001 | The service is not started or is faulty |
-
**Example**
```js
async function getLog() {
- try {
- let value = await faultLogger.query(faultLogger.FaultType.JS_CRASH);
- if (value) {
- console.info("value length is " + value.length);
- let len = value.length;
- for (let i = 0; i < len; i++) {
- console.info("log: " + i);
- console.info("Log pid: " + value[i].pid);
- console.info("Log uid: " + value[i].uid);
- console.info("Log type: " + value[i].type);
- console.info("Log timestamp: " + value[i].timestamp);
- console.info("Log reason: " + value[i].reason);
- console.info("Log module: " + value[i].module);
- console.info("Log summary: " + value[i].summary);
- console.info("Log text: " + value[i].fullLog);
- }
+ let value = await faultLogger.querySelfFaultLog(faultLogger.FaultType.JS_CRASH);
+ if (value) {
+ console.info("value length is " + value.length);
+ let len = value.length;
+ for (let i = 0; i < len; i++) {
+ console.info("log: " + i);
+ console.info("Log pid: " + value[i].pid);
+ console.info("Log uid: " + value[i].uid);
+ console.info("Log type: " + value[i].type);
+ console.info("Log timestamp: " + value[i].timestamp);
+ console.info("Log reason: " + value[i].reason);
+ console.info("Log module: " + value[i].module);
+ console.info("Log summary: " + value[i].summary);
+ console.info("Log text: " + value[i].fullLog);
}
- } catch (err) {
- console.error(`code: ${err.code}, message: ${err.message}`);
}
}
```
diff --git a/en/application-dev/reference/apis/js-apis-file-fileUri.md b/en/application-dev/reference/apis/js-apis-file-fileUri.md
new file mode 100644
index 0000000000000000000000000000000000000000..9f524c06525a1a1f6ebdd8b2fd0117a2c43b89d5
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-file-fileUri.md
@@ -0,0 +1,61 @@
+# @ohos.file.fileUri (File URI)
+
+The **fileUri** module allows the uniform resource identifier (URI) of a file to be obtained based on the file path. With the file URI, you can use the APIs provided by [@ohos.file.fs](js-apis-file-fs.md) to operate the file.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## Modules to Import
+
+```js
+import fileUri from "@ohos.file.fileUri";
+```
+
+Before using this module, you need to obtain the path of the file in the application sandbox. The following is an example:
+
+ ```js
+import UIAbility from '@ohos.app.ability.UIAbility';
+
+export default class EntryAbility extends UIAbility {
+ onWindowStageCreate(windowStage) {
+ let context = this.context;
+ let pathDir = context.filesDir;
+ }
+}
+ ```
+
+## fileUri.getUriFromPath
+
+getUriFromPath(path: string): string
+
+Obtains the URI of a file in synchronous mode.
+
+**System capability**: SystemCapability.FileManagement.AppFileService
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------------- |
+| path | string | Yes | Path of the file in the application sandbox.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------- | ---------- |
+| string | File URI obtained.|
+
+**Error codes**
+
+For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md).
+| ID | Error Message |
+| ---------------------------- | ---------- |
+| 401 | The input parameter is invalid |
+
+
+**Example**
+
+ ```js
+let filePath = pathDir + "test.txt";
+let uri = fileUri.getUriFromPath(filePath);
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-file-fs.md b/en/application-dev/reference/apis/js-apis-file-fs.md
index 306d752c6de0ec32a36b5bc024d8b88b016bcb3d..44296a0c8391d0b8005277b3e363571f01892900 100644
--- a/en/application-dev/reference/apis/js-apis-file-fs.md
+++ b/en/application-dev/reference/apis/js-apis-file-fs.md
@@ -16,7 +16,7 @@ import fs from '@ohos.file.fs';
## Guidelines
-Before using the APIs provided by this module to perform operations on files or directories, obtain the path of the file or directory in the application sandbox as follows:
+Before using the APIs provided by this module to perform operations on files or folders, obtain the path of the file or directory in the application sandbox as follows:
**Stage Model**
@@ -60,14 +60,14 @@ Obtains detailed file information. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ---------------------------- | ---------- |
-| Promise<[Stat](#stat)> | Promise used to return the file information obtained.|
+ | Type | Description |
+ | ---------------------------- | ---------- |
+ | Promise<[Stat](#stat)> | Promise used to return the file information obtained.|
**Example**
```js
- let filePath = pathDir + "test.txt";
+ let filePath = pathDir + "/test.txt";
fs.stat(filePath).then((stat) => {
console.info("get file info succeed, the size of file is " + stat.size);
}).catch((err) => {
@@ -119,9 +119,9 @@ Obtains detailed file information synchronously.
**Return value**
-| Type | Description |
-| ------------- | ---------- |
-| [Stat](#stat) | File information obtained.|
+ | Type | Description |
+ | ------------- | ---------- |
+ | [Stat](#stat) | File information obtained.|
**Example**
@@ -146,9 +146,9 @@ Checks whether a file exists. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<boolean> | Promise used to return a Boolean value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<boolean> | Promise used to return a Boolean value.|
**Example**
@@ -233,15 +233,15 @@ Closes a file. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ------------ |
-| file | [File](#file)\|number | Yes | File object or FD of the file to close.|
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ------------ |
+ | file | [File](#file)\|number | Yes | File object or FD of the file to close.|
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
@@ -266,10 +266,10 @@ Closes a file. This API uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ------------------------- | ---- | ------------ |
-| file | [File](#file)\|number | Yes | File object or FD of the file to close.|
-| callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ------------------------- | ---- | ------------ |
+ | file | [File](#file)\|number | Yes | File object or FD of the file to close.|
+ | callback | AsyncCallback<void> | Yes | Callback invoked when the file is closed asynchronously.|
**Example**
@@ -295,9 +295,9 @@ Synchronously closes a file.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ------------ |
-| file | [File](#file)\|number | Yes | File object or FD of the file to close.|
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ------------ |
+ | file | [File](#file)\|number | Yes | File object or FD of the file to close.|
**Example**
@@ -317,23 +317,23 @@ Copies a file. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | -------------------------- | ---- | ---------------------------------------- |
-| src | string\|number | Yes | Path or FD of the file to copy. |
-| dest | string\|number | Yes | Destination path of the file or FD of the file created. |
-| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported. **0**: overwrite the file of the same name.|
+ | Name | Type | Mandatory | Description |
+ | ---- | -------------------------- | ---- | ---------------------------------------- |
+ | src | string\|number | Yes | Path or FD of the file to copy. |
+ | dest | string\|number | Yes | Destination path of the file or FD of the file created. |
+ | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported. **0**: overwrite the file of the same name.|
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
```js
- let srcPath = pathDir + "srcDir/test.txt";
- let dstPath = pathDir + "dstDir/test.txt";
+ let srcPath = pathDir + "/srcDir/test.txt";
+ let dstPath = pathDir + "/dstDir/test.txt";
fs.copyFile(srcPath, dstPath).then(() => {
console.info("copy file succeed");
}).catch((err) => {
@@ -351,18 +351,18 @@ Copies a file. This API uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | -------------------------- | ---- | ---------------------------------------- |
-| src | string\|number | Yes | Path or FD of the file to copy. |
-| dest | string\|number | Yes | Destination path of the file or FD of the file created. |
-| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported. **0**: overwrite the file with the same name and truncate the part that is not overwritten.|
-| callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. |
+ | Name | Type | Mandatory | Description |
+ | -------- | -------------------------- | ---- | ---------------------------------------- |
+ | src | string\|number | Yes | Path or FD of the file to copy. |
+ | dest | string\|number | Yes | Destination path of the file or FD of the file created. |
+ | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported. **0**: overwrite the file with the same name and truncate the part that is not overwritten.|
+ | callback | AsyncCallback<void> | Yes | Callback invoked when the file is copied asynchronously. |
**Example**
```js
- let srcPath = pathDir + "srcDir/test.txt";
- let dstPath = pathDir + "dstDir/test.txt";
+ let srcPath = pathDir + "/srcDir/test.txt";
+ let dstPath = pathDir + "/dstDir/test.txt";
fs.copyFile(srcPath, dstPath, (err) => {
if (err) {
console.info("copy file failed with error message: " + err.message + ", error code: " + err.code);
@@ -383,17 +383,17 @@ Synchronously copies a file.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | -------------------------- | ---- | ---------------------------------------- |
-| src | string\|number | Yes | Path or FD of the file to copy. |
-| dest | string\|number | Yes | Destination path of the file or FD of the file created. |
-| mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported. **0**: overwrite the file with the same name and truncate the part that is not overwritten.|
+ | Name | Type | Mandatory | Description |
+ | ---- | -------------------------- | ---- | ---------------------------------------- |
+ | src | string\|number | Yes | Path or FD of the file to copy. |
+ | dest | string\|number | Yes | Destination path of the file or FD of the file created. |
+ | mode | number | No | Whether to overwrite the file of the same name in the destination path. The default value is **0**, which is the only value supported. **0**: overwrite the file with the same name and truncate the part that is not overwritten.|
**Example**
```js
- let srcPath = pathDir + "srcDir/test.txt";
- let dstPath = pathDir + "dstDir/test.txt";
+ let srcPath = pathDir + "/srcDir/test.txt";
+ let dstPath = pathDir + "/dstDir/test.txt";
fs.copyFileSync(srcPath, dstPath);
```
@@ -414,14 +414,14 @@ Creates a directory. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
```js
- let dirPath = pathDir + '/testDir';
+ let dirPath = pathDir + "/testDir";
fs.mkdir(dirPath).then(() => {
console.info("Directory created");
}).catch((err) => {
@@ -448,7 +448,7 @@ Creates a directory. This API uses an asynchronous callback to return the result
**Example**
```js
- let dirPath = pathDir + '/testDir';
+ let dirPath = pathDir + "/testDir";
fs.mkdir(dirPath, (err) => {
if (err) {
console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code);
@@ -476,7 +476,7 @@ Synchronously creates a directory.
**Example**
```js
- let dirPath = path + '/testDir';
+ let dirPath = pathDir + "/testDir";
fs.mkdirSync(dirPath);
```
@@ -498,9 +498,9 @@ Opens a file. This API uses a promise to return the result. File uniform resourc
**Return value**
-| Type | Description |
-| --------------------- | ----------- |
-| Promise<[File](#file)> | Promise used to return the file object.|
+ | Type | Description |
+ | --------------------- | ----------- |
+ | Promise<[File](#file)> | Promise used to return the file object.|
**Example**
@@ -559,9 +559,9 @@ Synchronously opens a file. File URIs are supported.
**Return value**
-| Type | Description |
-| ------ | ----------- |
-| [File](#file) | File object opened.|
+ | Type | Description |
+ | ------ | ----------- |
+ | [File](#file) | File object opened.|
**Example**
@@ -590,9 +590,9 @@ Reads data from a file. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ---------------------------------- | ------ |
-| Promise<number> | Promise used to return the data read.|
+ | Type | Description |
+ | ---------------------------------- | ------ |
+ | Promise<number> | Promise used to return the data read.|
**Example**
@@ -602,7 +602,7 @@ Reads data from a file. This API uses a promise to return the result.
let buf = new ArrayBuffer(4096);
fs.read(file.fd, buf).then((readLen) => {
console.info("Read file data successfully");
- console.info(String.fromCharCode.apply(null, new Uint8Array(readLen)));
+ console.info(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen))));
fs.closeSync(file);
}).catch((err) => {
console.info("read file data failed with error message: " + err.message + ", error code: " + err.code);
@@ -619,12 +619,12 @@ Reads data from a file. This API uses an asynchronous callback to return the res
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| fd | number | Yes | FD of the file. |
-| buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
-| options | Object | No | The options are as follows: - **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position. - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.|
-| callback | AsyncCallback<number> | Yes | Callback invoked when the data is read asynchronously. |
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+ | fd | number | Yes | FD of the file. |
+ | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
+ | options | Object | No | The options are as follows: - **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position. - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.|
+ | callback | AsyncCallback<number> | Yes | Callback invoked when the data is read asynchronously. |
**Example**
@@ -637,7 +637,7 @@ Reads data from a file. This API uses an asynchronous callback to return the res
console.info("mkdir failed with error message: " + err.message + ", error code: " + err.code);
} else {
console.info("Read file data successfully");
- console.info(String.fromCharCode.apply(null, new Uint8Array(readLen)));
+ console.info(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen))));
fs.closeSync(file);
}
});
@@ -654,17 +654,17 @@ Synchronously reads data from a file.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ----------- | ---- | ---------------------------------------- |
-| fd | number | Yes | FD of the file. |
-| buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
-| options | Object | No | The options are as follows: - **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position. - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.|
+ | Name | Type | Mandatory | Description |
+ | ------- | ----------- | ---- | ---------------------------------------- |
+ | fd | number | Yes | FD of the file. |
+ | buffer | ArrayBuffer | Yes | Buffer used to store the file data read. |
+ | options | Object | No | The options are as follows: - **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position. - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length.|
**Return value**
-| Type | Description |
-| ------ | -------- |
-| number | Length of the data read.|
+ | Type | Description |
+ | ------ | -------- |
+ | number | Length of the data read.|
**Example**
@@ -693,14 +693,14 @@ Deletes a directory. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
```js
- let dirPath = pathDir + '/testDir';
+ let dirPath = pathDir + "/testDir";
fs.rmdir(dirPath).then(() => {
console.info("Directory deleted");
}).catch((err) => {
@@ -727,7 +727,7 @@ Deletes a directory. This API uses an asynchronous callback to return the result
**Example**
```js
- let dirPath = pathDir + '/testDir';
+ let dirPath = pathDir + "/testDir";
fs.rmdir(dirPath, (err) => {
if (err) {
console.info("rmdir failed with error message: " + err.message + ", error code: " + err.code);
@@ -755,7 +755,7 @@ Synchronously deletes a directory.
**Example**
```js
- let dirPath = pathDir + '/testDir';
+ let dirPath = pathDir + "/testDir";
fs.rmdirSync(dirPath);
```
@@ -776,9 +776,9 @@ Deletes a file. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
@@ -853,17 +853,17 @@ Writes data into a file. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ------------------------------- | ---- | ---------------------------------------- |
-| fd | number | Yes | FD of the file. |
-| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
-| options | Object | No | The options are as follows: - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
+ | Name | Type | Mandatory | Description |
+ | ------- | ------------------------------- | ---- | ---------------------------------------- |
+ | fd | number | Yes | FD of the file. |
+ | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
+ | options | Object | No | The options are as follows: - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
**Return value**
-| Type | Description |
-| --------------------- | -------- |
-| Promise<number> | Promise used to return the length of the data written.|
+ | Type | Description |
+ | --------------------- | -------- |
+ | Promise<number> | Promise used to return the length of the data written.|
**Example**
@@ -889,12 +889,12 @@ Writes data into a file. This API uses an asynchronous callback to return the re
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ------------------------------- | ---- | ---------------------------------------- |
-| fd | number | Yes | FD of the file. |
-| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
-| options | Object | No | The options are as follows: - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
-| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. |
+ | Name | Type | Mandatory | Description |
+ | -------- | ------------------------------- | ---- | ---------------------------------------- |
+ | fd | number | Yes | FD of the file. |
+ | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
+ | options | Object | No | The options are as follows: - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
+ | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. |
**Example**
@@ -922,17 +922,17 @@ Synchronously writes data into a file.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ------------------------------- | ---- | ---------------------------------------- |
-| fd | number | Yes | FD of the file. |
-| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
-| options | Object | No | The options are as follows: - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
+ | Name | Type | Mandatory | Description |
+ | ------- | ------------------------------- | ---- | ---------------------------------------- |
+ | fd | number | Yes | FD of the file. |
+ | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
+ | options | Object | No | The options are as follows: - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
**Return value**
-| Type | Description |
-| ------ | -------- |
-| number | Length of the data written in the file.|
+ | Type | Description |
+ | ------ | -------- |
+ | number | Length of the data written in the file.|
**Example**
@@ -961,9 +961,9 @@ Truncates a file. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
@@ -1050,9 +1050,9 @@ Reads the text content of a file. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| --------------------- | ---------- |
-| Promise<string> | Promise used to return the content read.|
+ | Type | Description |
+ | --------------------- | ---------- |
+ | Promise<string> | Promise used to return the content read.|
**Example**
@@ -1113,9 +1113,9 @@ Synchronously reads the text of a file.
**Return value**
-| Type | Description |
-| ------ | -------------------- |
-| string | Promise used to return the content of the file read.|
+ | Type | Description |
+ | ------ | -------------------- |
+ | string | Promise used to return the content of the file read.|
**Example**
@@ -1141,9 +1141,9 @@ Obtains information about a symbolic link. This API uses a promise to return the
**Return value**
-| Type | Description |
-| ---------------------------- | ---------- |
-| Promise<[Stat](#stat)> | Promise used to return the symbolic link information obtained. For details, see **stat**.|
+ | Type | Description |
+ | ---------------------------- | ---------- |
+ | Promise<[Stat](#stat)> | Promise used to return the symbolic link information obtained. For details, see **stat**.|
**Example**
@@ -1201,9 +1201,9 @@ Obtains information about a symbolic link synchronously.
**Return value**
-| Type | Description |
-| ------------- | ---------- |
-| [Stat](#stat) | File information obtained.|
+ | Type | Description |
+ | ------------- | ---------- |
+ | [Stat](#stat) | File information obtained.|
**Example**
@@ -1216,7 +1216,7 @@ Obtains information about a symbolic link synchronously.
rename(oldPath: string, newPath: string): Promise<void>
-Renames a file or directory. This API uses a promise to return the result.
+Renames a file or folder. This API uses a promise to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
@@ -1229,15 +1229,15 @@ Renames a file or directory. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
```js
let srcFile = pathDir + "/test.txt";
- let dstFile = pathDir + '/new.txt';
+ let dstFile = pathDir + "/new.txt";
fs.rename(srcFile, dstFile).then(() => {
console.info("File renamed");
}).catch((err) => {
@@ -1249,7 +1249,7 @@ Renames a file or directory. This API uses a promise to return the result.
rename(oldPath: string, newPath: string, callback: AsyncCallback<void>): void
-Renames a file or directory. This API uses an asynchronous callback to return the result.
+Renames a file or folder. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.FileManagement.File.FileIO
@@ -1265,7 +1265,7 @@ Renames a file or directory. This API uses an asynchronous callback to return th
```js
let srcFile = pathDir + "/test.txt";
- let dstFile = pathDir + '/new.txt';
+ let dstFile = pathDir + "/new.txt";
fs.rename(srcFile, dstFile, (err) => {
if (err) {
console.info("rename failed with error message: " + err.message + ", error code: " + err.code);
@@ -1279,7 +1279,7 @@ Renames a file or directory. This API uses an asynchronous callback to return th
renameSync(oldPath: string, newPath: string): void
-Renames a file or directory synchronously.
+Renames a file or folder synchronously.
**System capability**: SystemCapability.FileManagement.File.FileIO
@@ -1294,7 +1294,7 @@ Renames a file or directory synchronously.
```js
let srcFile = pathDir + "/test.txt";
- let dstFile = pathDir + '/new.txt';
+ let dstFile = pathDir + "/new.txt";
fs.renameSync(srcFile, dstFile);
```
@@ -1309,15 +1309,15 @@ Flushes data of a file to disk. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ------------ |
-| fd | number | Yes | FD of the file.|
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ------------ |
+ | fd | number | Yes | FD of the file.|
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
@@ -1342,10 +1342,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ------------------------- | ---- | --------------- |
-| fd | number | Yes | FD of the file. |
-| Callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ------------------------- | ---- | --------------- |
+ | fd | number | Yes | FD of the file. |
+ | Callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.|
**Example**
@@ -1373,9 +1373,9 @@ Flushes data of a file to disk synchronously.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ------------ |
-| fd | number | Yes | FD of the file.|
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ------------ |
+ | fd | number | Yes | FD of the file.|
**Example**
@@ -1397,15 +1397,15 @@ Flushes data of a file to disk. This API uses a promise to return the result. **
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ------------ |
-| fd | number | Yes | FD of the file.|
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ------------ |
+ | fd | number | Yes | FD of the file.|
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
@@ -1431,10 +1431,10 @@ Flushes data of a file to disk. This API uses an asynchronous callback to return
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ------------------------------- | ---- | ----------------- |
-| fd | number | Yes | FD of the file. |
-| callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ------------------------------- | ---- | ----------------- |
+ | fd | number | Yes | FD of the file. |
+ | callback | AsyncCallback<void> | Yes | Callback invoked when the file data is synchronized in asynchronous mode.|
**Example**
@@ -1461,9 +1461,9 @@ Synchronizes data in a file synchronously.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ------------ |
-| fd | number | Yes | FD of the file.|
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ------------ |
+ | fd | number | Yes | FD of the file.|
**Example**
@@ -1492,15 +1492,15 @@ Creates a symbolic link based on a file path. This API uses a promise to return
**Return value**
-| Type | Description |
-| ------------------- | ---------------------------- |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ------------------- | ---------------------------- |
+ | Promise<void> | Promise that returns no value.|
**Example**
```js
let srcFile = pathDir + "/test.txt";
- let dstFile = pathDir + '/test';
+ let dstFile = pathDir + "/test";
fs.symlink(srcFile, dstFile).then(() => {
console.info("Symbolic link created");
}).catch((err) => {
@@ -1528,7 +1528,7 @@ Creates a symbolic link based on a file path. This API uses an asynchronous call
```js
let srcFile = pathDir + "/test.txt";
- let dstFile = pathDir + '/test';
+ let dstFile = pathDir + "/test";
fs.symlink(srcFile, dstFile, (err) => {
if (err) {
console.info("symlink failed with error message: " + err.message + ", error code: " + err.code);
@@ -1557,7 +1557,7 @@ Synchronously creates a symbolic link based on a file path.
```js
let srcFile = pathDir + "/test.txt";
- let dstFile = pathDir + '/test';
+ let dstFile = pathDir + "/test";
fs.symlinkSync(srcFile, dstFile);
```
@@ -1568,30 +1568,30 @@ listFile(path: string, options?: {
filter?: Filter;
}): Promise;
-Lists all files in a directory. This API uses a promise to return the result. This API supports recursive listing of all files (including files in subdirectories) and file filtering.
+Lists all files in a folder. This API uses a promise to return the result. This API supports recursive listing of all files (including files in subfolders) and file filtering.
**System capability**: SystemCapability.FileManagement.File.FileIO
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| path | string | Yes | Path of the directory in the application sandbox.|
-| options | Object | No | File filtering options.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | path | string | Yes | Path of the folder in the application sandbox.|
+ | options | Object | No | File filtering options.|
**options parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.|
-| listNum | number | No | Number of file names to list. The default value **0** means to list all files.|
-| filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | recursion | boolean | No | Whether to list all files in subfolders recursively. The default value is **false**.|
+ | listNum | number | No | Number of file names to list. The default value **0** means to list all files.|
+ | filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.|
**Return value**
-| Type | Description |
-| --------------------- | ---------- |
-| Promise<string[]> | Promise used to return the files names listed.|
+ | Type | Description |
+ | --------------------- | ---------- |
+ | Promise<string[]> | Promise used to return the files names listed.|
**Example**
@@ -1608,7 +1608,7 @@ Lists all files in a directory. This API uses a promise to return the result. {
console.info("listFile succeed");
- for (let i = 0; i < filenames.size; i++) {
+ for (let i = 0; i < filenames.length; i++) {
console.info("fileName: %s", filenames[i]);
}
}).catch((err) => {
@@ -1623,23 +1623,23 @@ listFile(path: string, options?: {
filter?: Filter;
}, callback: AsyncCallback): void;
-Lists all files in a directory. This API uses an asynchronous callback to return the result. This API supports recursive listing of all files (including files in subdirectories) and file filtering.
+Lists all files in a folder. This API uses an asynchronous callback to return the result. This API supports recursive listing of all files (including files in subfolders) and file filtering.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| path | string | Yes | Path of the directory in the application sandbox.|
-| options | Object | No | File filtering options.|
-| callback | AsyncCallback<string[]> | Yes | Callback invoked to return the file names listed. |
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | path | string | Yes | Path of the folder in the application sandbox.|
+ | options | Object | No | File filtering options.|
+ | callback | AsyncCallback<string[]> | Yes | Callback invoked to return the file names listed. |
**options parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.|
-| listNum | number | No | Number of file names to list. The default value **0** means to list all files.|
-| filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | recursion | boolean | No | Whether to list all files in subfolders recursively. The default value is **false**.|
+ | listNum | number | No | Number of file names to list. The default value **0** means to list all files.|
+ | filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.|
**Example**
@@ -1659,7 +1659,7 @@ Lists all files in a directory. This API uses an asynchronous callback to return
console.info("list file failed with error message: " + err.message + ", error code: " + err.code);
} else {
console.info("listFile succeed");
- for (let i = 0; i < filenames.size; i++) {
+ for (let i = 0; i < filenames.length; i++) {
console.info("filename: %s", filenames[i]);
}
}
@@ -1674,28 +1674,28 @@ listFileSync(path: string, options?: {
filter?: Filter;
}): string[];
-Lists all files in a directory synchronously. This API supports recursive listing of all files (including files in subdirectories) and file filtering.
+Lists all files in a folder synchronously. This API supports recursive listing of all files (including files in subfolders) and file filtering.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| path | string | Yes | Path of the directory in the application sandbox.|
-| options | Object | No | File filtering options.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | path | string | Yes | Path of the folder in the application sandbox.|
+ | options | Object | No | File filtering options.|
**options parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| recursion | boolean | No | Whether to list all files in subdirectories recursively. The default value is **false**.|
-| listNum | number | No | Number of file names to list. The default value **0** means to list all files.|
-| filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | recursion | boolean | No | Whether to list all files in subfolders recursively. The default value is **false**.|
+ | listNum | number | No | Number of file names to list. The default value **0** means to list all files.|
+ | filter | [Filter](#filter) | No | File filtering options. Currently, only the match by file name extension, fuzzy search by file name, and filter by file size or latest modification time are supported.|
**Return value**
-| Type | Description |
-| --------------------- | ---------- |
-| string[] | File names listed.|
+ | Type | Description |
+ | --------------------- | ---------- |
+ | string[] | File names listed.|
**Example**
@@ -1712,13 +1712,13 @@ Lists all files in a directory synchronously. This API supports recursive listin
};
let filenames = fs.listFileSync(pathDir, options);
console.info("listFile succeed");
- for (let i = 0; i < filenames.size; i++) {
+ for (let i = 0; i < filenames.length; i++) {
console.info("filename: %s", filenames[i]);
}
```
## fs.moveFile
-moveFile(src: string, dest: string, mode?: number): Promise;
+moveFile(src: string, dest: string, mode?: number): Promise\;
Moves a file. This API uses a promise to return the result.
@@ -1726,15 +1726,17 @@ Moves a file. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| src | string | Yes | Path of the file to move in the application sandbox.|
-| dest | string | Yes | Destination path of the file in the application sandbox.|
-| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | src | string | Yes | Path of the file to move in the application sandbox.|
+ | dest | string | Yes | Destination path of the file in the application sandbox.|
+ | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
**Example**
```js
+ let srcPath = pathDir + "/source.txt";
+ let destPath = pathDir + "/dest.txt";
fs.moveFile(srcPath, destPath, 0).then(() => {
console.info("move file succeed");
}).catch((err) => {
@@ -1744,7 +1746,7 @@ Moves a file. This API uses a promise to return the result.
## fs.moveFile
-moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback): void;
+moveFile(src: string, dest: string, mode?: number, callback: AsyncCallback\): void;
Moves a file. This API uses an asynchronous callback to return the result.
@@ -1752,16 +1754,18 @@ Moves a file. This API uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| src | string | Yes | Path of the file to move in the application sandbox.|
-| dest | string | Yes | Destination path of the file in the application sandbox.|
-| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
-| callback | AsyncCallback<void> | Yes | Callback invoked when the file is moved. |
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | src | string | Yes | Path of the file to move in the application sandbox.|
+ | dest | string | Yes | Destination path of the file in the application sandbox.|
+ | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
+ | callback | AsyncCallback<void> | Yes | Callback invoked when the file is moved. |
**Example**
```js
+ let srcPath = pathDir + "/source.txt";
+ let destPath = pathDir + "/dest.txt";
fs.moveFile(srcPath, destPath, 0, (err) => {
if (err) {
console.info("move file failed with error message: " + err.message + ", error code: " + err.code);
@@ -1781,15 +1785,17 @@ Moves a file synchronously.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| src | string | Yes | Path of the file to move in the application sandbox.|
-| dest | string | Yes | Destination path of the file in the application sandbox.|
-| mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | src | string | Yes | Path of the file to move in the application sandbox.|
+ | dest | string | Yes | Destination path of the file in the application sandbox.|
+ | mode | number | No | Whether to overwrite the file of the same name in the destination directory. The value **0** means to overwrite the file of the same name in the destination directory. The value **1** means to throw an exception if a file of the same name exists in the destination directory. The default value is **0**.|
**Example**
```js
+ let srcPath = pathDir + "/source.txt";
+ let destPath = pathDir + "/dest.txt";
fs.moveFileSync(srcPath, destPath, 0);
console.info("move file succeed");
```
@@ -1804,15 +1810,15 @@ Creates a temporary directory. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
**Return value**
-| Type | Description |
-| --------------------- | ---------- |
-| Promise<string> | Promise used to return the unique directory generated.|
+ | Type | Description |
+ | --------------------- | ---------- |
+ | Promise<string> | Promise used to return the unique directory generated.|
**Example**
@@ -1835,10 +1841,10 @@ Creates a temporary directory. This API uses an asynchronous callback to return
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | --------------------------- | ---- | --------------------------- |
-| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
-| callback | AsyncCallback<string> | Yes | Callback invoked when a temporary directory is created asynchronously. |
+ | Name | Type | Mandatory | Description |
+ | -------- | --------------------------- | ---- | --------------------------- |
+ | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
+ | callback | AsyncCallback<string> | Yes | Callback invoked when a temporary directory is created asynchronously. |
**Example**
@@ -1862,21 +1868,21 @@ Synchronously creates a temporary directory.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------ | ------ | ---- | --------------------------- |
-| prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
+ | Name | Type | Mandatory | Description |
+ | ------ | ------ | ---- | --------------------------- |
+ | prefix | string | Yes | A randomly generated string used to replace "XXXXXX" in a directory.|
**Return value**
-| Type | Description |
-| ------ | ---------- |
-| string | Unique path generated.|
+ | Type | Description |
+ | ------ | ---------- |
+ | string | Unique path generated.|
**Example**
```js
let res = fs.mkdtempSync(pathDir + "/XXXXXX");
- ```
+ ```
## fs.createStream
@@ -1895,9 +1901,9 @@ Opens a file stream based on the file path. This API uses a promise to return th
**Return value**
-| Type | Description |
-| --------------------------------- | --------- |
-| Promise<[Stream](#stream)> | Promise used to return the result.|
+ | Type | Description |
+ | --------------------------------- | --------- |
+ | Promise<[Stream](#stream)> | Promise used to return the result.|
**Example**
@@ -1957,9 +1963,9 @@ Synchronously opens a stream based on the file path.
**Return value**
-| Type | Description |
-| ------------------ | --------- |
-| [Stream](#stream) | Stream opened.|
+ | Type | Description |
+ | ------------------ | --------- |
+ | [Stream](#stream) | Stream opened.|
**Example**
@@ -1979,16 +1985,16 @@ Opens a file stream based on the file descriptor. This API uses a promise to ret
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ---------------------------------------- |
-| fd | number | Yes | FD of the file. |
-| mode | string | Yes | - **r**: Open a file for reading. The file must exist. - **r+**: Open a file for both reading and writing. The file must exist. - **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file. - **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file. - **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved). - **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ---------------------------------------- |
+ | fd | number | Yes | FD of the file. |
+ | mode | string | Yes | - **r**: Open a file for reading. The file must exist. - **r+**: Open a file for both reading and writing. The file must exist. - **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file. - **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file. - **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved). - **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
**Return value**
-| Type | Description |
-| --------------------------------- | --------- |
-| Promise<[Stream](#stream)> | Promise used to return the result.|
+ | Type | Description |
+ | --------------------------------- | --------- |
+ | Promise<[Stream](#stream)> | Promise used to return the result.|
**Example**
@@ -2014,11 +2020,11 @@ Opens a file stream based on the file descriptor. This API uses an asynchronous
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| fd | number | Yes | FD of the file. |
-| mode | string | Yes | - **r**: Open a file for reading. The file must exist. - **r+**: Open a file for both reading and writing. The file must exist. - **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file. - **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file. - **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved). - **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
-| callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. |
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+ | fd | number | Yes | FD of the file. |
+ | mode | string | Yes | - **r**: Open a file for reading. The file must exist. - **r+**: Open a file for both reading and writing. The file must exist. - **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file. - **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file. - **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved). - **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
+ | callback | AsyncCallback<[Stream](#stream)> | Yes | Callback invoked when the stream is open asynchronously. |
**Example**
@@ -2045,16 +2051,16 @@ Synchronously opens a stream based on the file descriptor.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ---------------------------------------- |
-| fd | number | Yes | FD of the file. |
-| mode | string | Yes | - **r**: Open a file for reading. The file must exist. - **r+**: Open a file for both reading and writing. The file must exist. - **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file. - **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file. - **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved). - **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ---------------------------------------- |
+ | fd | number | Yes | FD of the file. |
+ | mode | string | Yes | - **r**: Open a file for reading. The file must exist. - **r+**: Open a file for both reading and writing. The file must exist. - **w**: Open a file for writing. If the file exists, clear its content. If the file does not exist, create a file. - **w+**: Open a file for both reading and writing. If the file exists, clear its content. If the file does not exist, create a file. - **a**: Open a file in append mode for writing at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved). - **a+**: Open a file in append mode for reading or updating at the end of the file. If the file does not exist, create a file. If the file exists, write data to the end of the file (the original content of the file is reserved).|
**Return value**
-| Type | Description |
-| ------------------ | --------- |
-| [Stream](#stream) | Stream opened.|
+ | Type | Description |
+ | ------------------ | --------- |
+ | [Stream](#stream) | Stream opened.|
**Example**
@@ -2077,17 +2083,17 @@ Creates a **Watcher** object to observe file or directory changes.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ---------------------------------------- |
-| path | string | Yes | Path of the file or directory to observe in the application sandbox. |
-| events | number | Yes | Events to observe. Multiple events can be separated|by a bitwise OR operator (|). - **0x1: IN_ACCESS**: A file is accessed. - **0x2: IN_MODIFY**: The file content is modified. - **0x4: IN_ATTRIB**: Metadata is changed. - **0x8: IN_CLOSE_WRITE**: The file opened for writing is closed. - **0x10: IN_CLOSE_NOWRITE**: The file or directory not opened for writing is closed. - **0x20: IN_OPEN**: A file or directory is opened. - **0x40: IN_MOVED_FROM**: A file in the observed directory is moved. - **0x80: IN_MOVED_TO**: A file is moved to the observed directory. - **0x100: IN_CREATE**: A file or directory is created in the observed directory. - **0x200: IN_DELETE**: A file or directory is deleted form the observed directory. - **0x400: IN_DELETE_SELF**: The observed directory is deleted. After the directory is deleted, the listening stops. - **0x800: IN_MOVE_SELF**: The observed file or directory is moved. After the file or directory is moved, the listening continues. - **0xfff: IN_ALL_EVENTS**: All events.|
-| listener | WatchEventListener | Yes | Callback invoked when an observed event occurs. The callback will be invoked each time an observed event occurs. |
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ---------------------------------------- |
+ | path | string | Yes | Path of the file or directory to observe in the application sandbox. |
+ | events | number | Yes | Events to observe. Multiple events can be separated by a bitwise OR operator (|). - **0x1: IN_ACCESS**: A file is accessed. - **0x2: IN_MODIFY**: The file content is modified. - **0x4: IN_ATTRIB**: Metadata is changed. - **0x8: IN_CLOSE_WRITE**: The file opened for writing is closed. - **0x10: IN_CLOSE_NOWRITE**: The file or directory not opened for writing is closed. - **0x20: IN_OPEN**: A file or directory is opened. - **0x40: IN_MOVED_FROM**: A file in the observed directory is moved. - **0x80: IN_MOVED_TO**: A file is moved to the observed directory. - **0x100: IN_CREATE**: A file or directory is created in the observed directory. - **0x200: IN_DELETE**: A file or directory is deleted form the observed directory. - **0x400: IN_DELETE_SELF**: The observed directory is deleted. After the directory is deleted, the listening stops. - **0x800: IN_MOVE_SELF**: The observed file or directory is moved. After the file or directory is moved, the listening continues. - **0xfff: IN_ALL_EVENTS**: All events.|
+ | listener | WatchEventListener | Yes | Callback invoked when an observed event occurs. The callback will be invoked each time an observed event occurs. |
**Return value**
-| Type | Description |
-| ------------------ | --------- |
-| [Watcher](#watcher10) | **Watcher** object created.|
+ | Type | Description |
+ | ------------------ | --------- |
+ | [Watcher](#watcher10) | **Watcher** object created.|
**Example**
@@ -2119,10 +2125,10 @@ Called when an observed event occurs.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ---- | ------ | ---- | ---------------------------------------- |
-| event | WatchEvent | Yes | Event for the callback to invoke. |
-
+ | Name | Type | Mandatory | Description |
+ | ---- | ------ | ---- | ---------------------------------------- |
+ | event | WatchEvent | Yes | Event for the callback to invoke. |
+
## WatchEvent10+
Defines the event to observe.
@@ -2146,7 +2152,7 @@ Represents detailed file information. Before calling any API of the **Stat()** c
### Attributes
| Name | Type | Readable | Writable | Description |
-| ------ | ------ | ---- | ---- | ---------------------------------------- |
+| ------ | ------ | ---- | ---- | ---------------------------------------- |
| ino | number | Yes | No | File ID. Different files on the same device have different **ino**s.| |
| mode | number | Yes | No | File permissions. The meaning of each bit is as follows: - **0o400**: The owner has the read permission on a regular file or a directory entry. - **0o200**: The owner has the permission to write a regular file or create and delete a directory entry. - **0o100**: The owner has the permission to execute a regular file or search for the specified path in a directory. - **0o040**: The user group has the read permission on a regular file or a directory entry. - **0o020**: The user group has the permission to write a regular file or create and delete a directory entry. - **0o010**: The user group has the permission to execute a regular file or search for the specified path in a directory. - **0o004**: Other users have the permission to read a regular file or read a directory entry. - **0o002**: Other users have the permission to write a regular file or create and delete a directory entry. - **0o001**: Other users have the permission to execute a regular file or search for the specified path in a directory.|
| uid | number | Yes | No | ID of the file owner.|
@@ -2167,9 +2173,9 @@ Checks whether this file is a block special file. A block special file supports
**Return value**
-| Type | Description |
-| ------- | ---------------- |
-| boolean | Whether the file is a block special file.|
+ | Type | Description |
+ | ------- | ---------------- |
+ | boolean | Whether the file is a block special file.|
**Example**
@@ -2188,9 +2194,9 @@ Checks whether this file is a character special file. A character special file s
**Return value**
-| Type | Description |
-| ------- | ----------------- |
-| boolean | Whether the file is a character special file.|
+ | Type | Description |
+ | ------- | ----------------- |
+ | boolean | Whether the file is a character special file.|
**Example**
@@ -2210,9 +2216,9 @@ Checks whether this file is a directory.
**Return value**
-| Type | Description |
-| ------- | ------------- |
-| boolean | Whether the file is a directory.|
+ | Type | Description |
+ | ------- | ------------- |
+ | boolean | Whether the file is a directory.|
**Example**
@@ -2232,9 +2238,9 @@ Checks whether this file is a named pipe (or FIFO). Named pipes are used for int
**Return value**
-| Type | Description |
-| ------- | --------------------- |
-| boolean | Whether the file is a FIFO.|
+ | Type | Description |
+ | ------- | --------------------- |
+ | boolean | Whether the file is a FIFO.|
**Example**
@@ -2254,9 +2260,9 @@ Checks whether this file is a regular file.
**Return value**
-| Type | Description |
-| ------- | --------------- |
-| boolean | Whether the file is a regular file.|
+ | Type | Description |
+ | ------- | --------------- |
+ | boolean | Whether the file is a regular file.|
**Example**
@@ -2276,9 +2282,9 @@ Checks whether this file is a socket.
**Return value**
-| Type | Description |
-| ------- | -------------- |
-| boolean | Whether the file is a socket.|
+ | Type | Description |
+ | ------- | -------------- |
+ | boolean | Whether the file is a socket.|
**Example**
@@ -2298,9 +2304,9 @@ Checks whether this file is a symbolic link.
**Return value**
-| Type | Description |
-| ------- | --------------- |
-| boolean | Whether the file is a symbolic link.|
+ | Type | Description |
+ | ------- | --------------- |
+ | boolean | Whether the file is a symbolic link.|
**Example**
@@ -2324,9 +2330,9 @@ Closes the stream. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ------------------- | ------------- |
-| Promise<void> | Promise used to return the stream close result.|
+ | Type | Description |
+ | ------------------- | ------------- |
+ | Promise<void> | Promise used to return the stream close result.|
**Example**
@@ -2351,9 +2357,9 @@ Closes the stream. This API uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ------------------------- | ---- | ------------- |
-| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ------------------------- | ---- | ------------- |
+ | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is closed asynchronously.|
**Example**
@@ -2395,9 +2401,9 @@ Flushes the stream. This API uses a promise to return the result.
**Return value**
-| Type | Description |
-| ------------------- | ------------- |
-| Promise<void> | Promise used to return the stream flushing result.|
+ | Type | Description |
+ | ------------------- | ------------- |
+ | Promise<void> | Promise used to return the stream flushing result.|
**Example**
@@ -2422,9 +2428,9 @@ Flushes the stream. This API uses an asynchronous callback to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ------------------------- | ---- | -------------- |
-| callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ------------------------- | ---- | -------------- |
+ | callback | AsyncCallback<void> | Yes | Callback invoked when the stream is asynchronously flushed.|
**Example**
@@ -2466,16 +2472,16 @@ Writes data into the stream. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ------------------------------- | ---- | ---------------------------------------- |
-| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
-| options | Object | No | The options are as follows: - **length** (number): length of the data to write. The default value is the buffer length. - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
+ | Name | Type | Mandatory | Description |
+ | ------- | ------------------------------- | ---- | ---------------------------------------- |
+ | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
+ | options | Object | No | The options are as follows: - **length** (number): length of the data to write. The default value is the buffer length. - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
**Return value**
-| Type | Description |
-| --------------------- | -------- |
-| Promise<number> | Promise used to return the length of the data written.|
+ | Type | Description |
+ | --------------------- | -------- |
+ | Promise<number> | Promise used to return the length of the data written.|
**Example**
@@ -2500,11 +2506,11 @@ Writes data into the stream. This API uses an asynchronous callback to return th
**Parameters**
-| Name | Type | Mandatory| Description |
-| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
-| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
-| options | Object | No | The options are as follows: - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
-| callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. |
+ | Name | Type | Mandatory| Description |
+ | -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
+ | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
+ | options | Object | No | The options are as follows: - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
+ | callback | AsyncCallback<number> | Yes | Callback invoked when the data is written asynchronously. |
**Example**
@@ -2532,16 +2538,16 @@ Synchronously writes data into the stream.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ------------------------------- | ---- | ---------------------------------------- |
-| buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
-| options | Object | No | The options are as follows: - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
+ | Name | Type | Mandatory | Description |
+ | ------- | ------------------------------- | ---- | ---------------------------------------- |
+ | buffer | ArrayBuffer\|string | Yes | Data to write. It can be a string or data from a buffer. |
+ | options | Object | No | The options are as follows: - **length** (number): length of the data to write. This parameter is optional. The default value is the buffer length. - **offset** (number): start position to write the data in the file. This parameter is optional. By default, data is written from the current position. - **encoding** (string): format of the data to be encoded when the data is a string. The default value is **'utf-8'**, which is the only value supported.|
**Return value**
-| Type | Description |
-| ------ | -------- |
-| number | Length of the data written in the file.|
+ | Type | Description |
+ | ------ | -------- |
+ | number | Length of the data written in the file.|
**Example**
@@ -2561,16 +2567,16 @@ Reads data from the stream. This API uses a promise to return the result.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ----------- | ---- | ---------------------------------------- |
-| buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
-| options | Object | No | The options are as follows: - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length. - **offset** (number): position of the data to read in the file. By default, data is read from the current position.|
+ | Name | Type | Mandatory | Description |
+ | ------- | ----------- | ---- | ---------------------------------------- |
+ | buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
+ | options | Object | No | The options are as follows: - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length. - **offset** (number): position of the data to read in the file. By default, data is read from the current position.|
**Return value**
-| Type | Description |
-| ---------------------------------- | ------ |
-| Promise<number> | Promise used to return the data read.|
+ | Type | Description |
+ | ---------------------------------- | ------ |
+ | Promise<number> | Promise used to return the data read.|
**Example**
@@ -2580,7 +2586,7 @@ Reads data from the stream. This API uses a promise to return the result.
let buf = new ArrayBuffer(4096);
ss.read(buf, {offset: 5, length: 5}).then((readLen) => {
console.info("Read data successfully");
- console.log(String.fromCharCode.apply(null, new Uint8Array(buf)));
+ console.log(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen))));
}).catch((err) => {
console.info("read data failed with error message: " + err.message + ", error code: " + err.code);
});
@@ -2597,11 +2603,11 @@ Reads data from the stream. This API uses an asynchronous callback to return the
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
-| buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
-| options | Object | No | The options are as follows: - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length. - **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.|
-| callback | AsyncCallback<number> | Yes | Callback invoked when data is read asynchronously from the stream. |
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | ---------------------------------------- |
+ | buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
+ | options | Object | No | The options are as follows: - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length. - **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position.|
+ | callback | AsyncCallback<number> | Yes | Callback invoked when data is read asynchronously from the stream. |
**Example**
@@ -2614,7 +2620,7 @@ Reads data from the stream. This API uses an asynchronous callback to return the
console.info("read stream failed with error message: " + err.message + ", error code: " + err.code);
} else {
console.info("Read data successfully");
- console.log(String.fromCharCode.apply(null, new Uint8Array(buf)));
+ console.log(String.fromCharCode.apply(null, new Uint8Array(buf.slice(0, readLen))));
}
});
```
@@ -2629,16 +2635,16 @@ Synchronously reads data from the stream.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ----------- | ---- | ---------------------------------------- |
-| buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
+ | Name | Type | Mandatory | Description |
+ | ------- | ----------- | ---- | ---------------------------------------- |
+ | buffer | ArrayBuffer | Yes | Buffer used to store the file read. |
| options | Object | No | The options are as follows: - **length** (number): length of the data to read. This parameter is optional. The default value is the buffer length. - **offset** (number): position of the data to read in the file. This parameter is optional. By default, data is read from the current position. |
**Return value**
-| Type | Description |
-| ------ | -------- |
-| number | Length of the data read.|
+ | Type | Description |
+ | ------ | -------- |
+ | number | Length of the data read.|
**Example**
@@ -2662,7 +2668,7 @@ Represents a **File** object opened by **open()**.
### lock
-lock(exclusive?: boolean): Promise;
+lock(exclusive?: boolean): Promise\;
Applies an exclusive lock or a shared lock on this file in blocking mode. This API uses a promise to return the result.
@@ -2670,15 +2676,15 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ----------- | ---- | ---------------------------------------- |
-| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. |
+ | Name | Type | Mandatory | Description |
+ | ------- | ----------- | ---- | ---------------------------------------- |
+ | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. |
**Return value**
-| Type | Description |
-| ---------------------------------- | ------ |
-| Promise<void> | Promise that returns no value.|
+ | Type | Description |
+ | ---------------------------------- | ------ |
+ | Promise<void> | Promise that returns no value.|
**Example**
@@ -2693,7 +2699,7 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A
### lock
-lock(exclusive?: boolean, callback: AsyncCallback): void;
+lock(exclusive?: boolean, callback: AsyncCallback\): void;
Applies an exclusive lock or a shared lock on this file in blocking mode. This API uses a promise to return the result.
@@ -2701,10 +2707,10 @@ Applies an exclusive lock or a shared lock on this file in blocking mode. This A
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ----------- | ---- | ---------------------------------------- |
-| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. |
-| callback | AsyncCallback<void> | Yes | Callback invoked when the file is locked. |
+ | Name | Type | Mandatory | Description |
+ | ------- | ----------- | ---- | ---------------------------------------- |
+ | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. |
+ | callback | AsyncCallback<void> | Yes | Callback invoked when the file is locked. |
**Example**
@@ -2729,9 +2735,9 @@ Applies an exclusive lock or a shared lock on this file in non-blocking mode.
**Parameters**
-| Name | Type | Mandatory | Description |
-| ------- | ----------- | ---- | ---------------------------------------- |
-| exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. |
+ | Name | Type | Mandatory | Description |
+ | ------- | ----------- | ---- | ---------------------------------------- |
+ | exclusive | boolean | No | Lock to apply. The value **true** means an exclusive lock, and the value **false** (default) means a shared lock. |
**Example**
@@ -2760,13 +2766,13 @@ Unlocks this file synchronously.
## Watcher10+
-Provides APIs for file or directory listening. Before using the APIs of **Watcher** , call **createWatcher()** to create a **Watcher** object.
+Provides APIs for observing the changes of files or folders. Before using the APIs of **Watcher** , call **createWatcher()** to create a **Watcher** object.
### start10+
start(): void
-Starts file or directory listening.
+Starts listening.
**System API**: This is a system API.
@@ -2785,7 +2791,7 @@ Starts file or directory listening.
stop(): void
-Stops file or directory listening.
+Stops listening.
**System API**: This is a system API.
diff --git a/en/application-dev/reference/apis/js-apis-file-picker.md b/en/application-dev/reference/apis/js-apis-file-picker.md
index 44e38fa5f4ef0b9b6af861ceb2ceeb1a8d126906..7b1b76c5e5a7d4ef0dd8601e5a525dbe10fd62a9 100644
--- a/en/application-dev/reference/apis/js-apis-file-picker.md
+++ b/en/application-dev/reference/apis/js-apis-file-picker.md
@@ -1,10 +1,10 @@
-# @ohos.file.picker (Picker)
+# @ohos.file.picker (File Picker)
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-**Picker** encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving images, videos, documents, and audio clips. The application can select the picker as required.
+The File Picker encapsulates system applications, such as **PhotoViewPicker**, **DocumentViewPicker**, and **AudioViewPicker**, and provides capabilities of selecting and saving photos, documents, and audio clips. The application can select the picker as required.
## Modules to Import
```js
@@ -378,7 +378,7 @@ Saves one or more documents in a **documentPicker** page. This API uses a promis
| Type | Description |
| ----------------------------- | :---- |
-| Promise<Array<string>> | Promise used to return the URIs of the documents saved.|
+| Promise<Array<string>> | Promise used to return the URIs of the documents saved.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-fileShare.md b/en/application-dev/reference/apis/js-apis-fileShare.md
new file mode 100644
index 0000000000000000000000000000000000000000..b9d9fb65f7c532d3ffd43ffdb195615b4c07b1aa
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-fileShare.md
@@ -0,0 +1,126 @@
+# @ohos.fileShare (File Sharing)
+
+The **fileShare** module provides APIs for granting the access permissions on a user file to another application by the Uniform Resource Identifier (URI). Then, the authorized application can access the file by using the APIs provided by [@ohos.file.fs](js-apis-file-fs.md).
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## Modules to Import
+
+```js
+import fileShare from '@ohos.fileShare';
+```
+
+## fileShare.grantUriPermission
+
+grantUriPermission(uri: string, bundleName: string, mode: number, callback: AsyncCallback<void>): void
+
+Grants permissions on a user file by the URI to an application. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.WRITE_MEDIA
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.FileManagement.AppFileService
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------------- |
+| uri | string | Yes | URI of a user file.|
+| bundleName | string | Yes | Bundle name of the application to be grated with the permissions.|
+| mode | number | Yes | Permissions to grant. For details, see [wantConstant.Flags](js-apis-app-ability-wantConstant.md#wantconstantflags). **wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION**: permission to read the file. **wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION**: permission to write the file.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. |
+
+**Error codes**
+
+For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md).
+
+| ID | Error Message |
+| ---------------------------- | ---------- |
+| 201 | Permission verification failed |
+| 202 | The caller is not a system application |
+| 401 | The input parameter is invalid |
+| 143000001 | IPC error |
+
+
+**Example**
+
+ ```js
+import wantConstant from '@ohos.app.ability.wantConstant';
+
+
+let uri = 'datashare:///media/image/8';
+let bundleName = 'com.demo.test';
+try {
+ fileShare.grantUriPermission(uri, bundleName, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION | wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION, (err) => {
+ if (err) {
+ console.error("grantUriPermission failed with error: " + err);
+ return;
+ }
+ console.info("grantUriPermission success!");
+ });
+} catch (error) {
+ console.error("grantUriPermission failed with error:" + error);
+}
+ ```
+
+
+## fileShare.grantUriPermission
+
+grantUriPermission(uri: string, bundleName: string, mode: number): Promise<void>
+
+Grants permissions on a user file by the URI to an application. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.WRITE_MEDIA
+
+**System API**: This is a system API.
+
+**System capability**: SystemCapability.FileManagement.AppFileService
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------------- |
+| uri | string | Yes | URI of a user file.|
+| bundleName | string | Yes | Bundle name of the application to be grated with the permissions.|
+| mode | number | Yes | Permissions to grant. For details, see [wantConstant.Flags](js-apis-app-ability-wantConstant.md#wantconstantflags). **wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION**: permission to read the file. **wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION**: permission to write the file.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------- | ---------- |
+| Promise<void> | Promise that returns no value.|
+
+
+**Error codes**
+
+For details about the error codes, see [File Management Error Codes](../errorcodes/errorcode-filemanagement.md).
+
+| ID | Error Message |
+| ---------------------------- | ---------- |
+| 201 | Permission verification failed |
+| 202 | The caller is not a system application |
+| 401 | The input parameter is invalid |
+| 143000001 | IPC error |
+
+
+**Example**
+
+ ```js
+import wantConstant from '@ohos.app.ability.wantConstant';
+
+let uri = 'datashare:///media/image/8';
+let bundleName = 'com.demo.test';
+try {
+ fileShare.grantUriPermission(uri, bundleName, wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION |
+ wantConstant.Flags.FLAG_AUTH_WRITE_URI_PERMISSION).then(function () {
+ console.info("grantUriPermission success!");
+ }).catch(function (error) {
+ console.error("grantUriPermission failed with error:" + error);
+ });
+} catch (error) {
+ console.error("grantUriPermission failed with error:" + error);
+}
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-geoLocationManager.md b/en/application-dev/reference/apis/js-apis-geoLocationManager.md
index 0d56943e531718578ac4d0238bb2f6770df277d7..263a1a525e0fa1dffcbd9e79703d2d359ac49dcc 100644
--- a/en/application-dev/reference/apis/js-apis-geoLocationManager.md
+++ b/en/application-dev/reference/apis/js-apis-geoLocationManager.md
@@ -1,6 +1,6 @@
# @ohos.geoLocationManager (Geolocation Manager)
-The **geoLocationManager** module provides a wide array of location services, including GNSS positioning, network positioning, geocoding, reverse geocoding, and geofencing.
+The **geoLocationManager** module provides location services such as Global Navigation Satellite System (GNSS)-based positioning, network positioning, geofencing, as well as geocoding and reverse geocoding.
> **NOTE**
>
@@ -21,14 +21,14 @@ If your application needs to access the device location information, it must fir
API versions earlier than 9: Apply for **ohos.permission.LOCATION**.
-API version 9 and later: Apply for **ohos.permission.APPROXIMATELY_LOCATION**, or apply for **ohos.permission.APPROXIMATELY_LOCATION** and **ohos.permission.LOCATION**. Note that **ohos.permission.LOCATION** cannot be applied for separately.
+API version 9 and later: Apply for **ohos.permission.APPROXIMATELY\_LOCATION**, or apply for **ohos.permission.APPROXIMATELY\_LOCATION** and **ohos.permission.LOCATION**. Note that **ohos.permission.LOCATION** cannot be applied for separately.
| API Version| Location Permission| Permission Application Result| Location Accuracy|
| -------- | -------- | -------- | -------- |
-| Earlier than 9| ohos.permission.LOCATION | Successful| Location accurate to meters.|
-| 9 and later| ohos.permission.LOCATION | Failed| No location obtained.|
-| 9 and later| ohos.permission.APPROXIMATELY_LOCATION | Successful| Location accurate to 5 kilometers.|
-| 9 and later| ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION| Successful| Location accurate to meters.|
+| Earlier than 9| ohos.permission.LOCATION | Success| Location accurate to meters|
+| 9 and later| ohos.permission.LOCATION | Failure| No location obtained|
+| 9 and later| ohos.permission.APPROXIMATELY_LOCATION | Success| Location accurate to 5 kilometers|
+| 9 and later| ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION| Success| Location accurate to meters|
If your application needs to access the device location information when running in the background, it must be configured to be able to run in the background and be granted the **ohos.permission.LOCATION_IN_BACKGROUND** permission. In this way, the system continues to report device location information after your application moves to the background.
@@ -99,7 +99,7 @@ Defines a geographic location.
| addressUrl | string | Yes| No| Website URL.|
| descriptions | Array<string> | Yes| No| Additional descriptions.|
| descriptionsSize | number | Yes| No| Total number of additional descriptions. The value must be greater than or equal to **0**. A value smaller than **10** is recommended.|
-| isFromMock | Boolean | Yes| No| Whether the geographic address is obtained from the mock reverse geocoding function. **System API**: This is a system API.|
+| isFromMock | Boolean | Yes| No| Whether the geographical name is from the mock reverse geocoding function. **System API**: This is a system API.|
## LocationRequest
@@ -229,12 +229,12 @@ Represents information of the mock reverse geocoding function.
| Name| Type| Readable|Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| location | [ReverseGeoCodeRequest](#reversegeocoderequest) | Yes| Yes| Latitude and longitude information.|
-| geoAddress | [GeoAddress](#geoaddress) | Yes| Yes|Geographic address.|
+| geoAddress | [GeoAddress](#geoaddress) | Yes| Yes|Geographical name.|
## LocationMockConfig
-Represents the mock location configuration.
+Represents the information of the mock location function.
**System capability**: SystemCapability.Location.Location.Core
@@ -267,25 +267,25 @@ Sets the priority of the location request.
| Name| Value| Description|
| -------- | -------- | -------- |
| UNSET | 0x200 | Priority unspecified. If this option is used, [LocationRequestPriority](#locationrequestpriority) is invalid.|
-| ACCURACY | 0x201 | Location accuracy preferred. This policy mainly uses the GNSS positioning technology. In an open area, the technology can achieve the meter-level location accuracy, depending on the hardware performance of the device. However, in a shielded environment, the location accuracy may significantly decrease.|
-| LOW_POWER | 0x202 | Power efficiency preferred. This policy mainly uses the base station positioning, WLAN positioning, and Bluetooth positioning technologies to obtain device location in both indoor and outdoor scenarios. The location accuracy depends on the distribution of surrounding base stations, visible WLANs, and Bluetooth devices and therefore may fluctuate greatly. This policy is recommended and can reduce power consumption when your application does not require high location accuracy or when base stations, visible WLANs, and Bluetooth devices are densely distributed.|
+| ACCURACY | 0x201 | Location accuracy. This policy mainly uses the GNSS positioning technology. In an open area, the technology can achieve the meter-level location accuracy, depending on the hardware performance of the device. However, in a shielded environment, the location accuracy may significantly decrease.|
+| LOW_POWER | 0x202 | Power efficiency. This policy mainly uses the base station positioning, WLAN positioning, and Bluetooth positioning technologies to obtain device location in both indoor and outdoor scenarios. The location accuracy depends on the distribution of surrounding base stations, visible WLANs, and Bluetooth devices and therefore may fluctuate greatly. This policy is recommended and can reduce power consumption when your application does not require high location accuracy or when base stations, visible WLANs, and Bluetooth devices are densely distributed.|
| FIRST_FIX | 0x203 | Fast location preferred. Use this option if you want to obtain a location as fast as possible. This policy uses the GNSS positioning, base station positioning, WLAN positioning, and Bluetooth positioning technologies simultaneously to obtain the device location in both the indoor and outdoor scenarios. When all positioning technologies provide a location result, the system provides the most accurate location result for your application. It can lead to significant hardware resource consumption and power consumption.|
## LocationRequestScenario
-Sets the scenario of the location request.
+ Sets the scenario of the location request.
**System capability**: SystemCapability.Location.Location.Core
| Name| Value| Description|
| -------- | -------- | -------- |
| UNSET | 0x300 | Scenario unspecified. If this option is used, [LocationRequestScenario](#locationrequestscenario) is invalid.|
-| NAVIGATION | 0x301 | Navigation scenario. This option is applicable when your application needs to obtain the real-time location of a mobile device outdoors, such as navigation for driving or walking. In this scenario, GNSS positioning is used to provide location services to ensure the optimal location accuracy of the system. The location result is reported at a minimum interval of 1 second by default.|
-| TRAJECTORY_TRACKING | 0x302 | Trajectory tracking scenario. This option is applicable when your application needs to record user trajectories, for example, the track recording function of sports applications. In this scenario, the GNSS positioning technology is mainly used to ensure the location accuracy. The location result is reported at a minimum interval of 1 second by default.|
-| CAR_HAILING | 0x303 | Ride hailing scenario. This option is applicable when your application needs to obtain the current location of a user who is hailing a taxi. The location result is reported at a minimum interval of 1 second by default.|
-| DAILY_LIFE_SERVICE | 0x304 | Daily life service scenario. This option is applicable when your application only needs the approximate user location for recommendations and push notifications in scenarios such as when the user is browsing news, shopping online, and ordering food. The location result is reported at a minimum interval of 1 second by default.|
-| NO_POWER | 0x305 | Power efficiency scenario. This option is applicable when your application does not proactively start the location service. When responding to another application requesting the same location service, the system marks a copy of the location result to your application. In this way, your application will not consume extra power for obtaining the user location.|
+| NAVIGATION | 0x301 | Navigation. This option is applicable when your application needs to obtain the real-time location of a mobile device outdoors, such as navigation for driving or walking. In this scenario, GNSS positioning is used to provide location services to ensure the optimal location accuracy of the system. The location result is reported at a minimum interval of 1 second by default.|
+| TRAJECTORY_TRACKING | 0x302 | Trajectory tracking. This option is applicable when your application needs to record user trajectories, for example, the track recording function of sports applications. In this scenario, the GNSS positioning technology is mainly used to ensure the location accuracy. The location result is reported at a minimum interval of 1 second by default.|
+| CAR_HAILING | 0x303 | Ride hailing. This option is applicable when your application needs to obtain the current location of a user who is hailing a taxi. The location result is reported at a minimum interval of 1 second by default.|
+| DAILY_LIFE_SERVICE | 0x304 | Daily life services. This option is applicable when your application only needs the approximate user location for recommendations and push notifications in scenarios such as when the user is browsing news, shopping online, and ordering food. The location result is reported at a minimum interval of 1 second by default.|
+| NO_POWER | 0x305 | Power efficiency. Your application does not proactively start the location service. When responding to another application requesting the same location service, the system marks a copy of the location result to your application. In this way, your application will not consume extra power for obtaining the user location.|
## LocationPrivacyType
@@ -299,7 +299,7 @@ Defines the privacy statement type.
| Name| Value| Description|
| -------- | -------- | -------- |
| OTHERS | 0 | Other scenarios. Reserved field.|
-| STARTUP | 1 | Privacy statement displayed in the startup wizard. |
+| STARTUP | 1 | Privacy statement displayed in the startup wizard. The user needs to choose whether to agree with the statement.|
| CORE_LOCATION | 2 | Privacy statement displayed when enabling the location service.|
@@ -323,7 +323,7 @@ on(type: 'locationChange', request: LocationRequest, callback: Callback<Locat
Registers a listener for location changes with a location request initiated.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Core
@@ -368,7 +368,7 @@ off(type: 'locationChange', callback?: Callback<Location>): void
Unregisters the listener for location changes with the corresponding location request deleted.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Core
@@ -489,7 +489,7 @@ on(type: 'cachedGnssLocationsChange', request: CachedGnssLocationsRequest, callb
Registers a listener for cached GNSS location reports.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -533,7 +533,7 @@ off(type: 'cachedGnssLocationsChange', callback?: Callback<Array<Location&
Unregisters the listener for cached GNSS location reports.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -577,7 +577,7 @@ on(type: 'satelliteStatusChange', callback: Callback<SatelliteStatusInfo>)
Registers a listener for GNSS satellite status change events.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -619,7 +619,7 @@ off(type: 'satelliteStatusChange', callback?: Callback<SatelliteStatusInfo>
Unregisters the listener for GNSS satellite status change events.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -662,7 +662,7 @@ on(type: 'nmeaMessage', callback: Callback<string>): void;
Registers a listener for GNSS NMEA message change events.
-**Permission required**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
+**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -705,7 +705,7 @@ off(type: 'nmeaMessage', callback?: Callback<string>): void;
Unregisters the listener for GNSS NMEA message change events.
-**Permission required**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
+**Required permissions**: ohos.permission.LOCATION and ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -749,7 +749,7 @@ on(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): vo
Registers a listener for status change events of the specified geofence.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Geofence
@@ -807,7 +807,7 @@ off(type: 'gnssFenceStatusChange', request: GeofenceRequest, want: WantAgent): v
Unregisters the listener for status change events of the specified geofence.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Geofence
@@ -840,7 +840,7 @@ For details about the following error codes, see [Location Error Codes](../error
{
bundleName: "com.example.myapplication",
abilityName: "EntryAbility",
- action: "action1"
+ action: "action1",
}
],
operationType: wantAgent.OperationType.START_ABILITY,
@@ -882,7 +882,6 @@ For details about the following error codes, see [Location Error Codes](../error
| ID| Error Message|
| -------- | ---------------------------------------- |
|3301000 | Location service is unavailable. |
-|3301100 | The location switch is off. |
|3301500 | Failed to query the area information. |
@@ -924,7 +923,6 @@ For details about the following error codes, see [Location Error Codes](../error
| ID| Error Message|
| -------- | ---------------------------------------- |
|3301000 | Location service is unavailable. |
-|3301100 | The location switch is off. |
|3301500 | Failed to query the area information. |
**Example**
@@ -951,7 +949,7 @@ getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<L
Obtains the current location. This API uses an asynchronous callback to return the result.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Core
@@ -999,7 +997,7 @@ getCurrentLocation(callback: AsyncCallback<Location>): void;
Obtains the current location. This API uses an asynchronous callback to return the result.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Core
@@ -1045,7 +1043,7 @@ getCurrentLocation(request?: CurrentLocationRequest): Promise<Location>
Obtains the current location. This API uses a promise to return the result.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Core
@@ -1095,7 +1093,7 @@ getLastLocation(): Location
Obtains the last location.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Core
@@ -1282,7 +1280,7 @@ For details about the following error codes, see [Location Error Codes](../error
getAddressesFromLocation(request: ReverseGeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void
-Converts coordinates into geographic descriptions through reverse geocoding. This API uses an asynchronous callback to return the result.
+Converts coordinates into geographic description through reverse geocoding. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Location.Location.Geocoder
@@ -1326,7 +1324,7 @@ For details about the following error codes, see [Location Error Codes](../error
getAddressesFromLocation(request: ReverseGeoCodeRequest): Promise<Array<GeoAddress>>;
-Converts coordinates into geographic descriptions through reverse geocoding. This API uses a promise to return the result.
+Converts coordinates into geographic description through reverse geocoding. This API uses a promise to return the result.
**System capability**: SystemCapability.Location.Location.Geocoder
@@ -1373,7 +1371,7 @@ For details about the following error codes, see [Location Error Codes](../error
getAddressesFromLocationName(request: GeoCodeRequest, callback: AsyncCallback<Array<GeoAddress>>): void
-Converts geographic descriptions into coordinates through geocoding. This API uses an asynchronous callback to return the result.
+Converts geographic description into coordinates through geocoding. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Location.Location.Geocoder
@@ -1417,7 +1415,7 @@ For details about the following error codes, see [Location Error Codes](../error
getAddressesFromLocationName(request: GeoCodeRequest): Promise<Array<GeoAddress>>
-Converts geographic descriptions into coordinates through geocoding. This API uses a promise to return the result.
+Converts geographic description into coordinates through geocoding. This API uses a promise to return the result.
**System capability**: SystemCapability.Location.Location.Geocoder
@@ -1499,7 +1497,7 @@ getCachedGnssLocationsSize(callback: AsyncCallback<number>): void;
Obtains the number of cached GNSS locations.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -1543,7 +1541,7 @@ getCachedGnssLocationsSize(): Promise<number>;
Obtains the number of cached GNSS locations.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -1585,7 +1583,7 @@ flushCachedGnssLocations(callback: AsyncCallback<void>): void;
Obtains all cached GNSS locations and clears the GNSS cache queue.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -1627,7 +1625,7 @@ flushCachedGnssLocations(): Promise<void>;
Obtains all cached GNSS locations and clears the GNSS cache queue.
-**Required permissions**: ohos.permission.APPROXIMATELY_LOCATION
+**Permission required**: ohos.permission.APPROXIMATELY_LOCATION
**System capability**: SystemCapability.Location.Location.Gnss
@@ -2007,7 +2005,7 @@ For details about the following error codes, see [Location Error Codes](../error
setReverseGeocodingMockInfo(mockInfos: Array<ReverseGeocodingMockInfo>): void;
-Sets information of the mock reverse geocoding function, including the mapping between a location and geographic name. If the location is contained in the configurations during reverse geocoding query, the corresponding geographic name will be returned.
+Sets information of the mock reverse geocoding function, including the mapping between a location and geographical name. If the location is contained in the configurations during reverse geocoding query, the corresponding geographical name will be returned.
This API can be invoked only after [geoLocationManager.enableReverseGeocodingMock](#geolocationmanagerenablereversegeocodingmock) is called.
@@ -2019,7 +2017,7 @@ This API can be invoked only after [geoLocationManager.enableReverseGeocodingMoc
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | mockInfos | Array<[ReverseGeocodingMockInfo](#reversegeocodingmockinfo)> | Yes| Array of information of the mock reverse geocoding function, including a location and a geographic address.|
+ | mockInfos | Array<[ReverseGeocodingMockInfo](#reversegeocodingmockinfo)> | Yes| Array of information of the mock reverse geocoding function, including a location and a geographical name.|
**Error codes**
@@ -2069,7 +2067,7 @@ Checks whether a user agrees with the privacy statement of the location service.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | boolean | boolean | NA | Whether the user agrees with the privacy statement.|
+ | boolean | boolean | NA | Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
**Error codes**
@@ -2108,7 +2106,7 @@ Sets the user confirmation status for the privacy statement of the location serv
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| type | [LocationPrivacyType](#locationprivacytype) | Yes| Privacy statement type, for example, privacy statement displayed in the startup wizard or privacy statement displayed when the location service is enabled.|
- | isConfirmed | boolean | Yes| Whether the user agrees with the privacy statement.|
+ | isConfirmed | boolean | Yes| Callback used to return the result, which indicates whether the user agrees with the privacy statement.|
**Error codes**
diff --git a/en/application-dev/reference/apis/js-apis-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiappevent.md
index 260c8c541809f723cee63a3cf7f7ce9374ff886d..e2ff3f6fa98d46577475cdaa86222b0eb3522b1f 100644
--- a/en/application-dev/reference/apis/js-apis-hiappevent.md
+++ b/en/application-dev/reference/apis/js-apis-hiappevent.md
@@ -1,8 +1,9 @@
# @ohos.hiAppEvent (Application Event Logging)
-The HiAppEvent module provides the application event logging functions, such as writing application events to the event file and managing the event logging configuration.
+The **hiAppEvent** module provides the application event logging functions, such as writing application events to the event file and managing the event logging configuration.
> **NOTE**
+>
> - The APIs provided by this module are deprecated since API version 9. You are advised to use [`@ohos.hiviewdfx.hiAppEvent`](js-apis-hiviewdfx-hiappevent.md) instead.
> - 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.
@@ -19,7 +20,7 @@ Before using application event logging, you need to understand the requirements
**Event Name**
-An event name is a string that contains a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).
+An event name is a string that contains a maximum of 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (\_).
**Event Type**
@@ -30,9 +31,10 @@ An event type is an enumerated value of [EventType](#eventtype).
An event parameter is an object in key-value pair format, where the key is the parameter name and the value is the parameter value. The requirements are as follows:
- A parameter name is a string that contains a maximum of 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (\_).
-- The parameter value is a string, number, boolean, or array.
-- When the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be truncated.
-- When the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded.
+- The parameter value can be of the string, number, boolean, or array type.
+- If the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be discarded.
+- If the parameter value is a number, the value must be within the range of **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. Otherwise, uncertain values may be generated.
+- If the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded.
- The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded.
**Event Callback**
diff --git a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md
index 2960e201db397e160dfc5cca7e1c729beebcb6a4..03cad26cfecb5295b611d48fbc9f69862895ddb0 100644
--- a/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md
+++ b/en/application-dev/reference/apis/js-apis-hiviewdfx-hiappevent.md
@@ -1,6 +1,6 @@
# @ohos.hiviewdfx.hiAppEvent (Application Event Logging)
-This module provides application event-related functions, including flushing application events to a disk, querying and clearing application events, and customizing application event logging configuration.
+The **hiAppEvent** module provides application event-related functions, including flushing application events to a disk, querying and clearing application events, and customizing application event logging configuration.
> **NOTE**
>
@@ -120,12 +120,12 @@ Defines parameters for an **AppEventInfo** object.
**System capability**: SystemCapability.HiviewDFX.HiAppEvent
-| Name | Type | Mandatory| Description |
-| --------- | ----------------------- | ---- | ---------- |
-| domain | string | Yes | Event domain.|
-| name | string | Yes | Event name.|
-| eventType | [EventType](#eventtype) | Yes | Event type.|
-| params | object | Yes | Event parameters.|
+| Name | Type | Mandatory| Description |
+| --------- | ----------------------- | ---- | ------------------------------------------------------------ |
+| domain | string | Yes | Event domain. Event domain name, which is a string of up to 32 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).|
+| name | string | Yes | Event name. Event name, which is a string of up to 48 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_).|
+| eventType | [EventType](#eventtype) | Yes | Event type. |
+| params | object | Yes | Event parameter object, which consists of a parameter name and a parameter value. The specifications are as follows: - The parameter name is a string of up to 16 characters, including digits (0 to 9), letters (a to z), and underscores (\_). It must start with a lowercase letter and cannot end with an underscore (_). - The parameter value can be a string, number, boolean, or array. If the parameter value is a string, its maximum length is 8*1024 characters. If this limit is exceeded, excess characters will be discarded. If the parameter value is a number, the value must be within the range of **Number.MIN_SAFE_INTEGER** to **Number.MAX_SAFE_INTEGER**. Otherwise, uncertain values may be generated. If the parameter value is an array, the elements in the array must be of the same type, which can only be string, number, or boolean. In addition, the number of elements must be less than 100. If this limit is exceeded, excess elements will be discarded. - The maximum number of parameters is 32. If this limit is exceeded, excess parameters will be discarded.|
## hiAppEvent.configure
diff --git a/en/application-dev/reference/apis/js-apis-http.md b/en/application-dev/reference/apis/js-apis-http.md
index f88c44972c8576f5d1800611ec058a86ed5be489..820cba210b6b8b43578733c1a2eb060177aa5995 100644
--- a/en/application-dev/reference/apis/js-apis-http.md
+++ b/en/application-dev/reference/apis/js-apis-http.md
@@ -1,6 +1,6 @@
# @ohos.net.http (Data Request)
-The **http** module provides the HTTP data request capability. An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**.
+This module provides the HTTP data request capability. An application can initiate a data request over HTTP. Common HTTP methods include **GET**, **POST**, **OPTIONS**, **HEAD**, **PUT**, **DELETE**, **TRACE**, and **CONNECT**.
>**NOTE**
>
@@ -13,10 +13,10 @@ The **http** module provides the HTTP data request capability. An application ca
import http from '@ohos.net.http';
```
-## Examples
+## Example
```js
-// Import the HTTP namespace.
+// Import the http namespace.
import http from '@ohos.net.http';
// Each httpRequest corresponds to an HTTP request task and cannot be reused.
@@ -27,7 +27,7 @@ httpRequest.on('headersReceive', (header) => {
console.info('header: ' + JSON.stringify(header));
});
httpRequest.request(
- // Customize EXAMPLE_URL in extraData on your own. It is up to you whether to add parameters to the URL.
+ // Customize EXAMPLE_URL on your own. It is up to you whether to add parameters to the URL.
"EXAMPLE_URL",
{
method: http.RequestMethod.POST, // Optional. The default value is http.RequestMethod.GET.
@@ -67,7 +67,7 @@ httpRequest.request(
## http.createHttp
-createHttp\(\): HttpRequest
+createHttp(): HttpRequest
Creates an HTTP request. You can use this API to initiate or destroy an HTTP request, or enable or disable listening for HTTP Response Header events. An HttpRequest object corresponds to an HTTP request. To initiate multiple HTTP requests, you must create an **HttpRequest** object for each HTTP request.
@@ -77,7 +77,7 @@ Creates an HTTP request. You can use this API to initiate or destroy an HTTP req
| Type | Description |
| :---------- | :----------------------------------------------------------- |
-| HttpRequest | An **HttpRequest** object, which contains the **request**, **destroy**, **on**, or **off** method.|
+| HttpRequest | An **HttpRequest** object, which contains the **request**, **request2**, **destroy**, **on**, or **off** method.|
**Example**
@@ -88,14 +88,17 @@ let httpRequest = http.createHttp();
## HttpRequest
-Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp\(\)](#httpcreatehttp) to create an **HttpRequestTask** object.
+Defines an HTTP request task. Before invoking APIs provided by **HttpRequest**, you must call [createHttp()](#httpcreatehttp) to create an **HttpRequestTask** object.
### request
-request\(url: string, callback: AsyncCallback\\):void
+request(url: string, callback: AsyncCallback\):void
Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result.
+>**NOTE**
+>This API supports only transfer of data not greater than 5 MB.
+
**Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetStack
@@ -109,7 +112,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
**Error codes**
-| ID | Error Message |
+| Code | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
@@ -140,10 +143,13 @@ httpRequest.request("EXAMPLE_URL", (err, data) => {
### request
-request\(url: string, options: HttpRequestOptions, callback: AsyncCallback\\):void
+request(url: string, options: HttpRequestOptions, callback: AsyncCallback\):void
Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result.
+>**NOTE**
+>This API supports only transfer of data not greater than 5 MB.
+
**Required permissions**: ohos.permission.INTERNET
**System capability**: SystemCapability.Communication.NetStack
@@ -158,7 +164,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes**
-| ID | Error Message |
+| Code | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
@@ -223,9 +229,12 @@ httpRequest.request("EXAMPLE_URL",
### request
-request\(url: string, options? : HttpRequestOptions\): Promise\
+request(url: string, options? : HttpRequestOptions): Promise\
-Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result.
+Initiates an HTTP request to a given URL. This API uses a promise to return the result.
+
+>**NOTE**
+>This API supports only transfer of data not greater than 5 MB.
**Required permissions**: ohos.permission.INTERNET
@@ -246,7 +255,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes**
-| ID | Error Message |
+| Code | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
@@ -309,7 +318,7 @@ promise.then((data) => {
### destroy
-destroy\(\): void
+destroy(): void
Destroys an HTTP request.
@@ -323,7 +332,7 @@ httpRequest.destroy();
### request210+
-request2(url: string, callback: AsyncCallback): void
+request2(url: string, callback: AsyncCallback\): void
Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
@@ -340,7 +349,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
**Error codes**
-| ID | Error Message |
+| Code | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
@@ -359,7 +368,7 @@ Initiates an HTTP request to a given URL. This API uses an asynchronous callback
```js
httpRequest.request2("EXAMPLE_URL", (err) => {
if (!err) {
- console.info(request2 OK!);
+ console.info("request2 OK!");
} else {
console.info("request2 ERROR : err = " + JSON.stringify(err));
}
@@ -368,9 +377,9 @@ httpRequest.request2("EXAMPLE_URL", (err) => {
### request210+
-request2(url: string, options: HttpRequestOptions, callback: AsyncCallback): void
+request2(url: string, options: HttpRequestOptions, callback: AsyncCallback\): void
-Initiates an HTTP request containing specified options to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
+Initiates an HTTP request to a given URL. This API uses an asynchronous callback to return the result, which is a streaming response.
**Required permissions**: ohos.permission.INTERNET
@@ -386,7 +395,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes**
-| ID | Error Message |
+| Code | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
@@ -437,7 +446,7 @@ httpRequest.request2("EXAMPLE_URL",
connectTimeout: 60000
}, (err) => {
if (!err) {
- console.info(request2 OK!);
+ console.info("request2 OK!");
} else {
console.info("request2 ERROR : err = " + JSON.stringify(err));
}
@@ -445,7 +454,7 @@ httpRequest.request2("EXAMPLE_URL",
```
### request210+
-request2\(url: string, options? : HttpRequestOptions\): Promise\
+request2(url: string, options? : HttpRequestOptions): Promise\
Initiates an HTTP request containing specified options to a given URL. This API uses a promise to return the result, which is a streaming response.
@@ -468,7 +477,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
**Error codes**
-| ID | Error Message |
+| Code | Error Message |
|---------|-------------------------------------------------------|
| 401 | Parameter error. |
| 201 | Permission denied. |
@@ -504,7 +513,7 @@ Initiates an HTTP request containing specified options to a given URL. This API
>**NOTE**
> For details about the error codes, see [HTTP Error Codes](../errorcodes/errorcode-net-http.md).
-> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see:
+> The HTTP error code mapping is in the format of 2300000 + Curl error code. For more common error codes, see [Curl Error Codes](https://curl.se/libcurl/c/libcurl-errors.html).
**Example**
@@ -518,20 +527,20 @@ let promise = httpRequest.request("EXAMPLE_URL", {
}
});
promise.then(() => {
- console.info(request2 OK!);
+ console.info("request2 OK!");
}).catch((err) => {
console.info("request2 ERROR : err = " + JSON.stringify(err));
});
```
-### on\('headerReceive'\)
+### on('headerReceive')
-on\(type: 'headerReceive', callback: AsyncCallback