diff --git a/CODEOWNERS b/CODEOWNERS
index ca2ba48baa68fb4990cc3e34fcf9ee5537ef1c28..a98eba13b7b574232201efd76d84579561a42ccd 100644
--- a/CODEOWNERS
+++ b/CODEOWNERS
@@ -23,11 +23,17 @@ zh-cn/device-dev/quick-start/ @li-yan339
zh-cn/device-dev/driver/ @li-yan339
zh-cn/device-dev/get-code/ @li-yan339
zh-cn/device-dev/hpm-part/ @duangavin123_admin
-zh-cn/device-dev/subsystems/subsys-build-mini-lite.md @Austin23
-zh-cn/device-dev/subsystems/subsys-build-standard-large.md @Austin23
-zh-cn/device-dev/subsystems/subsys-build-gn-coding-style-and-best-practice.md @Austin23
-zh-cn/device-dev/subsystems/subsys-build-gn-kconfig-visual-config-guid.md @Austin23
-zh-cn/device-dev/subsystems/subsys-build-gn-hap-compilation-guide.md @Austin23
+zh-cn/device-dev/reference/hdi-apis/ @li-yan339
+zh-cn/device-dev/quick-start/quickstart-standard-env-setup.md @li-yan339 @chenmudan
+zh-cn/device-dev/quick-start/quickstart-lite-env-setup.md @li-yan339 @chenmudan
+zh-cn/device-dev/porting/porting-thirdparty-overview.md @Austin23 @chenmudan
+zh-cn/device-dev/porting/porting-thirdparty-makefile.md @Austin23 @chenmudan
+zh-cn/device-dev/porting/porting-thirdparty-cmake.md @Austin23 @chenmudan
+zh-cn/device-dev/subsystems/subsys-build-mini-lite.md @Austin23 @chenmudan
+zh-cn/device-dev/subsystems/subsys-build-standard-large.md @Austin23 @chenmudan
+zh-cn/device-dev/subsystems/subsys-build-gn-coding-style-and-best-practice.md @Austin23 @chenmudan
+zh-cn/device-dev/subsystems/subsys-build-gn-kconfig-visual-config-guid.md @Austin23 @chenmudan
+zh-cn/device-dev/subsystems/subsys-build-gn-hap-compilation-guide.md @Austin23 @chenmudan
zh-cn/device-dev/subsystems/subsys-remote-start.md @duangavin123_admin
zh-cn/device-dev/subsystems/subsys-graphics-overview.md @duangavin123_admin
zh-cn/device-dev/subsystems/subsys-graphics-container-guide.md @duangavin123_admin
@@ -45,7 +51,7 @@ zh-cn/device-dev/subsystems/subsys-utils-overview.md @Austin23
zh-cn/device-dev/subsystems/subsys-utils-guide.md @Austin23
zh-cn/device-dev/subsystems/subsys-utils-faqs.md @Austin23
zh-cn/device-dev/subsystems/subsys-aiframework-guide.md @Austin23
-zh-cn/device-dev/subsystems/subsys-aiframework-envbuild.md @Austin23
+zh-cn/device-dev/subsystems/subsys-aiframework-envbuild.md @Austin23
zh-cn/device-dev/subsystems/subsys-aiframework-tech-codemanage.md @Austin23
zh-cn/device-dev/subsystems/subsys-aiframework-tech-name.md @Austin23
zh-cn/device-dev/subsystems/subsys-aiframework-tech-interface.md @Austin23
@@ -79,14 +85,19 @@ zh-cn/device-dev/subsystems/subsys-security-sigverify.md @duangavin123_admin
zh-cn/device-dev/subsystems/subsys-security-rightmanagement.md @duangavin123_admin
zh-cn/device-dev/subsystems/subsys-security-communicationverify.md @duangavin123_admin
zh-cn/device-dev/subsystems/subsys-security-devicesecuritylevel.md @duangavin123_admin
-zh-cn/device-dev/subsystems/subsys-boot-overview.md @Austin23
-zh-cn/device-dev/subsystems/subsys-boot-init.md @Austin23
zh-cn/device-dev/subsystems/subsys-boot-appspawn.md @Austin23
-zh-cn/device-dev/subsystems/subsys-boot-appspawn-standard.md @Austin23
zh-cn/device-dev/subsystems/subsys-boot-bootstrap.md @Austin23
-zh-cn/device-dev/subsystems/subsys-boot-syspara.md @Austin23
zh-cn/device-dev/subsystems/subsys-boot-faqs.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot-init-cfg.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot-init-jobs.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot-init-plugin.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot-init-sandbox.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot-init-service.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot-init-sysparam.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot-init.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot-overview.md @Austin23
zh-cn/device-dev/subsystems/subsys-boot-ref.md @Austin23
+zh-cn/device-dev/subsystems/subsys-boot.md @Austin23
zh-cn/device-dev/subsystems/subsys-testguide-test.md @Austin23
zh-cn/device-dev/subsystems/subsys-dfx-overview.md @duangavin123_admin
zh-cn/device-dev/subsystems/subsys-dfx-hilog-rich.md @duangavin123_admin
@@ -200,7 +211,7 @@ zh-cn/application-dev/reference/apis/js-apis-screenshot.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-window.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-screen.md @ge-yafang
-zh-cn/application-dev/reference/apis/js-apis-application-WindowExtensionAbility.md @ge-yafang
+zh-cn/application-dev/reference/apis/js-apis-windowAnimationManager.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-webgl.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-webgl2.md @ge-yafang
zh-cn/application-dev/reference/apis/js-apis-audio.md @zengyawen
diff --git a/README_zh.md b/README_zh.md
index 3c65434aac3acaee899db2e1eba85e61c03de5a5..ebf1bc8d7557d35f99eaacf8fd1427972d61d3b0 100644
--- a/README_zh.md
+++ b/README_zh.md
@@ -18,7 +18,7 @@
- master:最新开发版本。
- - OpenHarmony 3.2 Beta1版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.2-beta1.md)了解版本详情。
+ - OpenHarmony 3.2 Beta2版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.2-beta2.md)了解版本详情。
- OpenHarmony 3.1 Release版本:点击[此处](zh-cn/release-notes/OpenHarmony-v3.1-release.md)了解版本详情。
diff --git a/en/OpenHarmony-Overview.md b/en/OpenHarmony-Overview.md
index c9eff6c8fe752a73cc4b8a2837ffe2a8ee7c0f0f..6d25dfc5658b20f7005c59287d4475f3eb4e5071 100644
--- a/en/OpenHarmony-Overview.md
+++ b/en/OpenHarmony-Overview.md
@@ -1,202 +1,205 @@
# OpenHarmony Project
-## Introduction
+## Introduction
-OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. It is an open-source operating system with a framework and platform applicable to smart devices in all scenarios of a fully-connected world. It aims to promote the development of the Internet of Everything (IoE).
+OpenHarmony is an open-source project incubated and operated by the OpenAtom Foundation. The purpose of this project is to build an open-source, distributed operating system (OS) framework for smart devices in all scenarios of a fully-connected world.
-## Technical Architecture
+## Technical Architecture
-OpenHarmony is designed with a layered architecture, which from bottom to top, consists of the kernel layer, system service layer, framework layer, and application layer. System functions are expanded by levels, from system to subsystem, and further to module. In a multi-device deployment scenario, unnecessary modules can be excluded from the system as required. The following figure shows the technical architecture of OpenHarmony.
+OpenHarmony is designed with a layered architecture, which consists of the kernel layer, system service layer, framework layer, and application layer from the bottom up. System functions are expanded by levels, from system to subsystem, and further to component. In a multi-device deployment scenario, unnecessary components can be excluded from the system as required. The following figure shows the technical architecture of OpenHarmony.

**Kernel layer**
-- Kernel subsystem: OpenHarmony uses a multi-kernel design \(Linux or LiteOS\) so that different kernels can be selected for devices with different resource limitations. The kernel abstraction layer \(KAL\) hides differences in kernel implementations and provides the upper layer with basic kernel capabilities, including process and thread management, memory management, file system, network management, and peripheral management.
+- Kernel subsystem: OpenHarmony uses a multi-kernel design (Linux or LiteOS) so that different kernels can be selected for devices with different resource limitations. The kernel abstraction layer (KAL) hides differences in kernel implementations and provides the upper layer with basic kernel capabilities, including process and thread management, memory management, file system, network management, and peripheral management.
-- Driver subsystem: Hardware Driver Foundation \(HDF\) lays the foundation for an open OpenHarmony hardware ecosystem. It allows for unified access from peripheral devices and provides foundation for driver development and management.
+- Driver subsystem: Hardware Driver Foundation (HDF) lays the foundation for an open OpenHarmony hardware ecosystem. It allows for unified access from peripheral devices and provides foundation for driver development and management.
**System service layer**
-The system service layer provides a complete set of capabilities essential for OpenHarmony to offer services for apps through the framework layer. This layer consists of the following parts:
+The system service layer provides a complete set of capabilities essential for OpenHarmony to offer services for applications through the framework layer. This layer consists of the following parts:
-- Basic system capability subsystem set: Implements distributed app running, scheduling, and migration across OpenHarmony devices. This subsystem set provides the following basic capabilities: Distributed Soft Bus (DSoftBus), distributed data management, Distributed Scheduler, Utils, multimodal input, graphics, security, and AI.
+- Basic system capability subsystem set: Implements distributed application running, scheduling, and migration across OpenHarmony devices. This subsystem set provides the following basic capabilities: Distributed Soft Bus (DSoftBus), distributed data management, Distributed Scheduler, Utils, multimodal input, graphics, security, and AI.
-- Basic software service subsystem set: Provides OpenHarmony with common universal software services, including common event and notification, telephony, multimedia, and Design For X \(DFX\).
+- Basic software service subsystem set: Provides OpenHarmony with common universal software services, including common event and notification, telephony, multimedia, and Design For X (DFX).
-- Enhanced software service subsystem set: Provides OpenHarmony with differentiated enhanced software services, including those dedicated to smart TVs, wearables, IoT devices, and more.
+- Enhanced software service subsystem set: Provides OpenHarmony with differentiated enhanced software services, including those dedicated to smart TVs, wearables, IoT devices, and more.
-- Hardware service subsystem set: Provides OpenHarmony with hardware services, including location, IAM, as well as those dedicated to wearables and IoT devices.
+- Hardware service subsystem set: Provides OpenHarmony with hardware services, including location, user IAM, as well as those dedicated to wearables and IoT devices.
-The basic software service, enhanced software service, and hardware service subsystem sets can be modified by the subsystems, and each subsystem can be modified by various functions, depending on the deployment scenario for a particular device form.
+The basic software service, enhanced software service, and hardware service subsystem sets can be tailored by subsystems, and each subsystem can be tailored by functions, depending on the deployment scenario for a particular device form.
**Framework layer**
-This layer provides with what you need to develop OpenHarmony apps: application framework and ability framework, specific to multiple languages \(like C, C++, and JS\), ArkUI framework, as well as multi-language APIs for hardware and software services. The APIs designed for different OpenHarmony devices can be modified based on various system components.
+This layer provides with what you need to develop OpenHarmony applications: application framework and ability framework specific to multiple languages (like C, C++, and JS), JS-specific ArkUI framework, as well as multi-language APIs for hardware and software services. The APIs designed for different OpenHarmony devices vary according to the components in use.
**Application layer**
-This layer consists of system apps and third-party apps. Each OpenHarmony app is powered by one or more Feature Abilities \(FAs\) or Particle Abilities \(PAs\). An FA provides a UI for user interaction. A PA has no UI and provides background task processing as well as data access. Apps developed based on FAs and PAs provide specific service characteristics and enable cross-device scheduling and distribution, delighting users with consistent and efficient experience.
+This layer consists of system applications and third-party applications. Each OpenHarmony application is powered by one or more Feature Abilities (FAs) or Particle Abilities (PAs). An FA provides a UI for user interaction. A PA has no UI and provides background task processing as well as data access. Applications developed based on FAs and PAs provide specific service characteristics and enable cross-device scheduling and distribution, delighting users with consistent and efficient experience.
-## Technical Features
+## Technical Features
**Hardware collaboration and resource sharing**
This feature is implemented through the following modules:
-- DSoftBus
+- DSoftBus
- DSoftBus is a unified base for seamless interconnection among devices. It powers OpenHarmony with distributed communication capabilities to quickly discover and connect devices, and efficiently transmit data.
+ DSoftBus is a unified base for seamless interconnection among devices. It powers OpenHarmony with distributed communication capabilities to quickly discover and connect devices, and efficiently transmit data.
-- Distributed data management
-
- DSoftBus manages apps and user data distributed across different devices. Under such management, user data is no longer bound to a single physical device, and service logic is decoupled from storage. As your apps are running across devices, their data is seamlessly transmitted from one device to another, creating a foundation for a user experience that is smooth and consistent.
-- Distributed Scheduler
-
- The Distributed Scheduler is designed based on technical features such as DSoftBus, distributed data management, and distributed profile. It builds a unified distributed service management mechanism \(including service discovery, synchronization, registration, and invocation\), and supports remote startup, remote invocation, binding/unbinding, and migration of apps across devices. This way, your app can select the most suitable device to perform distributed tasks based on the capabilities, locations, running status, and resource usage of different devices, as well as user habits and intentions.
+- Distributed data management
+
+ Distributed data management leverages DSoftBus to manage application data and user data distributed on different devices. Under such management, user data is no longer bound to a single physical device, and service logic is decoupled from storage. As your applications are running across devices, their data is seamlessly transmitted from one device to another, creating a foundation for a user experience that is smooth and consistent.
-- Device virtualization
-
- A distributed device virtualization platform enables cross-device resource convergence, device management, and data processing so that virtual peripherals can function as capability extensions of smartphones to form a super virtual terminal.
+
+- Distributed Scheduler
+
+ Distributed Scheduler is designed based on technical features such as DSoftBus, distributed data management, and distributed profile. It builds a unified distributed service management mechanism (including service discovery, synchronization, registration, and invocation), and supports remote startup, remote invocation, binding/unbinding, and migration of applications across devices. This way, your application can select the most suitable device to perform distributed tasks based on the capabilities, locations, running status, and resource usage of different devices, as well as user habits and intentions.
+
+
+- Device virtualization
+
+ A distributed device virtualization platform enables cross-device resource convergence, device management, and data processing so that virtual peripherals can function as capability extensions of smartphones to form a Super Device.
**One-time development for multi-device deployment**
-OpenHarmony provides you with the user application, ability, and UI frameworks. With these frameworks, you can develop your apps once, and then flexibly deploy them across a broad range of different devices.
+OpenHarmony provides you with the application, ability, and UI frameworks. With these frameworks, you can develop your applications once, and then flexibly deploy them across a broad range of different devices. One-time development for multi-device deployment
-Consistent APIs ensure the operational compatibility of apps across devices.
+Consistent APIs ensure the operational compatibility of applications across devices.
-- Adaptation of device capabilities \(including CPU, memory, peripheral, and software resources\) can be previewed.
-- Resources can be scheduled based on the compatibility between user apps and the software platform.
+- Adaptation of device capabilities (including CPU, memory, peripheral, and software resources) can be previewed.
+- Resources can be scheduled based on the compatibility between applications and the software platform.
**A unified OS for flexible deployment**
OpenHarmony enables hardware resources to be scaled with its component-based and small-scale designs. It can be deployed on demand for a diverse range of devices, including ARM, RISC-V, and x86 architectures, and providing RAM volumes ranging from hundreds of KiB to GiB.
-## OS Types
+## System Types
-OpenHarmony supports the following types:
+OpenHarmony supports the following system types:
-- Mini system
+- Mini system
- A mini system runs on the devices whose memory is greater than or equal to 128 KiB and that are equipped with MCU processors such as Arm Cortex-M and 32-bit RISC-V. This system provides multiple lightweight network protocols and graphics frameworks, and a wide range of read/write components for the IoT bus. Typical products include connection modules, sensors, and wearables for smart home.
+ A mini system fits into devices that come with Micro Controller Units (MCUs), such as Arm Cortex-M and 32-bit RISC-V processors, and memory greater than or equal to 128 KiB. This system provides multiple lightweight network protocols, a lightweight graphics framework, and a wide range of read/write components with the IoT bus. Typical products include connection modules, sensors, and wearables for smart home.
-- Small system
+- Small system
- A small system runs on the devices whose memory is greater than or equal to 1 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides higher security capabilities, standard graphics frameworks, and video encoding and decoding capabilities. Typical products include smart home IP cameras, electronic cat eyes, routers, and event data recorders \(EDRs\) for smart travel.
+ A small system runs on devices whose memory is greater than or equal to 1 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides higher security capabilities, standard graphics frameworks, and video encoding and decoding capabilities. Typical products include smart home IP cameras, electronic cat eyes, and routers, and event data recorders (EDRs) for easy travel.
-- Standard system
+- Standard system
- A standard system runs on the devices whose memory is greater than or equal to 128 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides a complete application framework supporting the enhanced interaction, 3D GPU, hardware composer, diverse components, and rich animations. This system applies to high-end refrigerator displays.
+ A standard system runs on devices whose memory is greater than or equal to 128 MiB and that are equipped with application processors such as Arm Cortex-A. This system provides a complete application framework supporting the enhanced interaction, 3D GPU, hardware composer, diverse components, and rich animations. This system applies to high-end refrigerator displays.
-## Subsystems
+## Subsystems
You need to understand the following basic concepts related to OpenHarmony:
-- Subsystem
+- Subsystem
- OpenHarmony is designed with a layered architecture, which from bottom to top consists of the kernel layer, system service layer, framework layer, and application layer. System functions are expanded by levels, from system to subsystem, and further to module. In a multi-device deployment scenario, unnecessary modules can be excluded from the system as required. A subsystem is a logical concept and is a flexible combination of functions.
+ OpenHarmony is designed with a layered architecture, which consists of the kernel layer, system service layer, framework layer, and application layer from the bottom up. System functions are expanded by levels, from system to subsystem, and further to component. In a multi-device deployment scenario, unnecessary components can be excluded from the system as required. A subsystem, as a logical concept, consists of the least required components.
-- Module
+- Components
- A module is a reusable software binary unit that contains source code, configuration files, resource files, and build scripts. A module can be built independently, integrated in binary mode, and then tested independently.
+ A component is a reusable software binary unit that contains source code, configuration files, resource files, and build scripts. A component can be built independently, integrated in binary mode, and then tested independently.
-The following table describes the subsystems of OpenHarmony. For details about the readme files of these subsystems, see [https://gitee.com/openharmony/docs/tree/master/en/readme](https://gitee.com/openharmony/docs/tree/master/en/readme).
+The following table describes the subsystems of OpenHarmony. For details about the readme files of these subsystems, see [https://gitee.com/openharmony/docs/tree/master/en/readme](https://gitee.com/openharmony/docs/tree/master/en/readme).
-| Subsystem| Description| Applicable To|
+
+| Subsystem | Description | Application Scope |
| -------- | -------- | -------- |
-| Kernel| Supports small-sized LiteOS kernels that provide high performance and low power consumption for embedded devices and devices with limited resources, and supports Linux kernels that are applicable to the standard system.| Small system
Standard system |
-| Distributed File System | Provides APIs for synchronizing local JS files. | Standard system |
-| Graphics | Consists of user interface (UI) components, layout, animator, font, input event, window management, and rendering and drawing modules. It is an application framework that can be built on the LiteOS to develop OpenHarmony applications for Internet of Things (IoT) devices with limited hardware resources or on the standard OS to develop OpenHarmony applications for standard- and large-system devices (for example, tablet and lite smart devices). | All systems |
-| Driver | Constructed using the C object-oriented programming (OOP) language. It provides a unified driver platform and is compatible with different kernels by means of platform decoupling and kernel decoupling. This unified driver platform is designed to provide a more precise and efficient development environment, where you develop a driver that can be deployed on different systems supporting HDF. | All systems |
-| Power Management | Provides the following functions: restarting the system, managing running locks, managing and querying the system power status, querying and reporting the charging and battery status, and turning on/off the device screen, including adjusting the screen brightness. | Standard system |
-| Pan-sensor | Contains sensors and misc devices. A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another electronic device. Misc devices, including vibrators and LED lights, are used to send signals externally. You can call APIs to control the vibration of vibrators and lighting-on and lighting-off of LED lights. | Small system |
-| Multimodal Input | OpenHarmony provides a Natural User Interface (NUI) for you to interact with your users. Unlike conventional categorization of input methods, OpenHarmony combines input methods of different dimensions into multimodal inputs, so you can easily arm your app with multi-dimensional, natural interaction features by using the application framework and system built-in UI components or APIs. Specifically, OpenHarmony currently supports traditional input methods such as key and touch inputs. | Standard system |
-| Startup | Starts the OS middle layer between the time the kernel is started and the time apps are started. In addition, you can query and modify system attributes and restore factory settings. | All systems |
-| Update | Supports over the air (OTA) update of OpenHarmony devices. | Standard system |
-| Account | Provides interconnection with vendors' cloud account apps on the device side, and query and update of the cloud account login status. | Standard system |
-| Compilation and Building | 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 app data management for lightweight preference databases and relational databases
- Distributed data service to provide apps 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 |
-| Distributed Scheduler | Starts, registers, queries, and manages system services. | All systems |
-| JS UI framework | OpenHarmony UI development framework that 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 apps to use multimedia resources of the system. | All systems |
-| Common Event and Notification | Provides the common event management capabilities that allow apps to subscribe to, unsubscribe from, publish, and receive common events (such as screen-on/off events and USB device attachment/detachment events). | Standard system |
-| Misc Services | Provides the function of setting the time. | Standard system |
-| Bundle management | Provides bundle installation, uninstall, update, and query capabilities. | All systems |
-| Telephony | Provides basic communication capabilities of the cellular network, such as SIM cards, network search, cellular data, cellular calls, SMS, and MMS, as well as easy-to-use APIs for you to manage multiple types of calls and data network connections. | Standard system |
-| Utils | Stores basic OpenHarmony components, which can be used by OpenHarmony subsystems and upper-layer apps. | All systems |
-| Development Tools | Provides a performance profiler platform for you to analyze system issues such as memory and performance, including hdc used for device debugging, APIs for performance tracing, and a performance profiler framework. | Standard system |
-| DSoftBus | Provides cross-process or cross-device communication capabilities for the OpenHarmony system and consists of the DSoftBus and IPC modules. The DSoftBus module enables distributed communication between near-field devices and provides device discovery, connection, networking, and data transmission functions, regardless of the communication mode. The IPC module enables communication between processes on a device or across devices. | All systems |
-| XTS | Provides a set of OpenHarmony compatibility test suites, including the currently supported application compatibility test suite (ACTS) and the device compatibility test suite (DCTS) that will be supported in the future. | All systems |
-| System Apps | Provides system apps that are applicable to the OpenHarmony standard system, such as Launcher, SystemUI, and Settings. It also provides specific examples for you to build standard-system apps, which can be installed on all devices running the standard system. | Standard system |
-| DFX | Provides non-functional capabilities of OpenHarmony. It provides a logging system, app and system event logging APIs, the event log subscription service, and fault information generation and collection capabilities. | All systems |
-| Globalization | If OpenHarmony devices and apps need to be used globally, they must meet the requirements of users in different regions on languages and cultures. The Globalization subsystem provides multi-language and multi-cultural capabilities for global use, including resource management and internationalization (i18n). | All systems |
-| Security | Provides system, data, and app security capabilities to protect system and user data of OpenHarmony. Its functions include app integrity verification, app permission management, device authentication, and key management. | All systems |
-
-## Supported Development Boards
-
-Currently, OpenHarmony supports the development boards listed in the following table.
-
-| System Type| Board Model| Chip Model| Function Description| Application Scenario| Code Repository and Daily Build|
+| Kernel | Supports small-sized LiteOS kernels that provide high performance and low power consumption for embedded devices and devices with limited resources, and supports Linux kernels that are applicable to the standard system.| Small System
Standard System|
+| Distributed File System | Provides APIs for synchronizing local JS files. | Standard system |
+| Graphics | Consists of user interface (UI) components, layout, animator, font, input event, window management, and rendering modules. It is an application framework that can be built on the LiteOS to develop OpenHarmony applications for IoT devices with limited hardware resources or on the standard OS to develop OpenHarmony applications for standard- and large-system devices (for example, tablet and lite smart devices).| All systems |
+| Driver | Constructed using the C object-oriented programming (OOP) language. It provides a unified driver platform and is compatible with different kernels by means of platform decoupling and kernel decoupling. This unified driver platform is designed to provide a more precise and efficient development environment, where you develop a driver that can be deployed on different systems supporting HDF.| All systems |
+| Power Management | Provides the following functions: restarting the system, managing running locks, managing and querying the system power status, querying and reporting the charging and battery status, and turning on/off the device screen, including adjusting the screen brightness.| Standard system |
+| Pan-sensor | Contains sensors and misc devices. A sensor is a device to detect events or changes in an environment and send messages about the events or changes to another electronic device. Misc devices, including vibrators and LED lights, are used to send signals externally. You can call APIs to control the vibration of vibrators and lighting-on and lighting-off of LED lights.| Small system |
+| Multimodal Input | OpenHarmony provides a Natural User Interface (NUI) for you to interact with your users. Unlike conventional categorization of input methods, OpenHarmony combines input methods of different dimensions into multimodal inputs, so you can easily arm your application with multi-dimensional, natural interaction features by using the application framework and system built-in UI components or APIs. Specifically, OpenHarmony currently supports traditional input methods such as key and touch inputs.| Standard system |
+| Startup | Starts the OS middle layer between the time the kernel is started and the time applications are started. In addition, you can query and modify system attributes and restore factory settings.| All systems |
+| Update | Supports over the air (OTA) update of OpenHarmony devices. | Standard system |
+| Account | Provides interconnection with vendors' cloud account applications on the device side, and query and update of the cloud account login status.| Standard system |
+| 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 |
+| 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 |
+| Common Event and Notification | Provides the common event management capabilities that allow applications to subscribe to, unsubscribe from, publish, and receive common events (such as screen-on/off events and USB device attachment/detachment events).| Standard system |
+| Misc Services | Provides the function of setting the time. | Standard system |
+| Bundle Management | Provides bundle installation, uninstall, update, and query capabilities. | All systems |
+| Telephony | Provides basic communication capabilities of the cellular network, such as SIM cards, network search, cellular data, cellular calls, SMS, and MMS, as well as easy-to-use APIs for you to manage multiple types of calls and data network connections.| Standard system |
+| Utils | Stores basic components of OpenHarmony, which can be used by OpenHarmony subsystems and upper-layer applications.| All systems |
+| Development Tools | Provides a performance profiler platform for you to analyze system issues such as memory and performance, including hdc used for device debugging, APIs for performance tracing, and a performance profiler framework.| Standard system |
+| DSoftBus | Provides cross-process or cross-device communication capabilities for the OpenHarmony system and consists of the DSoftBus and IPC modules. The DSoftBus module enables distributed communication between near-field devices and provides device discovery, connection, networking, and data transmission functions, regardless of the communication mode. The IPC module enables communication between processes on a device or across devices.| All systems |
+| XTS | Provides a set of OpenHarmony compatibility test suites, including the currently supported application compatibility test suite (ACTS) and the device compatibility test suite (DCTS) that will be supported in the future.| All systems |
+| System Apps | Provides system apps that are applicable to the OpenHarmony standard system, such as Home Screen, SystemUI, and Settings. It also provides specific examples for you to build standard-system applications, which can be installed on all devices running the standard system.| Standard system |
+| DFX | Provides non-functional capabilities of OpenHarmony. It provides a logging system, application and system event logging APIs, the event log subscription service, and fault information generation and collection capabilities.| All systems |
+| Globalization | If OpenHarmony devices and applications need to be used globally, they must meet the requirements of users in different regions on languages and cultures. The Globalization subsystem provides multi-language and multi-cultural capabilities for global use, including resource management and internationalization (i18n).| All systems |
+| Security | Provides system, data, and application security capabilities to protect system and user data of OpenHarmony. Its functions include application integrity verification, application permission management, device authentication, and key management.| All systems |
+
+## Supported Development Boards
+
+Currently, the OpenHarmony community supports 17 types of development boards, which are listed in [Development Boards Supported](device-dev/dev-board-on-the-master.md). The following table describes three of them, which are the first three integrated into the OpenHarmony master).
+
+| System Type| Board Model| Chip Model| Function Description and Use Case| Application Scenario| Code Repository and Daily Build|
| -------- | -------- | -------- | -------- | -------- | -------- |
-| Standard system| Hi3516DV300 | Hi3516DV300 | Hi3516D V300 is a the next-generation system on chip (SoC) for smart HD IP cameras. It integrates the next-generation image signal processor (ISP), H.265 video compression encoder, and high-performance NNIE engine, and delivers exceptional performance in terms of low bit rate, high image quality, intelligent processing and analysis, and low power consumption.| Devices with screens, such as refrigerators and head units.| Code repositories:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
-| Standard system| Runhe HH-SCDAYU200| RK3568 | Bolstered by the Rockchip RK3568, the HH-SCDAYU200 development board integrates a dual-core GPU and high-efficiency NPU. Its quad-core 64-bit Cortex-A55 processor uses the advanced 22 nm fabrication process and is clocked at up to 2.0 GHz. The board is packed with Bluetooth, WiFi, audio, video, and camera features, with a wide range of expansion ports as well as video input and output ports. It comes with dual GE auto-sensing RJ45 ports, so it can be used in multi-connectivity products, such as network video recorders (NVRs) and industrial gateways.| Video and audio entertainment, smart travel, and smart home, such as kitchen hoods, ovens, and treadmills.| Code repositories:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
-| Lightweight| Goodix GR5515-STARTER-KIT| GR5515 | The GR5515-STARTER-KIT development board is a Bluetooth 5.1-capable single-mode Bluetooth low energy (BLE) SoC and comes with multifunctional keys and LED indicators.| Smart hardware, such as watches, wristbands, and price tags.| Code repositories:
[device_soc_goodix](https://gitee.com/openharmony/device_soc_goodix)
[device_board_goodix](https://gitee.com/openharmony/device_board_goodix)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
-| Lightweight| Langguo LANGO200| ASR582X | The LANGO200 IoT development board integrates the high-performance WiFi-BLE dual-mode chip ASR5822, external storage chip, voice playing chip, and analog-to-digital converter. It supports common peripheral interfaces like SPI, and can be connected to an external OLED display and infrared remote control.| Connection modules for smart home products.| Code repositories:
[device_soc_asrmicro](https://gitee.com/openharmony/device_soc_asrmicro)
[device_board_lango](https://gitee.com/openharmony/device_board_lango)
[vendor_asrmicro](https://gitee.com/openharmony/vendor_asrmicro)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
-| Lightweight| Fn-Link multi-modal V200ZR| BES2600 | The multi-modal V200Z-R development board is a high-performance, multi-functional, and cost-effective AIoT SoC powered by the BES2600WM chip of Bestechnic. It integrates a quad-core Arm processor with a frequency of up to 1 GHz as well as dual-mode WiFi and dual-mode Bluetooth. The board supports the 802.11 a/b/g/n/ and BT/BLE 5.2 standards. It is able to accommodate RAM of up to 42 MB and flash memory of up to 32 MB, and supports the MIPI display serial interface (DSI) and camera serial interface (CSI). It is applicable to various AIoT multi-modal VUI and GUI interaction scenarios.| Smart hardware with screens, such as speakers and watches.| Code repositories:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
-| Lightweight| BearPi-HM_Nano| Hi3861 | The BearPi-HM_Nano development board is specially designed for OpenHarmony. It is equipped with the highly integrated 2.4 GHz WiFi SoC chip Hi3861, near field communication (NFC) circuits, and standard E53 interfaces, which can be used to connect to smart humidifiers, smart desk lamps, smart security facilities, and intelligent smoke detectors.| Connection devices like smart street lamps, smart logistics sensors, and human body infrared sensors.| Code repositories:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_bearpi](https://gitee.com/openharmony/device_board_bearpi)
[vendor_bearpi](https://gitee.com/openharmony/vendor_bearpi)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
+| Standard system| Runhe HH-SCDAYU200| RK3568 | Function description:
Bolstered by the Rockchip RK3568, the HH-SCDAYU200 development board integrates the dual-core GPU and efficient NPU. Its quad-core 64-bit Cortex-A55 processor uses the advanced 22 nm fabrication process and is clocked at up to 2.0 GHz. The board is packed with Bluetooth, Wi-Fi, audio, video, and camera features, with a wide range of expansion ports to accommodate various video input and outputs. It comes with dual GE auto-sensing RJ45 ports, so it can be used in multi-connectivity products, such as network video recorders (NVRs) and industrial gateways.
Use case:
[DAYU200 Use Case](device-dev/porting/porting-dayu200-on_standard-demo.md)| Entertainment, easy travel, and smart home, such as kitchen hoods, ovens, and treadmills.| Code repositories:
[device_soc_rockchip](https://gitee.com/openharmony/device_soc_rockchip)
[device_board_hihope](https://gitee.com/openharmony/device_board_hihope)
[vendor_hihope](https://gitee.com/openharmony/vendor_hihope)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
+| Small system| Hispark_Taurus | Hi3516DV300 | Function Description:
Hi3516D V300 is the next-generation system on chip (SoC) for smart HD IP cameras. It integrates the next-generation image signal processor (ISP), H.265 video compression encoder, and high-performance NNIE engine, and delivers high performance in terms of low bit rate, high image quality, intelligent processing and analysis, and low power consumption.| Smart device with screens, such as refrigerators with screens and head units.| Code repositories:
[device_soc_hisilicon](https://gitee.com/openharmony/device_soc_hisilicon)
[device_board_hisilicon](https://gitee.com/openharmony/device_board_hisilicon)
[vendor_hisilicon](https://gitee.com/openharmony/vendor_hisilicon)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
+| Mini system| Multi-modal V200Z-R | BES2600 | Function description:
The multi-modal V200Z-R development board is a high-performance, multi-functional, and cost-effective AIoT SoC powered by the BES2600WM chip of Bestechnic. It integrates a quad-core ARM processor with a frequency of up to 1 GHz as well as dual-mode Wi-Fi and dual-mode Bluetooth. The board supports the 802.11 a/b/g/n/ and BT/BLE 5.2 standards. It is able to accommodate RAM of up to 42 MB and flash memory of up to 32 MB, and supports the MIPI display serial interface (DSI) and camera serial interface (CSI). It is applicable to various AIoT multi-modal VUI and GUI interaction scenarios.
Use case:
[Multi-modal V200Z-R Use Case](device-dev/porting/porting-bes2600w-on-minisystem-display-demo.md)| Smart hardware, and smart devices with screens, such as speakers and watches.| Code repositories:
[device_soc_bestechnic](https://gitee.com/openharmony/device_soc_bestechnic)
[device_board_fnlink](https://gitee.com/openharmony/device_board_fnlink)
[vendor_bestechnic](https://gitee.com/openharmony/vendor_bestechnic)
Daily build:
http://ci.openharmony.cn/dailys/dailybuilds |
-## Getting Started
+## Getting Started
- [Getting Started for Device Development](device-dev/quick-start/quickstart-ide-lite-overview.md)
- [Getting Started for Application Development](application-dev/quick-start/start-overview.md)
-## Code Repository Addresses
-OpenHarmony project: [https://gitee.com/openharmony](https://gitee.com/openharmony)
-OpenHarmony SIG: [https://gitee.com/openharmony-sig](https://gitee.com/openharmony-sig)
+## Code Repository Addresses
+
+OpenHarmony project: [https://gitee.com/openharmony](https://gitee.com/openharmony)
+
+OpenHarmony SIGs: [https://gitee.com/openharmony-sig](https://gitee.com/openharmony-sig)
-OpenHarmony third-party components: [https://gitee.com/openharmony-tpc](https://gitee.com/openharmony-tpc)
+OpenHarmony third-party components: [https://gitee.com/openharmony-tpc](https://gitee.com/openharmony-tpc)
-OpenHarmony archived projects: [https://gitee.com/openharmony-retired](https://gitee.com/openharmony-retired)
+OpenHarmony archived projects: [https://gitee.com/openharmony-retired](https://gitee.com/openharmony-retired)
-## OpenHarmony Documentation
+## OpenHarmony Documentation
-[Chinese version](https://gitee.com/openharmony/docs/blob/master/zh-cn/readme.md)
+[Chinese version](https://gitee.com/openharmony/docs/tree/master/zh-cn)
-[English version](https://gitee.com/openharmony/docs/blob/master/en/readme.md)
+[English version](https://gitee.com/openharmony/docs/tree/master/en)
-## Source Code Downloading
+## Source Code Downloading
-For details about how to obtain the source code of OpenHarmony, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md).
+For details about how to obtain the source code of OpenHarmony, see [Source Code Acquisition](https://gitee.com/openharmony/docs/blob/master/en/device-dev/get-code/sourcecode-acquire.md)
-## Hands-On Tutorials
+## Hands-On Tutorials
[Samples](https://gitee.com/openharmony/app_samples)
[Codelabs](https://gitee.com/openharmony/codelabs)
-## How to Participate
+## How to Participate
-For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README-EN.md).
+For details about how to join in the OpenHarmony community, see [OpenHarmony Community](https://gitee.com/openharmony/community/blob/master/README-EN.md)
-For details about how to contribute, see [How to Contribute](contribute/how-to-contribute.md).
+For details about how to contribute, see [How to contribute](contribute/how-to-contribute.md).
-## License Agreement
+## License Agreement
OpenHarmony complies with Apache License Version 2.0. For details, see the LICENSE in each repository.
-OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](https://gitee.com/openharmony/docs/blob/master/en/contribute/third-party-open-source-software-and-license-notice.md).
+OpenHarmony uses third-party open-source software and licenses. For details, see [Third-Party Open-Source Software](https://gitee.com/openharmony/docs/blob/master/en/contribute/third-party-open-source-software-and-license-notice.md).
-## Contact Info
+## Contact Info
Website:
diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md
index fdc79edbcb58a00729b62b5e9f7d239b52cdbf59..8e42633391269303e5e8d888561281f57d1718ae 100644
--- a/en/application-dev/Readme-EN.md
+++ b/en/application-dev/Readme-EN.md
@@ -15,7 +15,6 @@
- Development Fundamentals
- [Application Package Structure Configuration File (FA Model)](quick-start/package-structure.md)
- [Application Package Structure Configuration File (Stage Model)](quick-start/stage-structure.md)
- - [Resource File Categories](quick-start/basic-resource-file-categories.md)
- [SysCap](quick-start/syscap.md)
- Development
- [Ability Development](ability/Readme-EN.md)
@@ -45,8 +44,5 @@
- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
- APIs
- [JS and TS APIs](reference/apis/Readme-EN.md)
- - Native APIs
- - [Standard Library](reference/native-lib/third_party_libc/musl.md)
- - [Node_API](reference/native-lib/third_party_napi/napi.md)
- Contribution
- [How to Contribute](../contribute/documentation-contribution.md)
diff --git a/en/application-dev/ability/figures/fa-package-info.png b/en/application-dev/ability/figures/fa-package-info.png
deleted file mode 100644
index 86da707408da8fdb149ea62d92298fed605132ca..0000000000000000000000000000000000000000
Binary files a/en/application-dev/ability/figures/fa-package-info.png and /dev/null differ
diff --git a/en/application-dev/ability/stage-ability.md b/en/application-dev/ability/stage-ability.md
index 5b61bcec4b25312f994ed94362339e601df5cd55..e1d67a295b673453d7340fb20a40c81d8c7a7855 100644
--- a/en/application-dev/ability/stage-ability.md
+++ b/en/application-dev/ability/stage-ability.md
@@ -78,29 +78,29 @@ To create Page abilities for an application in the stage model, you must impleme
onCreate(want, launchParam) {
console.log("MainAbility onCreate")
}
-
+
onDestroy() {
console.log("MainAbility onDestroy")
}
-
+
onWindowStageCreate(windowStage) {
console.log("MainAbility onWindowStageCreate")
-
+
windowStage.loadContent("pages/index").then((data) => {
console.log("MainAbility load content succeed with data: " + JSON.stringify(data))
}).catch((error) => {
console.error("MainAbility load content failed with error: " + JSON.stringify(error))
})
}
-
+
onWindowStageDestroy() {
console.log("MainAbility onWindowStageDestroy")
}
-
+
onForeground() {
console.log("MainAbility onForeground")
}
-
+
onBackground() {
console.log("MainAbility onBackground")
}
@@ -300,7 +300,7 @@ export default class MainAbility extends Ability {
Obtain the `want` parameter that contains the page information from the custom component and process the route based on the URI.
```ts
-import router from '@system.router'
+import router from '@ohos.router'
@Entry
@Component
diff --git a/en/application-dev/application-dev-guide-for-gitee.md b/en/application-dev/application-dev-guide-for-gitee.md
index 753b706605487dbe2cf5ebe0ce961b19d94e7ee0..e60f2c01333c1bef7324b3ef6cfe2c83821a95cd 100644
--- a/en/application-dev/application-dev-guide-for-gitee.md
+++ b/en/application-dev/application-dev-guide-for-gitee.md
@@ -54,8 +54,10 @@ To make you better understand how functions work together and jumpstart your app
API references encompass all components and APIs available in OpenHarmony, helping you use and integrate APIs more effectively.
They are organized as follows:
+
+- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
+
- [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md)
-- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
- APIs
- [JS and TS APIs](reference/apis/Readme-EN.md)
- Native APIs
diff --git a/en/application-dev/application-dev-guide.md b/en/application-dev/application-dev-guide.md
index c07f787d38091637215907537e54812c397a417e..7065480d1c4a12bd0984f4916d678c1bed7a4997 100644
--- a/en/application-dev/application-dev-guide.md
+++ b/en/application-dev/application-dev-guide.md
@@ -54,8 +54,14 @@ To make you better understand how functions work together and jumpstart your app
API references encompass all components and APIs available in OpenHarmony, helping you use and integrate APIs more effectively.
They are organized as follows:
-- [JS and TS APIs](reference/apis/js-apis-DataUriUtils.md)
-- Native APIs
- - [Standard Library](reference/native-lib/third_party_libc/musl.md)
- - [Node_API](reference/native-lib/third_party_napi/napi.md)
+
+- [Component Reference (TypeScript-based Declarative Development Paradigm)](reference/arkui-ts/Readme-EN.md)
+
+- [Component Reference (JavaScript-based Web-like Development Paradigm)](reference/arkui-js/Readme-EN.md)
+
+- [JS and TS APIs](reference/apis/js-apis-DataUriUtils.md)
+
+- Native APIs
+ - [Standard Library](reference/native-lib/third_party_libc/musl.md)
+ - [Node_API](reference/native-lib/third_party_napi/napi.md)
diff --git a/en/application-dev/connectivity/ipc-rpc-development-guideline.md b/en/application-dev/connectivity/ipc-rpc-development-guideline.md
index 3d541e4832aa72a585972d327e2fb2f31a077fa6..fadb084eecebc65fe59fba9245829d28ce7b6095 100644
--- a/en/application-dev/connectivity/ipc-rpc-development-guideline.md
+++ b/en/application-dev/connectivity/ipc-rpc-development-guideline.md
@@ -33,7 +33,7 @@ IPC/RPC enables a proxy and a stub that run on different processes to communicat
IRemoteProxy
|
- |
+ |
Service proxy classes are derived from the IRemoteProxy class.
|
diff --git a/en/application-dev/connectivity/ipc-rpc-overview.md b/en/application-dev/connectivity/ipc-rpc-overview.md
index 19bbe8dc26871bec8b2f6f48273d90dacc148d70..e75536863b1ae1b5c5371f51b0d7e26e4db97ed6 100755
--- a/en/application-dev/connectivity/ipc-rpc-overview.md
+++ b/en/application-dev/connectivity/ipc-rpc-overview.md
@@ -19,4 +19,4 @@ In OpenHarmony documents, proxy represents the service requester, and stub repre
## Related Modules
-[Distributed Scheduler](https://gitee.com/openharmony/distributedschedule_dms_fwk)
+[Distributed Scheduler](https://gitee.com/openharmony/ability_dmsfwk)
diff --git a/en/application-dev/connectivity/subscribe-remote-state.md b/en/application-dev/connectivity/subscribe-remote-state.md
index fa70738556ec7992c33fd8bcf3e74fbd6145fcb6..8d9365d6bbba940bb85d9ac7493b7069c48845eb 100755
--- a/en/application-dev/connectivity/subscribe-remote-state.md
+++ b/en/application-dev/connectivity/subscribe-remote-state.md
@@ -1,25 +1,30 @@
-# Subscribing to State Changes of a Remote Object
+# Subscribing to State Changes of a Remote Object
-IPC/RPC allows you to subscribe to the state changes of a remote stub object. When the remote stub object dies, a death notification will be sent to your local proxy object. You can also unsubscribe from the state changes if they are no longer needed. Such subscription and unsubscription are controlled by APIs. To be specific, you need to implement the **IRemoteObject.DeathRecipient** interface and the **onRemoteDied** method to clear resources. This callback is invoked when the process accommodating the remote stub object dies, or the device accommodating the remote stub object leaves the network. It is worth noting that these APIs should be called in the following order: The proxy object must first subscribe to death notifications of the stub object. If the stub object is in the normal state, the proxy object can cancel the subscription as required. If the process of the stub object exits or the device hosting the stub object goes offline, subsequent operations customized by the proxy object will be automatically triggered.
+IPC/RPC allows you to subscribe to the state changes of a remote stub object. When the remote stub object dies, a death notification will be sent to your local proxy object. Such subscription and unsubscription are controlled by APIs. To be specific, you need to implement the **DeathRecipient** callback and the **onRemoteDied** method to clear resources. This callback is invoked when the process accommodating the remote stub object dies, or the device accommodating the remote stub object leaves the network.
-**Development Using Native APIs**
+Note that the proxy object must first subscribe to death notifications of the stub object. If the stub object is in the normal state, the proxy object can cancel the subscription as required. If the process of the stub object exits or the device hosting the stub object goes offline, subsequent operations customized by the proxy object will be automatically triggered.
-The following APIs are used to add a recipient for death notifications of a remote stub object, remove such a recipient, and perform subsequent operations upon receiving a death notification of the remote stub object:
-```
-bool AddDeathRecipient(const sptr &recipient);
-bool RemoveDeathRecipient(const sptr &recipient);
-void OnRemoteDied(const wptr &object);
-```
-The sample code is as follows:
+
+## **Development Using Native APIs**
+
+| API| Description|
+| -------- | -------- |
+| AddDeathRecipient(const sptr\ &recipient); | Adds a recipient for death notifications of a remote stub object.|
+| RemoveDeathRecipient(const sptr\ &recipient); | Removes the recipient for death notifications of a remote stub object.|
+| OnRemoteDied(const wptr\ &object); | Called when the remote stub object dies.|
+
+
+## Sample Code
+
```
class TestDeathRecipient : public IRemoteObject::DeathRecipient {
public:
virtual void OnRemoteDied(const wptr& remoteObject);
}
-sptr deathRecipient (new TestDeathRecipient()); // Construct a death notification recipient.
-bool result = proxy->AddDeathRecipient(deathRecipient); // Add the recipient to the proxy.
-result = proxy->RemoveDeathRecipient(deathRecipient); // Remove the recipient.
+sptr deathRecipient (new TestDeathRecipient());// Construct a death notification recipient.
+bool result = proxy->AddDeathRecipient(deathRecipient); // Add a recipient for death notifications.
+result = proxy->RemoveDeathRecipient(deathRecipient); // Remove the recipient for death notifications.
```
diff --git a/en/application-dev/connectivity/websocket-connection.md b/en/application-dev/connectivity/websocket-connection.md
index 01f5f38fad74e234c8a9fb483ee4a11ae2a8c7a7..b68d537fc5ad96f3ab60b53e2e75a96d7b555f76 100644
--- a/en/application-dev/connectivity/websocket-connection.md
+++ b/en/application-dev/connectivity/websocket-connection.md
@@ -3,7 +3,7 @@
## Use Cases
-You can use WebSocket to establish a bidirectional connection between a server and a client. Before doing this, you need to use the **createWebSocket** API to create a **WebSocket** object and then use the **connect** API to connect to the server. If the connection is successful, the client will receive a callback of the **open** event. Then, the client can communicate with the server using the **send** API. When the server sends a message to the client, the client will receive a callback of the **message** event. If the client no longer needs this connection, it can call the **close** API to disconnect from the server. Then, the client will receive a callback of the **close** event.
+You can use WebSocket to establish a bidirectional connection between a server and a client. Before doing this, you need to use the **createWebSocket()** API to create a **WebSocket** object and then use the **connect()** API to connect to the server. If the connection is successful, the client will receive a callback of the **open** event. Then, the client can communicate with the server using the **send()** API. When the server sends a message to the client, the client will receive a callback of the **message** event. If the client no longer needs this connection, it can call the **close()** API to disconnect from the server. Then, the client will receive a callback of the **close** event.
If an error occurs in any of the preceding processes, the client will receive a callback of the **error** event.
@@ -18,14 +18,14 @@ The WebSocket connection function is mainly implemented by the WebSocket module.
| connect() | Establishes a WebSocket connection to a given URL. |
| send() | Sends data through the WebSocket connection. |
| close() | Closes a WebSocket connection. |
-| on(type: 'open') | Enables listening for **open** events of a WebSocket connection. |
-| off(type: 'open') | Disables listening for **open** events of a WebSocket connection. |
-| on(type: 'message') | Enables listening for **message** events of a WebSocket connection. |
-| off(type: 'message') | Disables listening for **message** events of a WebSocket connection. |
-| on(type: 'close') | Enables listening for **close** events of a WebSocket connection. |
-| off(type: 'close') | Disables listening for **close** events of a WebSocket connection. |
-| on(type: 'error') | Enables listening for **error** events of a WebSocket connection. |
-| off(type: 'error') | Disables listening for **error** events of a WebSocket connection. |
+| on(type: 'open') | Enables listening for **open** events of a WebSocket connection. |
+| off(type: 'open') | Disables listening for **open** events of a WebSocket connection. |
+| on(type: 'message') | Enables listening for **message** events of a WebSocket connection. |
+| off(type: 'message') | Disables listening for **message** events of a WebSocket connection. |
+| on(type: 'close') | Enables listening for **close** events of a WebSocket connection. |
+| off(type: 'close') | Disables listening for **close** events of a WebSocket connection. |
+| on(type: 'error') | Enables listening for **error** events of a WebSocket connection. |
+| off(type: 'error') | Disables listening for **error** events of a WebSocket connection. |
## How to Develop
@@ -50,9 +50,9 @@ The WebSocket connection function is mainly implemented by the WebSocket module.
// When receiving the on('open') event, the client can use the send() API to communicate with the server.
ws.send("Hello, server!", (err, value) => {
if (!err) {
- console.log("send success");
+ console.log("Message sent successfully");
} else {
- console.log("send fail, err:" + JSON.stringify(err));
+ console.log("Failed to send the message. Err:" + JSON.stringify(err));
}
});
});
@@ -62,9 +62,9 @@ The WebSocket connection function is mainly implemented by the WebSocket module.
if (value === 'bye') {
ws.close((err, value) => {
if (!err) {
- console.log("close success");
+ console.log("Connection closed successfully");
} else {
- console.log("close fail, err is " + JSON.stringify(err));
+ console.log("Failed to close the connection. Err: " + JSON.stringify(err));
}
});
}
@@ -77,9 +77,9 @@ The WebSocket connection function is mainly implemented by the WebSocket module.
});
ws.connect(defaultIpAddress, (err, value) => {
if (!err) {
- console.log("connect success");
+ console.log("Connected successfully");
} else {
- console.log("connect fail, err:" + JSON.stringify(err));
+ console.log("Connection failed. Err:" + JSON.stringify(err));
}
});
```
diff --git a/en/application-dev/database/database-distributedobject-guidelines.md b/en/application-dev/database/database-distributedobject-guidelines.md
index c9fd1c05fd6dc959c8cdfcab155d785833bc631f..24faeb9de8ed3ee35e773668cd110310feadc9ef 100644
--- a/en/application-dev/database/database-distributedobject-guidelines.md
+++ b/en/application-dev/database/database-distributedobject-guidelines.md
@@ -9,6 +9,8 @@ The distributed data objects support basic data types, such as number, string, a
## Available APIs
+For details about the APIs related to the distributed data object, see [Distributed Data Object](../reference/apis/js-apis-data-distributedobject.md).
+
### Creating a Distributed Data Object Instance
Call **createDistributedObject()** to create a distributed data object instance. You can specify the attributes of the instance in **source**.
@@ -216,40 +218,39 @@ The following example shows how to implement distributed data object synchroniza
10. Save a distributed data object and revoke the data saving operation.
- Callback
-
- ```js
- // Save a distributed data object.
- local_object.save("local", (result, data)=>{
- console.log("save callback");
- console.info("save sessionId " + data.sessionId);
- console.info("save version " + data.version);
- console.info("save deviceId " + data.deviceId);
- });
- // Revoke the data saving operation.
- local_object.revokeSave((result, data) =>{
- console.log("revokeSave callback");
- console.info("revokeSave sessionId " + data.sessionId);
- });
- ```
- - Promise
-
- ```js
- // Save a distributed data object.
- g_object.save("local").then((result)=>{
- console.info("save sessionId " + result.sessionId);
- console.info("save version " + result.version);
- console.info("save deviceId " + result.deviceId);
- }, (result)=>{
- console.info("save local failed.");
- });
- // Revoke the data saving operation.
- g_object.revokeSave().then((result)=>{
- console.info("revokeSave success.");
- }, (result)=>{
- console.info("revokeSave failed.");
- });
- ```
-11. Unsubscribe from the status changes of the distributed data object.
You can specify the callback to unregister. If you do not specify the callback, this API unregister all callbacks of this distributed data object.
+
+ ```js
+ // Save a distributed data object.
+ local_object.save("local", (result, data)=>{
+ console.log("save callback");
+ console.info("save sessionId " + data.sessionId);
+ console.info("save version " + data.version);
+ console.info("save deviceId " + data.deviceId);
+ });
+ // Revoke the data saving operation.
+ local_object.revokeSave((result, data) =>{
+ console.log("revokeSave callback");
+ console.info("revokeSave sessionId " + data.sessionId);
+ });
+ ```
+ - Promise
+ ```js
+ // Save a distributed data object.
+ g_object.save("local").then((result)=>{
+ console.info("save sessionId " + result.sessionId);
+ console.info("save version " + result.version);
+ console.info("save deviceId " + result.deviceId);
+ }, (result)=>{
+ console.info("save local failed.");
+ });
+ // Revoke the data saving operation.
+ g_object.revokeSave().then((result)=>{
+ console.info("revokeSave success.");
+ }, (result)=>{
+ console.info("revokeSave failed.");
+ });
+ ```
+11. Unsubscribe from the status changes of the distributed data object.
You can specify the callback to unregister. If you do not specify the callback, this API unregisters all callbacks of this distributed data object.
The sample code is as follows:
```js
diff --git a/en/application-dev/database/database-mdds-guidelines.md b/en/application-dev/database/database-mdds-guidelines.md
index 309d2a38e4cbcab79a102b809bb9444cf9a8e1ee..c5608c6eabd526c38a87bd3907fba89fb1a11629 100644
--- a/en/application-dev/database/database-mdds-guidelines.md
+++ b/en/application-dev/database/database-mdds-guidelines.md
@@ -7,19 +7,21 @@ The Distributed Data Service (DDS) implements synchronization of application dat
## Available APIs
+For details about the APIs related to distributed data, see [Distributed Data Management](../reference/apis/js-apis-distributed-data.md).
+
The table below describes the APIs provided by the OpenHarmony DDS module.
**Table 1** APIs provided by the DDS
-| Category | API | Description |
-| -------- | --- | ----------- |
-| Creating a distributed database | createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | Creates a **KVManager** object for database management.|
-| Obtaining a distributed KV store | getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | Obtains the KV store with the specified **Options** and **storeId**. |
-| Managing data in a distributed KV store | put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback<void>): void
put(key: string, value: Uint8Array \| string \| number \| boolean): Promise<void> | Inserts and updates data. |
+| Category | API | Description |
+| ------------ | ------------- | ------------- |
+| Creating a distributed database| createKVManager(config: KVManagerConfig, callback: AsyncCallback<KVManager>): void
createKVManager(config: KVManagerConfig): Promise<KVManager> | Creates a **KVManager** object for database management.|
+| Obtaining a distributed KV store| getKVStore<T extends KVStore>(storeId: string, options: Options, callback: AsyncCallback<T>): void
getKVStore<T extends KVStore>(storeId: string, options: Options): Promise<T> | Obtains the KV store with the specified **Options** and **storeId**.|
+| Managing data in a distributed KV store| put(key: string, value: Uint8Array \| string \| number \| boolean, callback: AsyncCallback<void>): void
put(key: string, value: Uint8Array \| string \| number \| boolean): Promise<void> | Inserts and updates data.|
| Managing data in a distributed KV store| delete(key: string, callback: AsyncCallback<void>): void
delete(key: string): Promise<void> | Deletes data. |
-| Managing data in a distributed KV store | get(key: string, callback: AsyncCallback<Uint8Array \| string \| boolean \| number>): void
get(key: string): Promise<Uint8Array \| string \| boolean \| number> | Queries data. |
-| Subscribing to changes in the distributed data | on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotification>): void
on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void | Subscribes to data changes in the KV store. |
-| Synchronizing data across devices | sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | Triggers database synchronization in manual mode. |
+| Managing data in a distributed KV store| get(key: string, callback: AsyncCallback<Uint8Array \| string \| boolean \| number>): void
get(key: string): Promise<Uint8Array \| string \| boolean \| number> | Queries data. |
+| Subscribing to changes in the distributed data| on(event: 'dataChange', type: SubscribeType, observer: Callback<ChangeNotification>): void
on(event: 'syncComplete', syncCallback: Callback<Array<[string, number]>>): void | Subscribes to data changes in the KV store.|
+| Synchronizing data across devices| sync(deviceIdList: string[], mode: SyncMode, allowedDelayMs?: number): void | Triggers database synchronization in manual mode. |
@@ -29,14 +31,13 @@ The table below describes the APIs provided by the OpenHarmony DDS module.
The following uses a single KV store as an example to describe the development procedure.
1. Import the distributed data module.
-
```js
import distributedData from '@ohos.data.distributedData';
```
2. Create a **KvManager** instance based on the specified **KvManagerConfig** object.
- 1. Create a **KvManagerConfig** object based on the application context.
- 2. Create a **KvManager** instance.
+ (1) Create a **KvManagerConfig** object based on the application context.
+ (2) Create a **KvManager** instance.
The sample code is as follows:
```js
@@ -63,8 +64,8 @@ The following uses a single KV store as an example to describe the development p
```
3. Create and obtain a single KV store.
- 1. Declare the ID of the single KV store to create.
- 2. Create a single KV store. You are advised to disable automatic synchronization (**autoSync:false**) and call **sync** when a synchronization is required.
+ (1) Declare the ID of the single KV store to create.
+ (2) Create a single KV store. You are advised to disable automatic synchronization (**autoSync:false**) and call **sync** when a synchronization is required.
The sample code is as follows:
```js
@@ -91,12 +92,11 @@ The following uses a single KV store as an example to describe the development p
}
```
- >  **NOTE**
+ >  **NOTE**
> For data synchronization between networked devices, you are advised to open the distributed KV store during application startup to obtain the database handle. With this database handle (**kvStore** in this example), you can perform operations, such as inserting data into the KV store, without creating the KV store repeatedly during the lifecycle of the handle.
-4. Subscribe to changes in the distributed data.
+4. Subscribe to changes in the distributed data.
The following is the sample code for subscribing to the data changes of a single KV store:
-
```js
kvStore.on('dataChange', distributedData.SubscribeType.SUBSCRIBE_TYPE_ALL, function (data) {
console.log("dataChange callback call data: " + JSON.stringify(data));
@@ -104,8 +104,8 @@ The following uses a single KV store as an example to describe the development p
```
5. Write data to the single KV store.
- 1. Construct the key and value to be written into the single KV store.
- 2. Write key-value pairs into the single KV store.
+ (1) Construct the key and value to be written into the single KV store.
+ (2) Write key-value pairs into the single KV store.
The following is the sample code for writing key-value pairs of the string type into the single KV store:
@@ -126,11 +126,10 @@ The following uses a single KV store as an example to describe the development p
```
6. Query data in the single KV store.
- 1. Construct the key to be queried from the single KV store.
- 2. Query data from the single KV store.
+ (1) Construct the key to be queried from the single KV store.
+ (2) Query data from the single KV store.
The following is the sample code for querying data of the string type from the single KV store:
-
```js
const KEY_TEST_STRING_ELEMENT = 'key_test_string';
const VALUE_TEST_STRING_ELEMENT = 'value-test-string';
@@ -178,3 +177,7 @@ The following uses a single KV store as an example to describe the development p
}
});
```
+## Samples
+The following samples are provided to help you better understand the distributed data development:
+- [`KvStore`: Distributed Database (eTS) (API8)](https://gitee.com/openharmony/app_samples/tree/master/data/Kvstore)
+- [Distributed Database](https://gitee.com/openharmony/codelabs/tree/master/Data/JsDistributedData)
diff --git a/en/application-dev/database/database-relational-guidelines.md b/en/application-dev/database/database-relational-guidelines.md
index 50d34b56ce3309b953285083d9ce97405e0721d2..53bba062801ec1b8bcf1f65cdc4119fa53757f10 100644
--- a/en/application-dev/database/database-relational-guidelines.md
+++ b/en/application-dev/database/database-relational-guidelines.md
@@ -34,7 +34,7 @@ The RDB provides APIs for inserting, deleting, updating, and querying data in th
| Class| API| Description|
| -------- | -------- | -------- |
- | RdbStore | insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void | Inserts a row of data into a table. This API uses a callback to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.
- **callback**: callback invoked to return the result. If the operation is successful, the row ID will be returned. Otherwise, **-1** will be returned.|
+ | RdbStore | insert(table: string, values: ValuesBucket, callback: AsyncCallback<number>):void | Inserts a row of data into a table. This API uses a callback to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.
- **callback**: callback invoked to return the result. If the operation is successful, the row ID will be returned; otherwise, **-1** will be returned.|
| RdbStore | insert(table: string, values: ValuesBucket): Promise<number> | Inserts a row of data into a table. This API uses a promise to return the result.
- **table**: name of the target table.
- **values**: data to be inserted into the table.|
- **Updating data**
@@ -190,7 +190,7 @@ You can obtain the distributed table name for a remote device based on the local
| -------- | -------- | -------- |
| RdbStore |off(event:'dataChange', type: SubscribeType, observer: Callback\>): void;| Unregisters the observer of the specified type for the RDB store. This API uses a callback to return the result.
- **type**: subscription type. **SUBSCRIBE_TYPE_REMOTE** means to subscribe to remote data changes.
- **observer**: observer to unregister.|
-### Backing Up and Restore an RDB Store
+### Backing Up and Restoring an RDB Store
**Backing Up an RDB Store**
@@ -198,8 +198,8 @@ You can obtain the distributed table name for a remote device based on the local
| Class| API| Description|
| -------- | -------- | -------- |
-| RdbStore |backup(destName:string, callback: AsyncCallback<void>):void| Backs up the RDB store with the specified name. This API uses an asynchronous callback to return the result.
- **destName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.|
-| RdbStore |backup(destName:string): Promise<void>| Backs up the RDB store with the specified name. This API uses a promise to return the result.
- **destName**: name of the RDB backup file.|
+| RdbStore |backup(destName:string, callback: AsyncCallback<void>):void| Backs up an RDB store. This API uses an asynchronous callback to return the result.
- **destName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.|
+| RdbStore |backup(destName:string): Promise<void>| Backs up an RDB store. This API uses a promise to return the result.
- **destName**: name of the RDB backup file.|
**Restoring an RDB Store**
@@ -207,8 +207,8 @@ You can obtain the distributed table name for a remote device based on the local
| Class| API| Description|
| -------- | -------- | -------- |
-| RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| Restores an RDB store using the specified backup file. This API uses an asynchronous callback to return the result.
- **srcName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.|
-| RdbStore |restore(srcName:string): Promise<void>| Restores an RDB store using the specified backup file. This API uses a promise to return the result.
- **srcName**: name of the RDB backup file.|
+| RdbStore |restore(srcName:string, callback: AsyncCallback<void>):void| Restores an RDB store using a backup file. This API uses an asynchronous callback to return the result.
- **srcName**: name of the RDB backup file.
- **callback**: callback invoked to return the result.|
+| RdbStore |restore(srcName:string): Promise<void>| Restores an RDB store using a backup file. This API uses a promise to return the result.
- **srcName**: name of the RDB backup file.|
## How to Develop
@@ -270,7 +270,7 @@ You can obtain the distributed table name for a remote device based on the local
const blobType = resultSet.getBlob(resultSet.getColumnIndex("blobType"))
resultSet.close()
})
- ```
+ ```
4. Set the distributed tables to be synchronized.
diff --git a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
index c4e4fdf3850f4bd3b1b8f6902133835764414cb3..fb107049c515d0ff1961313a9f0bebb39c4e4c9d 100644
--- a/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
+++ b/en/application-dev/device-usage-statistics/device-usage-statistics-dev-guide.md
@@ -3,7 +3,6 @@
## When to Use
With device usage statistics APIs, you can have a better understanding of the application, notification, and system usage. For example, in application usage statistics, you can query the application usage, event log, and bundle group.
-
The application records (usage history statistics and event records) cached by components are updated to the database for persistent storage within 30 minutes after an event is reported.
## Available APIs
@@ -23,7 +22,7 @@ import stats from '@ohos.bundleState';
| function queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void | Queries the priority group of this application. This API uses an asynchronous callback to return the result.|
| function queryAppUsagePriorityGroup(): Promise<number>; | Queries the priority group of this application. This API uses a promise to return the result.|
| function isIdleState(bundleName: string, callback: AsyncCallback<boolean>): void | Checks whether the application specified by **bundleName** is in the idle state. |
-| function getRecentlyUsedModules(maxNum: number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**.|
+| function getRecentlyUsedModules(maxNum? : number, callback: AsyncCallback<BundleActiveModuleInfo>): void | Obtains the number of FA usage records specified by **maxNum**. If **maxNum** is not specified, the default value **1000** is used.|
| function queryAppNotificationNumber(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries the number of notifications from all applications based on the specified start time and end time.|
| function queryBundleActiveEventStates(begin: number, end: number, callback: AsyncCallback<Array<BundleActiveEventState>>): void | Queries statistics about system events (hibernation, wakeup, unlocking, and screen locking) that occur between the specified start time and end time.|
| function queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void | Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.|
@@ -45,7 +44,7 @@ import stats from '@ohos.bundleState';
...,
"reqPermissions": [
{
- "name": "ohos.permission.BUNDLE_ACTIVE_INFO"
+ "name": "ohos.permission.BUNDLE_ACTIVE_INFO"
}
]
}
@@ -57,13 +56,13 @@ import stats from '@ohos.bundleState';
import stats from '@ohos.bundleState'
// Promise mode
- stats.queryBundleActiveStates(0, 20000000000000).then( res => {
+ stats.queryBundleActiveStates(0, 20000000000000).then(res => {
console.log('BUNDLE_ACTIVE queryBundleActiveStates promise success.');
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryBundleActiveStates promise number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleActiveStates promise result ' + JSON.stringify(res[i]));
}
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE queryBundleActiveStates promise failed, because: ' + err.code);
});
@@ -87,7 +86,7 @@ import stats from '@ohos.bundleState';
import stats from '@ohos.bundleState'
// Promise mode
- stats.queryBundleStateInfos(0, 20000000000000).then( res => {
+ stats.queryBundleStateInfos(0, 20000000000000).then(res => {
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise success.');
let i = 1;
for (let key in res){
@@ -95,7 +94,7 @@ import stats from '@ohos.bundleState';
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise result ' + JSON.stringify(res[key]));
i++;
}
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE queryBundleStateInfos promise failed, because: ' + err.code);
});
@@ -121,13 +120,13 @@ import stats from '@ohos.bundleState';
import stats from '@ohos.bundleState'
// Promise mode
- stats.queryCurrentBundleActiveStates(0, 20000000000000).then( res => {
+ stats.queryCurrentBundleActiveStates(0, 20000000000000).then(res => {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise success.');
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise result ' + JSON.stringify(res[i]));
}
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE queryCurrentBundleActiveStates promise failed, because: ' + err.code);
});
@@ -151,13 +150,13 @@ import stats from '@ohos.bundleState';
import stats from '@ohos.bundleState'
// Promise mode
- stats.queryBundleStateInfoByInterval(0, 0, 20000000000000).then( res => {
+ stats.queryBundleStateInfoByInterval(0, 0, 20000000000000).then(res => {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise success.');
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise number : ' + (i + 1));
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise result ' + JSON.stringify(res[i]));
}
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE queryBundleStateInfoByInterval promise failed, because: ' + err.code);
});
@@ -179,14 +178,14 @@ import stats from '@ohos.bundleState';
```js
import stats from '@ohos.bundleState'
-
+
// Promise mode
- stats.queryAppUsagePriorityGroup().then( res => {
+ stats.queryAppUsagePriorityGroup().then(res => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res));
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code);
});
-
+
// Callback mode
stats.queryAppUsagePriorityGroup((err, res) => {
if (err) {
@@ -196,16 +195,16 @@ import stats from '@ohos.bundleState';
}
});
```
-
+
7. Check whether the application specified by **bundleName** is in the idle state. This requires no permission to be configured in the **config.json** file. A third-party application can only check the idle status of itself.
```js
import stats from '@ohos.bundleState'
// Promise mode
- stats.isIdleState("com.ohos.camera").then( res => {
+ stats.isIdleState("com.ohos.camera").then(res => {
console.log('BUNDLE_ACTIVE isIdleState promise succeeded, result: ' + JSON.stringify(res));
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE isIdleState promise failed, because: ' + err.code);
});
@@ -225,18 +224,18 @@ import stats from '@ohos.bundleState';
import stats from '@ohos.bundleState'
// Promise mode
- stats.getRecentlyUsedModules(1000).then( res => {
+ stats.getRecentlyUsedModules(1000).then(res => {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded');
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1));
console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise result ' + JSON.stringify(res[i]));
}
- }).catch( err=> {
+ }).catch(err=> {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise failed, because: ' + err.code);
});
// Promise mode when maxNum is not specified
- stats.getRecentlyUsedModules().then( res => {
+ stats.getRecentlyUsedModules().then(res => {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise succeeded');
for (let i = 0; i < res.length; i++) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules promise number : ' + (i + 1));
@@ -247,7 +246,7 @@ import stats from '@ohos.bundleState';
});
// Asynchronous callback mode
- stats.getRecentlyUsedModules(1000,(err, res) => {
+ stats.getRecentlyUsedModules(1000, (err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
@@ -261,7 +260,7 @@ import stats from '@ohos.bundleState';
// Asynchronous callback mode when maxNum is not specified
stats.getRecentlyUsedModules((err, res) => {
- if(err) {
+ if (err) {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE getRecentlyUsedModules callback succeeded.');
@@ -279,10 +278,10 @@ import stats from '@ohos.bundleState';
import stats from '@ohos.bundleState'
// Promise mode
- stats.queryAppNotificationNumber(0, 20000000000000).then( res => {
+ stats.queryAppNotificationNumber(0, 20000000000000).then(res => {
console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise success.');
console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise result ' + JSON.stringify(res));
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE queryAppNotificationNumber promise failed, because: ' + err.code);
});
@@ -301,15 +300,15 @@ import stats from '@ohos.bundleState';
```js
import stats from '@ohos.bundleState'
-
+
// Promise mode
- stats.queryBundleActiveEventStates(0, 20000000000000).then( res => {
+ stats.queryBundleActiveEventStates(0, 20000000000000).then(res => {
console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise success.');
console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise result ' + JSON.stringify(res));
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE queryBundleActiveEventStates promise failed, because: ' + err.code);
});
-
+
// Asynchronous callback mode
stats.queryBundleActiveEventStates(0, 20000000000000, (err, res) => {
if (err) {
@@ -325,14 +324,14 @@ import stats from '@ohos.bundleState';
```js
import stats from '@ohos.bundleState'
-
+
// Promise mode without parameters
- stats.queryAppUsagePriorityGroup().then( res => {
+ stats.queryAppUsagePriorityGroup().then(res => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise succeeded. result: ' + JSON.stringify(res));
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup promise failed. because: ' + err.code);
});
-
+
// Asynchronous callback mode without parameters
stats.queryAppUsagePriorityGroup((err, res) => {
if (err) {
@@ -341,17 +340,17 @@ import stats from '@ohos.bundleState';
console.log('BUNDLE_ACTIVE queryAppUsagePriorityGroup callback succeeded. result: ' + JSON.stringify(res));
}
});
-
+
// Promise mode with parameters
- stats.queryAppUsagePriorityGroup(this.bundleName).then( res => {
+ stats.queryAppUsagePriorityGroup(this.bundleName).then(res => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res));
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code);
});
-
+
// Asynchronous callback mode with parameters
stats.queryAppUsagePriorityGroup(this.bundleName, (err, res) => {
- if(err) {
+ if (err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res));
@@ -363,16 +362,16 @@ import stats from '@ohos.bundleState';
```javascript
import stats from '@ohos.bundleState'
-
+
// Promise mode
- stats.setBundleGroup(this.bundleName, this.newGroup).then( () => {
+ stats.setBundleGroup(this.bundleName, this.newGroup).then(() => {
console.log('BUNDLE_ACTIVE SetBundleGroup promise succeeded.');
}).catch( err => {
console.log('BUNDLE_ACTIVE SetBundleGroup promise failed. because: ' + err.code);
});
// Asynchronous callback mode
stats.setBundleGroup(this.bundleName, this.newGroup, (err) => {
- if(err) {
+ if (err) {
console.log('BUNDLE_ACTIVE SetBundleGroup callback failed. because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE SetBundleGroup callback succeeded.');
@@ -384,9 +383,9 @@ import stats from '@ohos.bundleState';
```javascript
import stats from '@ohos.bundleState'
-
+
// Promise mode
- let onBundleGroupChanged = (err,res) =>{
+ let onBundleGroupChanged = (err,res) => {
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.');
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result oldGroup is : ' + res.oldGroup);
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result newGroup is : ' + res.newGroup);
@@ -394,13 +393,13 @@ import stats from '@ohos.bundleState';
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result userId is : ' + res.userId);
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result bundleName is : ' + res.bundleName);
};
- stats.registerGroupCallBack(onBundleGroupChanged).then( () => {
+ stats.registerGroupCallBack(onBundleGroupChanged).then(() => {
console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise succeeded.');
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise failed. because: ' + err.code);
});
// Asynchronous callback mode
- let onBundleGroupChanged = (err,res) =>{
+ let onBundleGroupChanged = (err,res) => {
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.');
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's oldGroup is : ' + res.oldGroup);
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's newGroup is : ' + res.newGroup);
@@ -408,29 +407,29 @@ import stats from '@ohos.bundleState';
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's userId is : ' + res.userId);
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's bundleName is : ' + res.bundleName);
};
- stats.registerGroupCallBack(onBundleGroupChanged, (err)=>{
- if(err) {
+ stats.registerGroupCallBack(onBundleGroupChanged, (err) => {
+ if (err) {
console.log('BUNDLE_ACTIVE RegisterGroupCallBack callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE RegisterGroupCallBack callback success.');
}
});
```
-
+
13. Deregister the callback for application group changes.
```javascript
import stats from '@ohos.bundleState'
-
+
//promise
- stats.unRegisterGroupCallBack().then( () => {
+ stats.unRegisterGroupCallBack().then(() => {
console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise succeeded.');
- }).catch( err => {
+ }).catch(err => {
console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack promise failed. because: ' + err.code);
});
//callback
- stats.unRegisterGroupCallBack((err)=>{
- if(err) {
+ stats.unRegisterGroupCallBack((err) => {
+ if (err) {
console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack callback failed, because: ' + err.code);
} else {
console.log('BUNDLE_ACTIVE UnRegisterGroupCallBack callback success.');
diff --git a/en/application-dev/device/device-location-geocoding.md b/en/application-dev/device/device-location-geocoding.md
index 30f647d98a368168ba945e11f11bb59f65a5b455..f95df63eebe64eedb6063ae193f4b141bfd946c6 100644
--- a/en/application-dev/device/device-location-geocoding.md
+++ b/en/application-dev/device/device-location-geocoding.md
@@ -3,9 +3,9 @@
## When to Use
-Describing a location using coordinates is accurate, but neither intuitive nor user-friendly.
+Describing a location using coordinates is accurate, but neither intuitive nor user-friendly. With the geocoding and reverse geocoding capabilities, you will be able to convert geographic description into specific coordinates and vice versa.
-With the geocoding and reverse geocoding capabilities, you will be able to convert geographic description into specific coordinates and vice versa. The geocoding information describes a location using several attributes, including the country, administrative region, street, house number, and address, etc.
+The geographic description helps users understand a location easily by providing several key attributes, for example, country, administrative region, street, house number, and address.
## Available APIs
@@ -36,13 +36,29 @@ The following table describes APIs available for mutual conversion between coord
import geolocation from '@ohos.geolocation';
```
-2. Obtain the conversion result.
+2. Query whether geocoder service is available.
+ - Call **isGeoServiceAvailable** to query whether the geocoder service is available. If the service is available, continue with step 3.
+ ```
+ geolocation.isGeoServiceAvailable((err, data) => {
+ if (err) {
+ console.log('isGeoServiceAvailable err: ' + JSON.stringify(err));
+ } else {
+ console.log('isGeoServiceAvailable data: ' + JSON.stringify(data));
+ }
+ });
+ ```
+
+3. Obtain the conversion result.
- Call **getAddressesFromLocation** to convert coordinates into geographical location information.
```
var reverseGeocodeRequest = {"latitude": 31.12, "longitude": 121.11, "maxItems": 1};
- geolocation.getAddressesFromLocation(reverseGeocodeRequest, (data) => {
- console.log('getAddressesFromLocation: ' + JSON.stringify(data));
+ geolocation.getAddressesFromLocation(reverseGeocodeRequest, (err, data) => {
+ if (err) {
+ console.log('getAddressesFromLocation err: ' + JSON.stringify(err));
+ } else {
+ console.log('getAddressesFromLocation data: ' + JSON.stringify(data));
+ }
});
```
@@ -51,8 +67,12 @@ The following table describes APIs available for mutual conversion between coord
```
var geocodeRequest = {"description": "No. xx, xx Road, Pudong District, Shanghai", "maxItems": 1};
- geolocation.getAddressesFromLocationName(geocodeRequest, (data) => {
- console.log('getAddressesFromLocationName: ' + JSON.stringify(data));
+ geolocation.getAddressesFromLocationName(geocodeRequest, (err, data) => {
+ if (err) {
+ console.log('getAddressesFromLocationName err: ' + JSON.stringify(err));
+ } else {
+ console.log('getAddressesFromLocationName data: ' + JSON.stringify(data));
+ }
});
```
diff --git a/en/application-dev/device/device-location-info.md b/en/application-dev/device/device-location-info.md
index 84f189d7f247bd9516204c7dd0d76aafb6438dbb..a32decd05ac0ba0d6db06749c18dcd31d3a7645b 100644
--- a/en/application-dev/device/device-location-info.md
+++ b/en/application-dev/device/device-location-info.md
@@ -14,49 +14,49 @@ The following table describes APIs available for obtaining device location infor
**Table 1** APIs for obtaining device location information
-| API | Description |
-| -------- | -------- |
-| on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>) : void | Registers a listener for location changes with a location request initiated. |
-| off(type: 'locationChange', callback?: Callback<Location>) : void | Unregisters the listener for location changes with the corresponding location request deleted. |
-| on(type: 'locationServiceState', callback: Callback<boolean>) : void | Registers a listener for location service status change events. |
-| off(type: 'locationServiceState', callback: Callback<boolean>) : void | Unregisters the listener for location service status change events. |
-| on(type: 'cachedGnssLocationsReporting', request: CachedGnssLoactionsRequest, callback: Callback<Array<Location>>) : void; | Registers a listener for cached GNSS location reports. |
-| off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>) : void; | Unregisters the listener for cached GNSS location reports. |
-| on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>) : void; | Registers a listener for satellite status change events. |
-| off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>) : void; | Unregisters the listener for satellite status change events. |
-| on(type: 'nmeaMessageChange', callback: Callback<string>) : void; | Registers a listener for GNSS NMEA message change events. |
-| off(type: 'nmeaMessageChange', callback?: Callback<string>) : void; | Unregisters the listener for GNSS NMEA message change events. |
-| on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; | Registers a listener for status change events of the specified geofence. |
-| off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; | Unregisters the listener for status change events of the specified geofence. |
-| getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>) : void | Obtains the current location. This function uses an asynchronous callback to return the result. |
-| getCurrentLocation(request?: CurrentLocationRequest) : Promise<Location> | Obtains the current location. This function uses a promise to return the result. |
-| getLastLocation(callback: AsyncCallback<Location>) : void | Obtains the previous location. This function uses an asynchronous callback to return the result. |
-| getLastLocation() : Promise<Location> | Obtains the previous location. This function uses a promise to return the result. |
-| isLocationEnabled(callback: AsyncCallback<boolean>) : void | Checks whether the location service is enabled. This function uses an asynchronous callback to return the result. |
-| isLocationEnabled() : Promise<boolean> | Checks whether the location service is enabled. This function uses a promise to return the result. |
-| requestEnableLocation(callback: AsyncCallback<boolean>) : void | Requests to enable the location service. This function uses an asynchronous callback to return the result. |
-| requestEnableLocation() : Promise<boolean> | Requests to enable the location service. This function uses a promise to return the result. |
-| enableLocation(callback: AsyncCallback<boolean>) : void | Enables the location service. This function uses an asynchronous callback to return the result. |
-| enableLocation() : Promise<boolean> | Enables the location service. This function uses a promise to return the result. |
-| disableLocation(callback: AsyncCallback<boolean>) : void | Disables the location service. This function uses an asynchronous callback to return the result. |
-| disableLocation() : Promise<boolean> | Disables the location service. This function uses a promise to return the result. |
-| getCachedGnssLocationsSize(callback: AsyncCallback<number>) : void; | Obtains the number of cached GNSS locations. This function uses an asynchronous callback to return the result. |
-| getCachedGnssLocationsSize() : Promise<number>; | Obtains the number of cached GNSS locations. This function uses a promise to return the result. |
-| flushCachedGnssLocations(callback: AsyncCallback<boolean>) : void; | Obtains all cached GNSS locations and clears the GNSS cache queue. This function uses an asynchronous callback to return the result. |
-| flushCachedGnssLocations() : Promise<boolean>; | Obtains all cached GNSS locations and clears the GNSS cache queue. This function uses a promise to return the result. |
-| sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>) : void; | Sends extended commands to the location subsystem. This function uses an asynchronous callback to return the result. |
-| sendCommand(command: LocationCommand) : Promise<boolean>; | Sends extended commands to the location subsystem. This function uses a promise to return the result. |
-| isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback<boolean>) : void; | Checks whether a user agrees with the privacy statement of the location service. This function uses an asynchronous callback to return the result. |
-| isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise<boolean>; | Checks whether a user agrees with the privacy statement of the location service. This function uses a promise to return the result. |
-| setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean, callback: AsyncCallback<boolean>) : void; | Sets the user confirmation status for the privacy statement of the location service. This function uses an asynchronous callback to return the result. |
-| setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean) : Promise<boolean>; | Sets the user confirmation status for the privacy statement of the location service. This function uses a promise to return the result. |
+| API | Description |
+| ------------------------------------------------------------ | ------------------------------------------------------------ |
+| on(type: 'locationChange', request: LocationRequest, callback: Callback<Location>) : void | Registers a listener for location changes with a location request initiated. |
+| off(type: 'locationChange', callback?: Callback<Location>) : void | Unregisters the listener for location changes with the corresponding location request deleted. |
+| on(type: 'locationServiceState', callback: Callback<boolean>) : void | Registers a listener for location service status change events. |
+| off(type: 'locationServiceState', callback: Callback<boolean>) : void | Unregisters the listener for location service status change events. |
+| on(type: 'cachedGnssLocationsReporting', request: CachedGnssLoactionsRequest, callback: Callback<Array<Location>>) : void; | Registers a listener for cached GNSS location reports. |
+| off(type: 'cachedGnssLocationsReporting', callback?: Callback<Array<Location>>) : void; | Unregisters the listener for cached GNSS location reports. |
+| on(type: 'gnssStatusChange', callback: Callback<SatelliteStatusInfo>) : void; | Registers a listener for satellite status change events. |
+| off(type: 'gnssStatusChange', callback?: Callback<SatelliteStatusInfo>) : void; | Unregisters the listener for satellite status change events. |
+| on(type: 'nmeaMessageChange', callback: Callback<string>) : void; | Registers a listener for GNSS NMEA message change events. |
+| off(type: 'nmeaMessageChange', callback?: Callback<string>) : void; | Unregisters the listener for GNSS NMEA message change events. |
+| on(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; | Registers a listener for status change events of the specified geofence. |
+| off(type: 'fenceStatusChange', request: GeofenceRequest, want: WantAgent) : void; | Unregisters the listener for status change events of the specified geofence. |
+| getCurrentLocation(request: CurrentLocationRequest, callback: AsyncCallback<Location>) : void | Obtains the current location. This API uses an asynchronous callback to return the result. |
+| getCurrentLocation(request?: CurrentLocationRequest) : Promise<Location> | Obtains the current location. This API uses a promise to return the result. |
+| getLastLocation(callback: AsyncCallback<Location>) : void | Obtains the previous location. This API uses an asynchronous callback to return the result. |
+| getLastLocation() : Promise<Location> | Obtains the previous location. This API uses a promise to return the result. |
+| isLocationEnabled(callback: AsyncCallback<boolean>) : void | Checks whether the location service is enabled. This API uses an asynchronous callback to return the result. |
+| isLocationEnabled() : Promise<boolean> | Checks whether the location service is enabled. This API uses a promise to return the result. |
+| requestEnableLocation(callback: AsyncCallback<boolean>) : void | Requests to enable the location service. This API uses an asynchronous callback to return the result. |
+| requestEnableLocation() : Promise<boolean> | Requests to enable the location service. This API uses a promise to return the result. |
+| enableLocation(callback: AsyncCallback<boolean>) : void | Enables the location service. This API uses an asynchronous callback to return the result. |
+| enableLocation() : Promise<boolean> | Enables the location service. This API uses a promise to return the result. |
+| disableLocation(callback: AsyncCallback<boolean>) : void | Disables the location service. This API uses an asynchronous callback to return the result. |
+| disableLocation() : Promise<boolean> | Disables the location service. This API uses a promise to return the result. |
+| getCachedGnssLocationsSize(callback: AsyncCallback<number>) : void; | Obtains the number of cached GNSS locations. This API uses an asynchronous callback to return the result. |
+| getCachedGnssLocationsSize() : Promise<number>; | Obtains the number of cached GNSS locations. This API uses a promise to return the result. |
+| flushCachedGnssLocations(callback: AsyncCallback<boolean>) : void; | Obtains all cached GNSS locations and clears the GNSS cache queue. This API uses an asynchronous callback to return the result.|
+| flushCachedGnssLocations() : Promise<boolean>; | Obtains all cached GNSS locations and clears the GNSS cache queue. This API uses a promise to return the result.|
+| sendCommand(command: LocationCommand, callback: AsyncCallback<boolean>) : void; | Sends extended commands to the location subsystem. This API uses an asynchronous callback to return the result.|
+| sendCommand(command: LocationCommand) : Promise<boolean>; | Sends extended commands to the location subsystem. This API uses a promise to return the result. |
+| isLocationPrivacyConfirmed(type : LocationPrivacyType, callback: AsyncCallback<boolean>) : void; | Checks whether a user agrees with the privacy statement of the location service. This API uses an asynchronous callback to return the result.|
+| isLocationPrivacyConfirmed(type : LocationPrivacyType,) : Promise<boolean>; | Checks whether a user agrees with the privacy statement of the location service. This API uses a promise to return the result.|
+| setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean, callback: AsyncCallback<boolean>) : void; | Sets the user confirmation status for the privacy statement of the location service. This API uses an asynchronous callback to return the result.|
+| setLocationPrivacyConfirmStatus(type : LocationPrivacyType, isConfirmed : boolean) : Promise<boolean>; | Sets the user confirmation status for the privacy statement of the location service. This API uses a promise to return the result.|
## How to Develop
To learn more about the APIs for obtaining device location information, see [Geolocation](../reference/apis/js-apis-geolocation.md).
-1. Before using basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user. For details, see the following section.
+1. Before using basic location capabilities, check whether your application has been granted the permission to access the device location information. If not, your application needs to obtain the permission from the user as described below.
The system provides the following location permissions:
- ohos.permission.LOCATION
@@ -64,9 +64,9 @@ To learn more about the APIs for obtaining device location information, see [Geo
The **ohos.permission.LOCATION** permission is a must if your application needs to access the device location information.
- If your application needs to access the device location information when running on the background, it must be allowed to run on the background in the configuration file and also granted the **ohos.permission.LOCATION_IN_BACKGROUND** permission. In this way, the system continues to report device location information even when your application moves to the background.
+ If your application needs to access the device location information when running on the background, it must be configured to be able to run on 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.
- To allow your application to access device location information, you can declare the required permissions in the **config.json** file of your application. The sample code is as follows:
+ To allow your application to access device location information, declare the required permissions in the **module.json** file of your application. The sample code is as follows:
```
@@ -83,8 +83,8 @@ To learn more about the APIs for obtaining device location information, see [Geo
}
}
```
-
- For details about the fields, see .
+
+ For details about the fields, see [Application Package Structure Configuration File](../quick-start/stage-structure.md).
2. Import the **geolocation** module by which you can implement all APIs related to the basic location capabilities.
@@ -92,7 +92,7 @@ To learn more about the APIs for obtaining device location information, see [Geo
import geolocation from '@ohos.geolocation';
```
-3. Instantiate the **LocationRequest** object. This object provides APIs to notify the system of the location service type and the interval of reporting location information.
+3. Instantiate the **LocationRequest** object. This object provides APIs to notify the system of the location service type and the interval of reporting location information.
**Method 1:**
To better serve your needs for using APIs, the system has categorized APIs into different packages to match your common use cases of the location function. In this way, you can directly use the APIs specific to a certain use case, making application development much easier. The following table lists the use cases currently supported.
@@ -112,18 +112,18 @@ To learn more about the APIs for obtaining device location information, see [Geo
**Table 2** Common use cases of the location function
- | Use Case | Constant | Description |
- | -------- | -------- | -------- |
- | Navigation | NAVIGATION | 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, the GNSS positioning technology is mainly used to ensure the location accuracy. However, due to its limitations, the technology may be unable to provide the location service when navigation is just started or when the user moves into a shielded environment such as indoors or a garage. To resolve this issue, the system uses the network positioning technology as an alternative to provide the location service for your application until the GNSS can provide stable location results. This helps achieve a smooth navigation experience for users.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization. |
- | Trajectory tracking | TRAJECTORY_TRACKING | 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.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization. |
- | Ride hailing | CAR_HAILING | Applicable when your application needs to obtain the current location of a user who is hailing a taxi.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization. |
- | Life service | DAILY_LIFE_SERVICE | 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.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization. |
- | Power efficiency | NO_POWER | Applicable when your application does not proactively start the location service for a higher battery efficiency. 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.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization. |
-
- The following example instantiates the **RequestParam** object for navigation:
+ | Use Case | Constant | Description |
+ | ------------ | ------------------- | ------------------------------------------------------------ |
+ | Navigation | NAVIGATION | 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, the GNSS positioning technology is mainly used to ensure the location accuracy. However, due to its limitations, the technology may be unable to provide the location service when navigation is just started or when the user moves into a shielded environment such as indoors or a garage. To resolve this issue, the system uses the network positioning technology as an alternative to provide the location service for your application until the GNSS can provide stable location results. This helps achieve a smooth navigation experience for users.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
+ | Trajectory tracking| TRAJECTORY_TRACKING | 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.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
+ | Ride hailing| CAR_HAILING | Applicable when your application needs to obtain the current location of a user who is hailing a taxi.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
+ | Life service| DAILY_LIFE_SERVICE | 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.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
+ | Power efficiency | NO_POWER | Applicable when your application does not proactively start the location service for a higher battery efficiency. 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.
By default, the system reports location results at a minimal interval of 1s. To adopt this use case, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
+
+ Sample code for initializing **requestInfo** for navigation:
```
- var requestInfo = {'scenario': 0x301, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
+ var requestInfo = {'scenario': geolocation.LocationRequestScenario.NAVIGATION, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
```
**Method 2:**
@@ -143,20 +143,20 @@ To learn more about the APIs for obtaining device location information, see [Geo
**Table 3** Location priority policies
- | Policy | Constant | Description |
- | -------- | -------- | -------- |
- | Location accuracy priority | 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.
To use this policy, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization. |
- | Fast location priority | FAST_FIRST_FIX | 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. This policy can lead to significant hardware resource consumption and power consumption.
To use this policy, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization. |
- | Power efficiency priority | LOW_POWER | 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.
To use this policy, you must declare at least the **ohos.permission.LOCATION** permission and obtain users' authorization. |
+ | Policy | Constant | Description |
+ | ------------------ | -------------- | ------------------------------------------------------------ |
+ | Location accuracy priority | 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.
To use this policy, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
+ | Fast location priority | FAST_FIRST_FIX | 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. This policy can lead to significant hardware resource consumption and power consumption.
To use this policy, you must declare the **ohos.permission.LOCATION** permission and obtain users' authorization.|
+ | Power efficiency priority| LOW_POWER | 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.
To use this policy, you must declare at least the **ohos.permission.LOCATION** permission and obtain users' authorization.|
- The following example instantiates the **RequestParam** object for the location accuracy priority policy:
+ Sample code for initializing **requestInfo** for the location accuracy priority policy:
```
- var requestInfo = {'priority': 0x201, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
+ var requestInfo = {'priority': geolocation.LocationRequestPriority.ACCURACY, 'timeInterval': 0, 'distanceInterval': 0, 'maxAccuracy': 0};
```
4. Instantiate the **Callback** object for the system to report location results.
- Your application needs to implement the callback interface defined by the system. When the system successfully obtains the real-time location of a device, it will report the location result to your application through the callback interface. Your application can implement the callback interface in such a way to complete your own service logic.
+ Your application needs to implement the callback defined by the system. When the system successfully obtains the real-time location of a device, it will report the location result to your application through the callback interface. Your application can implement the callback interface in such a way to complete your own service logic.
```
var locationChange = (location) => {
@@ -176,11 +176,15 @@ To learn more about the APIs for obtaining device location information, see [Geo
geolocation.off('locationChange', locationChange);
```
- If your application does not need the real-time device location, it can use the last known device location cached in the system instead.
-
+If your application does not need the real-time device location, it can use the last known device location cached in the system instead.
+
```
- geolocation.getLastLocation((data) => {
- console.log('getLastLocation: data: ' + JSON.stringify(data));
+ geolocation.getLastLocation((err, data) => {
+ if (err) {
+ console.log('getLastLocation: err: ' + JSON.stringify(err));
+ } else {
+ console.log('getLastLocation: data: ' + JSON.stringify(data));
+ }
});
```
diff --git a/en/application-dev/dfx/hiappevent-guidelines.md b/en/application-dev/dfx/hiappevent-guidelines.md
index e1d4cddeb2ff96c8a07a6df84382ad0b8d22464c..54199719cd93a523d8f2b0af14c12578997a02a2 100644
--- a/en/application-dev/dfx/hiappevent-guidelines.md
+++ b/en/application-dev/dfx/hiappevent-guidelines.md
@@ -2,13 +2,13 @@
## When to Use
-The event logging function helps applications log various information generated during running.
+The event logging function helps applications to log various information generated during running.
## Available APIs
JS application event logging APIs are provided by the **hiAppEvent** module.
-**APIs for Event Logging**
+**Table 1** APIs for event logging
| API | Return Value | Description |
| ------------------------------------------------------------ | -------------- | ------------------------------------------------------------ |
@@ -17,7 +17,7 @@ JS application event logging APIs are provided by the **hiAppEvent** module.
When an asynchronous callback is used, the return value can be processed directly in the callback. When a promise is used, the return value can also be processed in the promise in a similar way. For details about the result codes, see [Event Verification Result Codes](#event-verification-result-codes).
-**APIs for Event Logging Configuration**
+**Table 2** APIs for event logging configuration
| API | Return Value | Description |
| ------------------------------ | ------------ | ------------------------------------------------------------ |
diff --git a/en/application-dev/dfx/hiappevent-overview.md b/en/application-dev/dfx/hiappevent-overview.md
index 403aec02035c965da4633e8667be6803031ddf60..2a5e36f879a922f3d6bf845e700068c2a299b337 100644
--- a/en/application-dev/dfx/hiappevent-overview.md
+++ b/en/application-dev/dfx/hiappevent-overview.md
@@ -2,8 +2,10 @@
HiAppEvent provides event logging APIs for applications to log the fault, statistical, security, and user behavior events reported during running. Based on event information, you will be able to analyze the running status of your application.
+The HiAppEvent module of OpenHarmony can be used to develop application event services and provide functions related to application events, including flushing application events to a disk and querying historical application event data.
+
## Basic Concepts
-The HiAppEvent module of OpenHarmony can be used to develop application event services and provide functions related to application events, including flushing application events to a disk and querying historical application event data.
+- **Logging**
-**Logging**: Logs changes caused by user operations to provide service data for development, product, and O&M analysis.
+ Logs changes caused by user operations to provide service data for development, product, and O&M analysis.
diff --git a/en/application-dev/dfx/hitracemeter-guidelines.md b/en/application-dev/dfx/hitracemeter-guidelines.md
index e7e97631c240bb42358d3b0b630a92094f34bcfc..316ee1b07898a24721b81625c2e9193ae08aa85f 100644
--- a/en/application-dev/dfx/hitracemeter-guidelines.md
+++ b/en/application-dev/dfx/hitracemeter-guidelines.md
@@ -6,9 +6,9 @@ HiTraceMeter provides APIs for system performance tracing. You can call the APIs
## Available APIs
-The performance tracing APIs are provided by the **hiTraceMeter** module. For details, see [API Reference]( ../reference/apis/js-apis-hitracemeter.md).
+The performance tracing APIs are provided by the **hiTraceMeter** module. For details, see [API Reference](../reference/apis/js-apis-hitracemeter.md).
-**APIs for performance tracing**
+**Table 1** APIs for performance tracing
| API| Return Value| Description|
| ---------------------------------------------------------------------------- | --------- | ------------ |
diff --git a/en/application-dev/dfx/hitracemeter-overview.md b/en/application-dev/dfx/hitracemeter-overview.md
index 3683092b34fcd23a65245303406934b3fb8acad5..649fa7704dd566ab8bc02776de6f62756d7f26a6 100644
--- a/en/application-dev/dfx/hitracemeter-overview.md
+++ b/en/application-dev/dfx/hitracemeter-overview.md
@@ -15,4 +15,4 @@ hiTraceMeter is a tool for you to trace service processes and monitor system per
## Constraints
-- Due to the asynchronous I/O feature of JS, the hiTraceMeter module provides only asynchronous APIs.
+Due to the asynchronous I/O feature of JS, the hiTraceMeter module provides only asynchronous APIs.
diff --git a/en/application-dev/internationalization/i18n-guidelines.md b/en/application-dev/internationalization/i18n-guidelines.md
index 66b002200fc1c1965f1d3e741739685ae97236e6..0e34d66d523abea51e259bbcea5d7be08e755e3e 100644
--- a/en/application-dev/internationalization/i18n-guidelines.md
+++ b/en/application-dev/internationalization/i18n-guidelines.md
@@ -23,57 +23,64 @@ You can use APIs provided in the following table to obtain the system language a
### How to Develop
-1. Obtain the system language.
+1. Obtain the system language.
+
Call the **getSystemLanguage** method to obtain the system language (**i18n** is the name of the imported module).
- ```
+ ```js
var language = i18n.getSystemLanguage();
```
-2. Obtain the system region.
+2. Obtain the system region.
+
Call the **getSystemRegion** method to obtain the system region.
- ```
+ ```js
var region = i18n.getSystemRegion();
```
-3. Obtain the system locale.
+3. Obtain the system locale.
+
Call the **getSystemLocale** method to obtain the system locale.
- ```
+ ```js
var locale = i18n.getSystemLocale();
```
-4. Check whether the locale's language is RTL.
+4. Check whether the locale's language is RTL.
+
Call the **isRTL** method to check whether the locale's language is RTL.
- ```
+ ```js
var rtl = i18n.isRTL("zh-CN");
```
-5. Check whether the system uses a 24-hour clock.
+5. Check whether the system uses a 24-hour clock.
+
Call the **is24HourClock** method to check whether the system uses a 24-hour clock.
- ```
+ ```js
var hourClock = i18n.is24HourClock();
```
-6. Obtain the localized display of a language.
+6. Obtain the localized display of a language.
+
Call the **getDisplayLanguage** method to obtain the localized display of a language. **language** indicates the language to be localized, **locale** indicates the locale, and **sentenceCase** indicates whether the first letter of the result must be capitalized.
- ```
+ ```js
var language = "en";
var locale = "zh-CN";
var sentenceCase = false;
var localizedLanguage = i18n.getDisplayLanguage(language, locale, sentenceCase);
```
-7. Obtain the localized display of a country.
+7. Obtain the localized display of a country.
+
Call the **getDisplayCountry** method to obtain the localized display of a country name. **country** indicates the country code (a two-letter code in compliance with ISO-3166, for example, CN), **locale** indicates the locale, and **sentenceCase** indicates whether the first letter of the result must be capitalized.
- ```
+ ```js
var country = "US";
var locale = "zh-CN";
var sentenceCase = false;
@@ -106,70 +113,78 @@ You can use APIs provided in the following table to obtain the system language a
### How to Develop
-1. Instantiate a **Calendar** object.
+1. Instantiate a **Calendar** object.
+
Call the **getCalendar** method to obtain the time zone object of a specific locale and type (**i18n** is the name of the imported module). **type** indicates the valid calendar type, for example, **buddhist**, **chinese**, **coptic**, **ethiopic**, **hebrew**, **gregory**, **indian**, **islamic_civil**, **islamic_tbla**, **islamic_umalqura**, **japanese**, and **persian**. If **type** is left unspecified, the default calendar type of the locale is used.
- ```
+ ```js
var calendar = i18n.getCalendar("zh-CN", "gregory);
```
-2. Set the time for the **Calendar** object.
+2. Set the time for the **Calendar** object.
+
Call the **setTime** method to set the time of the **Calendar** object. This method receives two types of parameters. One is a **Date** object, and the other is a value indicating the number of milliseconds elapsed since January 1, 1970, 00:00:00 GMT.
- ```
+ ```js
var date1 = new Date();
calendar.setTime(date1);
var date2 = 1000;
calendar.setTime(date2);
```
-3. Set the year, month, day, hour, minute, and second for the **Calendar** object.
+3. Set the year, month, day, hour, minute, and second for the **Calendar** object.
+
Call the **set** method to set the year, month, day, hour, minute, and second for the **Calendar** object.
- ```
+ ```js
calendar.set(2021, 12, 21, 6, 0, 0)
```
-4. Set and obtain the time zone for the **Calendar** object.
+4. Set and obtain the time zone for the **Calendar** object.
+
Call the **setTimeZone** and **getTimeZone** methods to set and obtain the time zone for the **Calendar** object. The **setTimeZone** method requires an input string to indicate the time zone to be set.
- ```
+ ```js
calendar.setTimeZone("Asia/Shanghai");
var timezone = calendar.getTimeZone();
```
-5. Set and obtain the first day of a week for the **Calendar** object.
+5. Set and obtain the first day of a week for the **Calendar** object.
+
Call the **setFirstDayOfWeek** and **getFirstDayOfWeek** methods to set and obtain the first day of a week for the **Calendar** object. **setFirstDayOfWeek** must be set to a value indicating the first day of a week. The value **1** indicates Sunday, and the value **7** indicates Saturday.
- ```
+ ```js
calendar.setFirstDayOfWeek(1);
var firstDayOfWeek = calendar.getFirstDayOfWeek();
```
-6. Set and obtain the minimum count of days in the first week for the **Calendar** object.
+6. Set and obtain the minimum count of days in the first week for the **Calendar** object.
+
Call the **setMinimalDaysInFirstWeek** and **getMinimalDaysInFirstWeek** methods to set and obtain the minimum count of days in the first week for the **Calendar** object.
- ```
+ ```js
calendar.setMinimalDaysInFirstWeek(3);
var minimalDaysInFirstWeek = calendar.getMinimalDaysInFirstWeek();
```
-7. Obtain the localized display of the **Calendar** object.
+7. Obtain the localized display of the **Calendar** object.
+
Call the **getDisplayName** method to obtain the localized display of the **Calendar** object.
- ```
+ ```js
var localizedName = calendar.getDisplayName("zh-CN");
```
-8. Check whether a date is a weekend.
+8. Check whether a date is a weekend.
+
Call the **isWeekend** method to determine whether the input date is a weekend.
- ```
+ ```js
var date = new Date();
var weekend = calendar.isWeekend(date);
```
@@ -191,25 +206,26 @@ You can use APIs provided in the following table to obtain the system language a
### How to Develop
-1. Instantiate a **PhoneNumberFormat** object.
+1. Instantiate a **PhoneNumberFormat** object.
+
Call the **PhoneNumberFormat** constructor to instantiate a **PhoneNumberFormat** object. The country code and formatting options of the phone number need to be passed into this constructor. The formatting options are optional, including a style option. Values of this option include: **E164**, **INTERNATIONAL**, **NATIONAL**, and **RFC3966**.
- ```
+ ```js
var phoneNumberFormat = new i18n.PhoneNumberFormat("CN", {type: "E164"});
```
2. Check whether the phone number format is correct.
Call the **isValidNumber** method to check whether the format of the input phone number is correct.
- ```
+ ```js
var validNumber = phoneNumberFormat.isValidNumber("15812341234");
```
3. Format a phone number.
Call the **format** method of **PhoneNumberFormat** to format the input phone number.
- ```
+ ```js
var formattedNumber = phoneNumberFormat.format("15812341234");
```
@@ -232,7 +248,7 @@ The **unitConvert** API is provided to help you implement measurement conversion
Call the [unitConvert](../reference/apis/js-apis-intl.md) method to convert a measurement unit and format the display result.
- ```
+ ```js
var fromUnit = {unit: "cup", measureSystem: "US"};
var toUnit = {unit: "liter", measureSystem: "SI"};
var number = 1000;
@@ -259,32 +275,36 @@ The **unitConvert** API is provided to help you implement measurement conversion
### How to Develop
-1. Instantiate an **IndexUtil** object.
+1. Instantiate an **IndexUtil** object.
+
Call the **getInstance** method to instantiate an **IndexUtil** object for a specific locale. When the **locale** parameter is empty, instantiate an **IndexUtil** object of the default locale.
- ```
+ ```js
var indexUtil = getInstance("zh-CN");
```
-2. Obtain the index list.
+2. Obtain the index list.
+
Call the **getIndexList** method to obtain the alphabet index list of the current locale.
- ```
+ ```js
var indexList = indexUtil.getIndexList();
```
-3. Add an index.
+3. Add an index.
+
Call the **addLocale** method to add the alphabet index of a new locale to the current index list.
- ```
+ ```js
indexUtil.addLocale("ar")
```
-4. Obtain the index of a string.
+4. Obtain the index of a string.
+
Call the **getIndex** method to obtain the alphabet index of a string.
- ```
+ ```js
var text = "access index";
indexUtil.getIndex(text);
```
@@ -313,38 +333,42 @@ When a text is displayed in more than one line, [BreakIterator](../reference/api
### How to Develop
-1. Instantiate a **BreakIterator** object.
+1. Instantiate a **BreakIterator** object.
+
Call the **getLineInstance** method to instantiate a **BreakIterator** object.
- ```
+ ```js
var locale = "en-US"
var breakIterator = i18n.getLineInstance(locale);
```
-2. Set and access the text that requires line breaking.
+2. Set and access the text that requires line breaking.
+
Call the **setLineBreakText** and **getLineBreakText** methods to set and access the text that requires line breaking.
- ```
+ ```js
var text = "Apple is my favorite fruit";
breakIterator.setLineBreakText(text);
var breakText = breakIterator.getLineBreakText();
```
-3. Obtain the current position of the **BreakIterator** object.
+3. Obtain the current position of the **BreakIterator** object.
+
Call the **current** method to obtain the current position of the **BreakIterator** object in the text being processed.
- ```
+ ```js
var pos = breakIterator.current();
```
-4. Set the position of a **BreakIterator** object.
+4. Set the position of a **BreakIterator** object.
+
The following APIs are provided to adjust the **first**, **last**, **next**, **previous**, or **following** position of the **BreakIterator** object in the text to be processed.
- ```
+ ```js
var firstPos = breakIterator.first(); // Set a BreakIterator object to the first break point, that is, the start position of the text.
var lastPos = breakIterator.last(); // Set a BreakIterator object to the last break point, that is, the position after the text end.
// Move a BreakIterator object forward or backward by a certain number of break points.
@@ -356,10 +380,11 @@ When a text is displayed in more than one line, [BreakIterator](../reference/api
var followingPos = breakIterator.following(10);
```
-5. Determine whether a position is a break point.
+5. Determine whether a position is a break point.
+
Call the **isBoundary** method to determine whether a position is a break point. If yes, **true** is returned and the **BreakIterator** object is moved to this position. If no, **false** is returned and the **BreakIterator** object is moved to a break point after this position.
- ```
+ ```js
var isboundary = breakIterator.isBoundary(5);
```
diff --git a/en/application-dev/internationalization/intl-guidelines.md b/en/application-dev/internationalization/intl-guidelines.md
index 09bc3b733346db921cd04b76aff04b41d60af0b9..44748056f7886d4817cda2d9d0504f6966c32700 100644
--- a/en/application-dev/internationalization/intl-guidelines.md
+++ b/en/application-dev/internationalization/intl-guidelines.md
@@ -3,7 +3,8 @@
This module provides basic I18N capabilities, such as time and date formatting, number formatting, and string sorting, through the standard I18N interfaces defined in ECMA 402.
The [I18N](i18n-guidelines.md) module provides enhanced I18N capabilities through supplementary interfaces that are not defined in ECMA 402. It works with the Intl module to provide a complete suite of I18N capabilities.
-> **NOTE**
+> **NOTE**
+>
> In the code snippets in this document, **intl** refers to the name of the imported module.
## Setting Locale Information
@@ -24,7 +25,8 @@ Use [Locale](../reference/apis/js-apis-intl.md) APIs to maximize or minimize loc
### How to Develop
-1. Instantiate a **Locale** object.
+1. Instantiate a **Locale** object.
+
Create a **Locale** object by using the **Locale** constructor. This method receives a string representing the locale and an optional [Attributes](../reference/apis/js-apis-intl.md) list.
A **Locale** object consists of four parts: language, script, region, and extension, which are separated by using a hyphen (-).
@@ -42,30 +44,33 @@ Use [Locale](../reference/apis/js-apis-intl.md) APIs to maximize or minimize loc
| kf | Whether upper case or lower case is considered when sorting or comparing strings.|
- ```
+ ```js
var locale = "zh-CN";
var options = {caseFirst: false, calendar: "chinese", collation: pinyin};
var localeObj = new intl.Locale(locale, options);
```
-2. Obtain the string representing a **Locale** object.
+2. Obtain the string representing a **Locale** object.
+
Call the **toString** method to obtain the string representing a **Locale** object, which includes the language, region, and other options.
- ```
+ ```js
var localeStr = localeObj.toString();
```
-3. Maximize locale information.
+3. Maximize locale information.
+
Call the **maximize** method to maximize locale information; that is, supplement the missing script and region information.
- ```
+ ```js
var maximizedLocale = localeObj.maximize();
```
-4. Minimize locale information.
+4. Minimize locale information.
+
Call the **minimize** method to minimize locale information; that is, delete the unnecessary script and region information.
- ```
+ ```js
var minimizedLocale = localeObj.minimize();
```
@@ -88,42 +93,46 @@ Use [DateTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the date
### How to Develop
-1. Instantiate a **DateTimeFormat** object.
+1. Instantiate a **DateTimeFormat** object.
+
Use the default constructor of **DateTimeFormat** to obtain the system default locale by accessing the system language and region settings, and set it as the locale in the **DateTimeFormat** object.
- ```
+ ```js
var dateTimeFormat = new intl.DateTimeFormat();
```
Alternatively, use your own locale and formatting parameters to create a **DateTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [DateTimeOptions](../reference/apis/js-apis-intl.md).
- ```
+ ```js
var options = {dateStyle: "full", timeStyle: "full"};
var dateTimeFormat = new intl.DateTimeFormat("zh-CN", options);
```
-2. Format the date and time.
+2. Format the date and time.
+
Call the **format** method to format the date and time in the **DateTimeFormat** object. This method returns a string representing the formatting result.
- ```
+ ```js
Date date = new Date();
var formatResult = dateTimeFormat.format(date);
```
-3. Format a period.
+3. Format a period.
+
Call the **formatRange** method to format the period in the **DateTimeFormat** object. This method requires input of two **Date** objects, which respectively indicate the start date and end date of a period. This method returns a string representing the formatting result.
- ```
+ ```js
Date startDate = new Date();
Date endDate = new Date();
var formatResult = dateTimeFormat.formatRange(startDate, endDate);
```
-4. Obtain attributes of the **DateTimeFormat** object.
+4. Obtain attributes of the **DateTimeFormat** object.
+
Call the **resolvedOptions** method to obtain attributes of the **DateTimeFormat** object. This method will return an array that contains all attributes and values of the object.
- ```
+ ```js
var options = dateTimeFormat.resolvedOptions();
```
@@ -145,33 +154,36 @@ Use [NumberFormat](../reference/apis/js-apis-intl.md) APIs to format numbers for
### How to Develop
-1. Instantiate a **NumberFormat** object.
+1. Instantiate a **NumberFormat** object.
+
Use the default constructor of **NumberFormat** to obtain the system default locale by accessing the system language and region settings, and set it as the locale in the **NumberFormat** object.
- ```
+ ```js
var numberFormat = new intl.NumberFormat();
```
Alternatively, use your own locale and formatting parameters to create a **NumberFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [NumberOptions](../reference/apis/js-apis-intl.md).
- ```
+ ```js
var options = {compactDisplay: "short", notation: "compact"};
var numberFormat = new intl.NumberFormat("zh-CN", options);
```
-2. Format a number.
+2. Format a number.
+
Call the **format** method to format a number. A string is returned as the formatting result.
- ```
+ ```js
var number = 1234.5678
var formatResult = numberFormat.format(number);
```
-3. Obtain attributes of the **NumberFormat** object.
+3. Obtain attributes of the **NumberFormat** object.
+
Call the **resolvedOptions** method to obtain attributes of the **NumberFormat** object. This method will return an array that contains all attributes and values of the object.
- ```
+ ```js
var options = numberFormat.resolvedOptions();
```
@@ -193,33 +205,36 @@ Use [Collator](../reference/apis/js-apis-intl.md) APIs to sort strings based on
### How to Develop
-1. Instantiate a **Collator** object.
+1. Instantiate a **Collator** object.
+
Use the default constructor of **Collator** to obtain the system default locale by accessing the system language and region settings, and set it as the locale in the **Collator** object.
- ```
+ ```js
var collator = new intl.Collator();
```
Alternatively, use your own locale and formatting parameters to create a **Collator** object. For a full list of parameters, see [CollatorOptions](../reference/apis/js-apis-intl.md).
+ ```js
+ var collator= new intl.Collator("zh-CN", {localeMatcher: "best fit", usage: "sort"});
```
- var collator= new intl.Collator("zh-CN", {localeMatcher: "best fit", usage: "sort"};
- ```
-2. Compare two strings.
+2. Compare two strings.
+
Call the **compare** method to compare two input strings. This method returns a value as the comparison result. The return value **-1** indicates that the first string is shorter than the second string, the return value **1** indicates that the first string is longer than the second string, and the return value **0** indicates that the two strings are of equal lengths.
- ```
+ ```js
var str1 = "first string";
var str2 = "second string";
var compareResult = collator.compare(str1, str2);
```
-3. Obtain attributes of the **Collator** object.
+3. Obtain attributes of the **Collator** object.
+
Call the **resolvedOptions** method to obtain attributes of the **Collator** object. This method will return an array that contains all attributes and values of the object.
- ```
+ ```js
var options = collator.resolvedOptions();
```
@@ -240,24 +255,26 @@ Use [PluralRules](../reference/apis/js-apis-intl.md) APIs to determine the singu
### How to Develop
-1. Instantiate a **PluralRules** object.
+1. Instantiate a **PluralRules** object.
+
Use the default constructor of **PluralRules** to obtain the system default locale by accessing the system language and region settings, and set it as the locale in the **PluralRules** object.
- ```
+ ```js
var pluralRules = new intl.PluralRules();
```
Alternatively, use your own locale and formatting parameters to create a **PluralRules** object. For a full list of parameters, see [PluralRulesOptions](../reference/apis/js-apis-intl.md).
- ```
- var plurals = new intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"};
+ ```js
+ var plurals = new intl.PluralRules("zh-CN", {localeMatcher: "best fit", type: "cardinal"});
```
-2. Determine the singular-plural type.
+2. Determine the singular-plural type.
+
Call the **select** method to determine the singular-plural type of an input number. This method will return a string representing the singular-plural type, which can be any of the following: **zero**, **one**, **two**, **few**, **many**, and **other**.
- ```
+ ```js
var number = 1234.5678
var categoryResult = plurals.select(number);
```
@@ -281,41 +298,45 @@ Use [RelativeTimeFormat](../reference/apis/js-apis-intl.md) APIs to format the r
### How to Develop
-1. Instantiate a **RelativeTimeFormat** object.
+1. Instantiate a **RelativeTimeFormat** object.
+
Use the default constructor of **RelativeTimeFormat** to obtain the system default locale by accessing the system language and region settings, and set it as the locale in the **RelativeTimeFormat** object.
- ```
+ ```js
var relativeTimeFormat = new intl.RelativeTimeFormat();
```
Alternatively, use your own locale and formatting parameters to create a **RelativeTimeFormat** object. Formatting parameters are optional. For a full list of formatting parameters, see [ RelativeTimeFormatInputOptions](../reference/apis/js-apis-intl.md).
+ ```js
+ var relativeTimeFormat = new intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"});
```
- var relativeTimeFormat = new intl.RelativeTimeFormat("zh-CN", {numeric: "always", style: "long"};
- ```
-2. Format the relative time.
+2. Format the relative time.
+
Call the **format** method to format the relative time. This method receives a numeric value representing the time length and a string-form unit, like **year**, **quarter**, **month**, **week**, **day**, **hour**, **minute**, and **second**. This method returns a string representing the formatting result.
- ```
+ ```js
var number = 2;
var unit = "year"
var formatResult = relativeTimeFormat.format(number, unit);
```
-3. Obtain each part of the relative time format.
+3. Obtain each part of the relative time format.
+
Upon obtaining each part of the relative time format, customize the relative time formatting result.
- ```
+ ```js
var number = 2;
var unit = "year"
var formatResult = relativeTimeFormat.formatToParts(number, unit);
```
-4. Obtain attributes of the **RelativeTimeFormat** object.
+4. Obtain attributes of the **RelativeTimeFormat** object.
+
Call the **resolvedOptions** method to obtain attributes of the **RelativeTimeFormat** object. This method will return an array that contains all attributes and values of the object. For a full list of attributes, see [ RelativeTimeFormatResolvedOptions](../reference/apis/js-apis-intl.md).
- ```
+ ```js
var options = numberFormat.resolvedOptions();
```
diff --git a/en/application-dev/media/Readme-EN.md b/en/application-dev/media/Readme-EN.md
index b9f7b63d5b451da5213a8c282d52865d48c4e3eb..677e70f6e3b7eee215530cd15e7ab1b42676866c 100755
--- a/en/application-dev/media/Readme-EN.md
+++ b/en/application-dev/media/Readme-EN.md
@@ -1,7 +1,6 @@
# Media
- Audio
-
- [Audio Overview](audio-overview.md)
- [Audio Playback Development](audio-playback.md)
- [Audio Recording Development](audio-recorder.md)
@@ -15,9 +14,9 @@
- [Video Playback Development](video-playback.md)
- [Video Recording Development](video-recorder.md)
-- Image
+- Image
- [Image Development](image.md)
-- Camera
+- Camera
- [Camera Development](camera.md)
diff --git a/en/application-dev/media/audio-playback.md b/en/application-dev/media/audio-playback.md
index 2b0f260908c9e2986269601e588659ce6ce119fc..d65d0abfc4d4649f7f1847abdbe6fb0a832e194e 100644
--- a/en/application-dev/media/audio-playback.md
+++ b/en/application-dev/media/audio-playback.md
@@ -39,38 +39,38 @@ function printfDescription(obj) {
// Set the player callbacks.
function setCallBack(audioPlayer) {
- audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callback, which is triggered when the src attribute is set successfully.
+ audioPlayer.on('dataLoad', () => { // Set the `dataLoad` event callback, which is triggered when the src attribute is set successfully.
console.info('audio set source success');
- audioPlayer.play(); // The play() API can be invoked only after the 'dataLoad' event callback is complete. The 'play' event callback is then triggered.
+ audioPlayer.play(); // The play() API can be invoked only after the 'dataLoad' event callback is complete. The 'play' event callback is then triggered.
});
- audioPlayer.on('play', () => { // Set the 'play' event callback.
+ audioPlayer.on('play', () => { // Set the `play` event callback.
console.info('audio play success');
- audioPlayer.pause(); // Trigger the 'pause' event callback and pause the playback.
+ audioPlayer.pause(); // Trigger the 'pause' event callback and pause the playback.
});
- audioPlayer.on('pause', () => { // Set the 'pause' event callback.
+ audioPlayer.on('pause', () => { // Set the `pause` event callback.
console.info('audio pause success');
- audioPlayer.seek(5000); // Trigger the 'timeUpdate' event callback, and seek to 5000 ms for playback.
+ audioPlayer.seek(5000); // Trigger the 'timeUpdate' event callback, and seek to 5000 ms for playback.
});
- audioPlayer.on('stop', () => { // Set the 'stop' event callback.
+ audioPlayer.on('stop', () => { // Set the `stop` event callback.
console.info('audio stop success');
- audioPlayer.reset(); // Trigger the 'reset' event callback, and reconfigure the src attribute to switch to the next song.
+ audioPlayer.reset(); // Trigger the 'reset' event callback, and reconfigure the src attribute to switch to the next song.
});
- audioPlayer.on('reset', () => { // Set the 'reset' event callback.
+ audioPlayer.on('reset', () => { // Set the `reset` event callback.
console.info('audio reset success');
- audioPlayer.release(); // Release the AudioPlayer instance.
+ audioPlayer.release(); // Release the AudioPlayer instance.
audioPlayer = undefined;
});
- audioPlayer.on('timeUpdate', (seekDoneTime) => {// Set the 'timeUpdate' event callback.
+ audioPlayer.on('timeUpdate', (seekDoneTime) => { // Set the `timeUpdate` event callback.
if (typeof(seekDoneTime) == 'undefined') {
console.info('audio seek fail');
return;
}
console.info('audio seek success, and seek time is ' + seekDoneTime);
- audioPlayer.setVolume(0.5); // Trigger the 'volumeChange' event callback.
+ audioPlayer.setVolume(0.5); // Trigger the 'volumeChange' event callback.
});
- audioPlayer.on('volumeChange', () => { // Set the 'volumeChange' event callback.
+ audioPlayer.on('volumeChange', () => { // Set the `volumeChange` event callback.
console.info('audio volumeChange success');
- audioPlayer.getTrackDescription((error, arrlist) => { // Obtain the audio track information in callback mode.
+ audioPlayer.getTrackDescription((error, arrlist) => { // Obtain the audio track information in callback mode.
if (typeof (arrlist) != 'undefined') {
for (let i = 0; i < arrlist.length; i++) {
printfDescription(arrlist[i]);
@@ -78,13 +78,13 @@ function setCallBack(audioPlayer) {
} else {
console.log(`audio getTrackDescription fail, error:${error.message}`);
}
- audioPlayer.stop(); // Trigger the 'stop' event callback to stop the playback.
+ audioPlayer.stop(); // Trigger the 'stop' event callback to stop the playback.
});
});
- audioPlayer.on('finish', () => { // Set the 'finish' event callback, which is triggered when the playback is complete.
+ audioPlayer.on('finish', () => { // Set the 'finish' event callback, which is triggered when the playback is complete.
console.info('audio play finish');
});
- audioPlayer.on('error', (error) => { // Set the 'error' event callback.
+ audioPlayer.on('error', (error) => { // Set the 'error' event callback.
console.info(`audio error called, errName is ${error.name}`);
console.info(`audio error called, errCode is ${error.code}`);
console.info(`audio error called, errMessage is ${error.message}`);
@@ -94,7 +94,7 @@ function setCallBack(audioPlayer) {
async function audioPlayerDemo() {
// 1. Create an AudioPlayer instance.
let audioPlayer = media.createAudioPlayer();
- setCallBack(audioPlayer); // Set the event callbacks.
+ setCallBack(audioPlayer); // Set the event callbacks.
// 2. Set the URI of the audio file.
let fdPath = 'fd://'
// The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile" command.
@@ -107,7 +107,7 @@ async function audioPlayerDemo() {
}).catch((err) => {
console.info('open fd failed err is' + err);
});
- audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback.
+ audioPlayer.src = fdPath; // Set the src attribute and trigger the `dataLoad` event callback.
}
```
@@ -119,23 +119,23 @@ import fileIO from '@ohos.fileio'
export class AudioDemo {
// Set the player callbacks.
setCallBack(audioPlayer) {
- audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callback, which is triggered when the src attribute is set successfully.
+ audioPlayer.on('dataLoad', () => { // Set the `dataLoad` event callback, which is triggered when the src attribute is set successfully.
console.info('audio set source success');
- audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback.
+ audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback.
});
- audioPlayer.on('play', () => { // Set the 'play' event callback.
+ audioPlayer.on('play', () => { // Set the `play` event callback.
console.info('audio play success');
});
- audioPlayer.on('finish', () => { // Set the 'finish' event callback, which is triggered when the playback is complete.
+ audioPlayer.on('finish', () => { // Set the 'finish' event callback, which is triggered when the playback is complete.
console.info('audio play finish');
- audioPlayer.release(); // Release the AudioPlayer instance.
+ audioPlayer.release(); // Release the AudioPlayer instance.
audioPlayer = undefined;
});
}
async audioPlayerDemo() {
- let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance.
- this.setCallBack(audioPlayer); // Set the event callbacks.
+ let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance.
+ this.setCallBack(audioPlayer); // Set the event callbacks.
let fdPath = 'fd://'
// The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile" command.
let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile/01.mp3';
@@ -147,7 +147,7 @@ export class AudioDemo {
}).catch((err) => {
console.info('open fd failed err is' + err);
});
- audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback.
+ audioPlayer.src = fdPath; // Set the src attribute and trigger the `dataLoad` event callback.
}
}
```
@@ -161,20 +161,20 @@ export class AudioDemo {
// Set the player callbacks.
private isNextMusic = false;
setCallBack(audioPlayer) {
- audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callback, which is triggered when the src attribute is set successfully.
+ audioPlayer.on('dataLoad', () => { // Set the `dataLoad` event callback, which is triggered when the src attribute is set successfully.
console.info('audio set source success');
- audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback.
+ audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback.
});
- audioPlayer.on('play', () => { // Set the 'play' event callback.
+ audioPlayer.on('play', () => { // Set the `play` event callback.
console.info('audio play success');
- audioPlayer.reset(); // Call the reset() API and trigger the 'reset' event callback.
+ audioPlayer.reset(); // Call the reset() API and trigger the 'reset' event callback.
});
- audioPlayer.on('reset', () => { // Set the 'reset' event callback.
+ audioPlayer.on('reset', () => { // Set the `reset` event callback.
console.info('audio play success');
- if (!this.isNextMusic) { // When isNextMusic is false, changing songs is implemented.
- this.nextMusic(audioPlayer); // Changing songs is implemented.
+ if (!this.isNextMusic) { // When isNextMusic is false, changing songs is implemented.
+ this.nextMusic(audioPlayer); // Changing songs is implemented.
} else {
- audioPlayer.release(); // Release the AudioPlayer instance.
+ audioPlayer.release(); // Release the AudioPlayer instance.
audioPlayer = undefined;
}
});
@@ -197,8 +197,8 @@ export class AudioDemo {
}
async audioPlayerDemo() {
- let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance.
- this.setCallBack(audioPlayer); // Set the event callbacks.
+ let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance.
+ this.setCallBack(audioPlayer); // Set the event callbacks.
let fdPath = 'fd://'
// The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile" command.
let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile/01.mp3';
@@ -223,19 +223,19 @@ import fileIO from '@ohos.fileio'
export class AudioDemo {
// Set the player callbacks.
setCallBack(audioPlayer) {
- audioPlayer.on('dataLoad', () => { // Set the 'dataLoad' event callback, which is triggered when the src attribute is set successfully.
+ audioPlayer.on('dataLoad', () => { // Set the `dataLoad` event callback, which is triggered when the src attribute is set successfully.
console.info('audio set source success');
- audioPlayer.loop = true; // Set the loop playback attribute.
- audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback.
+ audioPlayer.loop = true; // Set the loop playback attribute.
+ audioPlayer.play(); // Call the play() API to start the playback and trigger the 'play' event callback.
});
- audioPlayer.on('play', () => { // Set the 'play' event callback to start loop playback.
+ audioPlayer.on('play', () => { // Set the 'play' event callback to start loop playback.
console.info('audio play success');
});
}
async audioPlayerDemo() {
- let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance.
- this.setCallBack(audioPlayer); // Set the event callbacks.
+ let audioPlayer = media.createAudioPlayer(); // Create an AudioPlayer instance.
+ this.setCallBack(audioPlayer); // Set the event callbacks.
let fdPath = 'fd://'
// The stream in the path can be pushed to the device by running the "hdc file send D:\xxx\01.mp3 /data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile" command.
let path = '/data/app/el1/bundle/public/ohos.acts.multimedia.audio.audioplayer/ohos.acts.multimedia.audio.audioplayer/assets/entry/resources/rawfile/01.mp3';
@@ -247,7 +247,7 @@ export class AudioDemo {
}).catch((err) => {
console.info('open fd failed err is' + err);
});
- audioPlayer.src = fdPath; // Set the src attribute and trigger the 'dataLoad' event callback.
+ audioPlayer.src = fdPath; // Set the src attribute and trigger the `dataLoad` event callback.
}
}
```
diff --git a/en/application-dev/napi/napi-guidelines.md b/en/application-dev/napi/napi-guidelines.md
index f2b6fe0e20564626d7a37d03832fae69f7f7866a..e58eed34cccb7dd820e1144a616dfb93a10f4d34 100644
--- a/en/application-dev/napi/napi-guidelines.md
+++ b/en/application-dev/napi/napi-guidelines.md
@@ -1,10 +1,10 @@
# Using Native APIs in Application Projects
-OpenHarmony applications use JavaScript (JS) when calling native APIs. The native APIs (NAPIs) provided by the **arkui_napi** repository are used to implement the interaction with JS. Currently, the **arkui_napi** repository supports some third-party **Node.js** interfaces. The names of the NAPIs are the same as those in the third-party **Node.js**. For details about the interfaces supported, see `libnapi.ndk.json` in this repository.
+OpenHarmony applications use JavaScript (JS) when calling native APIs. The native APIs (NAPIs) provided by the [ace_napi](https://gitee.com/openharmony/arkui_napi/tree/master) repository are used to implement interaction with JS. Currently, the **ace_napi** repository supports some third-party **Node.js** interfaces. The names of the NAPIs are the same as those in the third-party **Node.js**. For details about the interfaces supported, see `libnapi.ndk.json` in this repository.
## How to Develop
-The IDE has a default project that uses NAPIs. You can choose `File` > `New` > `Create Project` to create a `Native C++` project. The **cpp** directory is generated in the **main** directory. You can use the NAPIs provided by the **arkui_napi** repository for development.
+The IDE has a default project that uses NAPIs. You can choose `File` > `New` > `Create Project` to create a `Native C++` project. The **cpp** directory is generated in the **main** directory. You can use the NAPIs provided by the **ace_napi** repository for development.
You can `import` the native .so that contains the JS processing logic. For example, `import hello from 'libhello.so'` to use the **libhello.so** capability. Then, the JS object created using the NAPI can be passed to the `hello` object of the application to call the native capability.
@@ -74,7 +74,7 @@ export default storage;
### Implementation
-You can obtain the complete code from `sample/native_module_storage/` in the **arkui_napi** repository.
+You can obtain the complete code from `sample/native_module_storage/` in the [OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master) repository.
#### Registering the Module
@@ -212,7 +212,7 @@ static napi_value JSStorageGet(napi_env env, napi_callback_info info)
napi_create_async_work(
env, nullptr, resource,
- // Callback 1: This callback contains the service logic to be asynchronously executed and is asynchronously executed by the NAPI. Do not operate JS objects using theNAPI because the execution is asynchronous.
+ // Callback 1: This callback contains the service logic to be asynchronously executed and is asynchronously executed by the NAPI. Do not operate JS objects using the NAPI because the execution is asynchronous.
[](napi_env env, void* data) {
StorageAsyncContext* asyncContext = (StorageAsyncContext*)data;
auto itr = gKeyValueStorage.find(asyncContext->key);
@@ -307,7 +307,7 @@ export class NetServer {
### Implementation
-You can obtain the complete code from `sample/native_module_netserver/` in the **arkui_napi** repository.
+You can obtain the complete code from `sample/native_module_netserver/` in the [OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master) repository.
#### Registering the Module
@@ -494,7 +494,7 @@ This example describes how to invoke a JS callback in a non-JS thread. For examp
### Implementation
-You can obtain the complete code from `sample/native_module_callback/` in the **arkui_napi** repository.
+You can obtain the complete code from `sample/native_module_callback/` in the [OpenHarmony/arkui_napi](https://gitee.com/openharmony/arkui_napi/tree/master) repository.
#### Registering the Module
@@ -562,7 +562,7 @@ void callbackTest(CallbackContext* context)
uv_queue_work(
loop,
work,
- // This callback is executed in another common thread to process tasks asynchronously. After the callback is complete, execute the next callback. In this scenario, the callback does not need to execute any task.
+ // This callback is executed in another common thread to process tasks asynchronously. After the callback is complete, execute the next callback. In this scenario, this callback does not need to execute any task.
[](uv_work_t* work) {},
// This callback is executed in the JS thread bound to env.
[](uv_work_t* work, int status) {
diff --git a/en/application-dev/quick-start/Readme-EN.md b/en/application-dev/quick-start/Readme-EN.md
index f44905cb2c2d33a8efb52f80d01e199e674e2c5b..77038cc101186059e9377c85d8e5b880784c2b9e 100644
--- a/en/application-dev/quick-start/Readme-EN.md
+++ b/en/application-dev/quick-start/Readme-EN.md
@@ -9,6 +9,5 @@
- Development Fundamentals
- [Application Package Structure Configuration File (FA Model)](package-structure.md)
- [Application Package Structure Configuration File (Stage Model)](stage-structure.md)
- - [Resource File Categories](basic-resource-file-categories.md)
- [SysCap](syscap.md)
- [HarmonyAppProvision Configuration File](app-provision-structure.md)
diff --git a/en/application-dev/quick-start/basic-resource-file-categories.md b/en/application-dev/quick-start/basic-resource-file-categories.md
deleted file mode 100644
index e37a24074d5396103b9204f3c6ab20a745de2616..0000000000000000000000000000000000000000
--- a/en/application-dev/quick-start/basic-resource-file-categories.md
+++ /dev/null
@@ -1,79 +0,0 @@
-# Resource File Categories
-
-
-## resources Directory
-
-All the application resource files, such as strings, images, and audio files, are stored in the **resources** directory, allowing you to easily access, use, and maintain them. The **resources** directory consists of two types of sub-directories: the **base** sub-directory and qualifiers sub-directories, and the **rawfile** sub-directory. For details, see Categories of the **resources** directory.
-
-Example of the **resources** directory:
-
-```
-resources
-|---base // Default sub-directory
-| |---element
-| | |---string.json
-| |---media
-| | |---icon.png
-|---en_GB-vertical-car-mdpi // Example of a qualifiers sub-directory, which needs to be created on your own
-| |---element
-| | |---string.json
-| |---media
-| | |---icon.png
-|---rawfile // Default sub-directory
-```
-
-**Table 1** Categories of the **resources** directory
-
-| Category | base and Qualifiers Sub-directories | rawfile Sub-directory |
-| ----------- | ---------------------------------------- | ---------------------------------------- |
-| Structure | Sub-directories are structured in two levels. The directory name must comply with specified naming conventions so that its target resource file in the correct directory can be matched based on the device status.
The **base** sub-directory and qualifiers sub-directories are the first level of sub-directories under **resources**.
- The **base** sub-directory is generated by default. If no qualifiers sub-directories in the **resources** directory of the application match the device status, the resource file in the **base** sub-directory will be automatically referenced.
- You need to create qualifiers sub-directories on your own. Each directory name consists of one or more qualifiers that represent the application scenarios or device characteristics. For details, see [Qualifiers Sub-directories](#qualifiers-sub-directories).
Resource group sub-directories are located at the second level of sub-directories to store basic elements such as strings, colors, and boolean values, as well as resource files such as media, animations, and layouts. For details, see [Resource Group Sub-directories](#resource-group-sub-directories). | You can create multiple levels of sub-directories with custom directory names. They can be used to store various resource files.
However, resource files in the **rawfile** sub-directory will not be matched based on the device status. |
-| Compilation | Resource files in the sub-directories are compiled into binary files, and each resource file is assigned an ID. | Resource files in the sub-directory are directly packed into the application without being compiled, and no IDs will be assigned to the resource files. |
-| Reference | Resource files in the sub-directories are referenced based on the resource type and resource name. | Resource files in the sub-directories are referenced based on the specified file path and file name. |
-
-
-## Qualifiers Sub-directories
-
-The name of a qualifiers sub-directory consists of one or more qualifiers that represent the application scenarios or device characteristics, covering the mobile country code (MCC), mobile network code (MNC), language, script, country or region, screen orientation, device type, color mode, and screen density. The qualifiers are separated using underscores (_) or hyphens (-). When creating a qualifiers sub-directory, you need to understand the directory naming conventions and the rules for matching qualifiers sub-directories and the device status.
-
-**Naming Conventions for Qualifiers Sub-directories**
-
-- Qualifiers are ordered in the following sequence: _MCC_MNC-language_script_country/region-screen orientation-device type-color mode-screen density_. You can select one or multiple qualifiers to name your sub-directory based on your application scenarios and device characteristics.
-
-- Separation between qualifiers: The language, script, and country/region qualifiers are separated using underscores (\_); the MNC and MCC qualifiers are also separated using underscores (\_); other qualifiers are separated using hyphens (-). For example, **zh_Hant_CN** and **zh_CN-car-ldpi**.
-
-- Value range of qualifiers: The value of each qualifier must meet the requirements. Otherwise, the resource files in the sub-directory cannot be matched.
-
- **Table 2** Requirements for qualifier values
-
- | Qualifier Type | Description and Value Range |
- | ------------------ | ---------------------------------------- |
- | MCC&MNC | Indicates the MCC and MNC, which are obtained from the network where the device is registered. The MCC can be either followed by the MNC with an underscore (_) in between or be used independently. For example, **mcc460** represents China, and **mcc460_mnc00** represents China Mobile.
For details about the value range, refer to **ITU-T E.212** (the international identification plan for public networks and subscriptions). |
- | Language | Indicates the language used by the device. The value consists of two or three lowercase letters, for example, **zh** indicates Chinese, **en** indicates English, and **mai** indicates Maithili.
For details about the value range, refer to **ISO 639** (codes for the representation of names of languages). |
- | Script | Indicates the script type used by the device. The value starts with one uppercase letter followed by three lowercase letters, for example, **Hans** indicates simplified Chinese and **Hant** indicates traditional Chinese.
For details about the value range, refer to **ISO 15924** (codes for the representation of names of scripts). |
- | Country/Region | Indicates the country or region where a user is located. The value consists of two or three uppercase letters or three digits, for example, **CN** indicates China and **GB** indicates the United Kingdom.
For details about the value range, refer to **ISO 3166-1** (codes for the representation of names of countries and their subdivisions). |
- | Screen orientation | Indicates the screen orientation of the device. The value can be:
- **vertical**: portrait orientation
- **horizontal**: landscape orientation |
- | Device type | Indicates the device type. The value can be:
- **car**: head units
- **tv**: smart TVs
- **wearable**: wearables |
- | Color mode | Indicates the color mode of the device. The value can be:
- **dark**: dark mode
- **light**: light mode |
- | Screen density | Indicates the screen density of the device, in dpi. The value can be:
- **sdpi**: screen density with small-scale dots per inch (SDPI). This value is applicable for devices with a DPI range of (0, 120].
- **mdpi**: screen density with medium-scale dots per inch (MDPI). This value is applicable for devices with a DPI range of (120, 160].
- **ldpi**: screen density with large-scale dots per inch (LDPI). This value is applicable for devices with a DPI range of (160, 240].
- **xldpi**: screen density with extra-large-scale dots per inch (XLDPI). This value is applicable for devices with a DPI range of (240, 320].
- **xxldpi**: screen density with extra-extra-large-scale dots per inch (XXLDPI). This value is applicable for devices with a DPI range of (320, 480].
- **xxxldpi**: screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI). This value is applicable for devices with a DPI range of (480, 640]. |
-
-**Rules for Matching Qualifiers Sub-directories and Device Resources**
-
-- Qualifiers are matched with the device resources in the following priorities: MCC&MNC > locale (options: language, language_script, language_country/region, and language_script_country/region) > screen orientation > device type > color mode > screen density
-
-- If the qualifiers sub-directories contain the **MCC, MNC, language, script, screen orientation, device type, and color mode** qualifiers, their values must be consistent with the current device status so that the sub-directories can be used for matching the device resources. For example, the qualifiers sub-directory **zh_CN-car-ldpi** cannot be used for matching the resource files labeled **en_US**.
-
-
-## Resource Group Sub-directories
-
-You can create resource group sub-directories (including element, media, animation, layout, graphic, and profile) in the **base** and qualifiers sub-directories to store resource files of specific types. For details, see Resource group sub-directories.
-
-**Table 3** Resource group sub-directories
-
-| Resource Group Sub-directory | Description | Resource File |
-| ---------------------------- | ---------------------------------------- | ---------------------------------------- |
-| element | Indicates element resources. Each type of data is represented by a JSON file. The options are as follows:
- **boolean**: boolean data
- **color**: color data
- **float**: floating-point data
- **intarray**: array of integer
- **integer**: integer data
- **pattern**: pattern data
- **plural**: plural form data
- **strarray**: array of strings
- **string**: string data | It is recommended that files in the **element** sub-directory be named the same as the following files, each of which can contain only data of the same type:
- boolean.json
- color.json
- float.json
- intarray.json
- integer.json
- pattern.json
- plural.json
- strarray.json
- string.json |
-| media | Indicates media resources, including non-text files such as images, audios, and videos. | The file name can be customized, for example, **icon.png**. |
-| animation | Indicates animation resources, in XML format. | The file name can be customized, for example, **zoom_in.xml**. |
-| layout | Indicates layout resources, in XML format. | The file name can be customized, for example, **home_layout.xml**. |
-| graphic | Indicates graphic resources, in XML format. | The file name can be customized, for example, **notifications_dark.xml**. |
-| profile | Indicates other types of files, which are stored in their raw formats. | The file name can be customized. |
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655128646.png b/en/application-dev/quick-start/figures/en-us_image_0000001655128646.png
new file mode 100644
index 0000000000000000000000000000000000000000..048b8e07817272b759781df104c1dd4526685d61
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655128646.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655128939.png b/en/application-dev/quick-start/figures/en-us_image_0000001655128939.png
new file mode 100644
index 0000000000000000000000000000000000000000..606ce3a0eab0a39f166029182bcc2f70291740d6
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655128939.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655128998.png b/en/application-dev/quick-start/figures/en-us_image_0000001655128998.png
new file mode 100644
index 0000000000000000000000000000000000000000..d044d5d829ab1ad805f4ffcda19837f867b976fc
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655128998.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129041.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129041.png
new file mode 100644
index 0000000000000000000000000000000000000000..2dd664a2b25751cc32bd81927b30036d5cc4f351
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129041.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129232.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129232.png
new file mode 100644
index 0000000000000000000000000000000000000000..7d3222667d7bffe89a148dc3b08861a86c43713e
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129232.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129264.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129264.png
new file mode 100644
index 0000000000000000000000000000000000000000..c188c864c051f68984ecc0c4c64be83f0dd6e1e9
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129264.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129333.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129333.png
new file mode 100644
index 0000000000000000000000000000000000000000..b42f2e3896d334d86e89b867cf3428782f88d600
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129333.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129372.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129372.png
new file mode 100644
index 0000000000000000000000000000000000000000..8541c80810d3f3dfb7180fede34a51221dc56106
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129372.png differ
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001655129398.png b/en/application-dev/quick-start/figures/en-us_image_0000001655129398.png
new file mode 100644
index 0000000000000000000000000000000000000000..2dda1a5cfca8d75d70e40b8bc0d555faade04583
Binary files /dev/null and b/en/application-dev/quick-start/figures/en-us_image_0000001655129398.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
new file mode 100644
index 0000000000000000000000000000000000000000..4c20e429bdef97ab0503614d01f1807e56eedb13
--- /dev/null
+++ b/en/application-dev/quick-start/full-sdk-switch-guide.md
@@ -0,0 +1,98 @@
+# Guide to Switching to Full SDK
+
+Both the public SDK and full SDK are toolkits for application development.
+
+The public SDK is intended for application developers and provided as standard in DevEco Studio. It does not contain system APIs – APIs required by system applications.
+
+The full SDK is intended for original equipment manufacturers (OEMs) and provided separately. It contains system APIs.
+
+The SDK of API version 8 provided in DevEco Studio is a public SDK. If your project depends on any system API, such as the **animator** component, **xcomponent** component, or APIs in **@ohos.application.abilityManager.d.ts**, **@ohos.application.formInfo.d.ts**, or **@ohos.bluetooth.d.ts**, switch to the full SDK by performing the following steps.
+
+## Downloading the Full SDK (of 3.1.1 Release in this example)
+
+Manually download the full SDK. For details, see the source code acquisition section in [OpenHarmony 3.1.1 Release](https://gitee.com/openharmony/docs/blob/master/en/release-notes/OpenHarmony-v3.1.1-release.md).
+
+
+
+
+
+
+## Checking the Local SDK Location
In this example, an eTS 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.
+
+
+
+
+
+
+## Replacing the SDK
+
+1. Make sure the downloaded SDK is a full SDK.
+
+ a. Verify that the name of the downloaded file contains **sdk-full**.
+
+ 
+
+ b. Verify that the SDK contains system APIs (such as APIs defined in **@ohos.application.abilityManager.d.ts**, **@ohos.application.formInfo.d.ts**, and **@ohos.bluetooth.d.ts**).
+
+ Note: The criteria for identifying system APIs are subject to the released API documentation.
+
+
+
+2. Replace the SDK. The following uses full SDK 3.1.6.6 for Windows as an example.
+
+
+
+ a. Decompress the downloaded full SDK file: `ets-windows-3.1.6.5-Release.zip`
+
+ 
+
+ b. Replace the SDK files.
+
+ Back up the local SDK files. (Copy and rename the version number directory in the **ets** directory, or copy the entire **ets** directory to another local path.)
+
+ Go to the obtained location of the local installed SDK and back up the files therein.
+
+ 
+
+ Note: The name of the backup version number directory must be different from the value of **version** field in the **oh-uni-package.json** file. In the example below, the name of the backup version number directory is **3.1.6.6_backup**.
+
+ 
+
+ The configuration in the **oh-uni-package.json** file is as follows:
+
+ ```
+ {
+ "apiVersion": "8",
+ "displayName": "Ets",
+ "meta": {
+ "metaVersion": "3.0.0"
+ },
+ "path": "ets",
+ "releaseType": "Release",
+ "version": "3.1.6.6"
+ }
+ ```
+
+ **Delete all files in the original SDK (3.1.6.6) directory.** Failure to do so may result in some files being unable to be overwritten.
+
+
+
+ Copy the full SDK to the location of the local SDK.
+
+ Copy all files in the **ets** directory in the full SDK to the **ets\3.1.6.6** directory in the location of the local SDK.
+
+ Change the value of **version** in the **oh-uni-package.json** file to the current SDK version number.
+
+
+
+ In the **3.1.6.6\build-tools\ets-loader** directory, open the **cmd/powerShell** window and run the **npm install** command to download the **node_modules** dependency package.
+
+ 
+
+
+
+ c. Check for system APIs.
+
+ 
diff --git a/en/application-dev/reference/Readme-EN.md b/en/application-dev/reference/Readme-EN.md
index 30bb3aacd85d9e11012fb66dc276a88476139126..f2ee2ee4ab190bcd3487aaca974a153c0aed914e 100644
--- a/en/application-dev/reference/Readme-EN.md
+++ b/en/application-dev/reference/Readme-EN.md
@@ -1,9 +1,9 @@
# Development References
-- [JavaScript-based Web-like Development Paradigm](arkui-js/Readme-EN.md)
-- [TypeScript-based Declarative Development Paradigm](arkui-ts/Readme-EN.md)
+- [Component Reference(TypeScript-based Declarative Development Paradigm)](arkui-ts/Readme-EN.md)
+- [Component Reference(JavaScript-based Web-like Development Paradigm)](arkui-js/Readme-EN.md)
- [APIs](apis/Readme-EN.md)
-
+
- [JS (eTS Included) APIs](apis/Readme-EN.md)
- Native APIs
- [Standard Library](native-lib/third_party_libc/musl.md)
diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index 4646544abd6e22a632a35faeba6184819d601097..6b5bbc8aa3d671c4cf0b01316db441d33c0f189f 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -1,53 +1,61 @@
# APIs
+- [API Reference Document Description](development-intro.md)
+
- Ability Framework
- - [@ohos.ability.dataUriUtils](js-apis-DataUriUtils.md)
- - [@ohos.ability.errorCode](js-apis-ability-errorCode.md)
- - [@ohos.ability.wantConstant](js-apis-ability-wantConstant.md)
- - [@ohos.application.Ability](js-apis-application-ability.md)
- - [@ohos.application.AbilityConstant](js-apis-application-abilityConstant.md)
- - [@ohos.application.abilityDelegatorRegistry](js-apis-abilityDelegatorRegistry.md)
- - [@ohos.application.AbilityStage ](js-apis-application-abilitystage.md)
- - [@ohos.application.abilityLifecycleCallback](js-apis-application-abilityLifecycleCallback.md)
- - [@ohos.application.appManager](js-apis-appmanager.md)
- - [@ohos.application.Configuration](js-apis-configuration.md)
- - [@ohos.application.ConfigurationConstant](js-apis-configurationconstant.md)
- - [@ohos.ability.featureAbility](js-apis-featureAbility.md)
- - [@ohos.application.formBindingData](js-apis-formbindingdata.md)
- - [@ohos.application.FormExtension](js-apis-formextension.md)
- - [@ohos.application.formError](js-apis-formerror.md)
- - [@ohos.application.formHost](js-apis-formhost.md)
- - [@ohos.application.formInfo](js-apis-formInfo.md)
- - [@ohos.application.missionManager](js-apis-missionManager.md)
- - [@ohos.application.formProvider](js-apis-formprovider.md)
- - [@ohos.ability.particleAbility](js-apis-particleAbility.md)
- - [@ohos.application.ServiceExtensionAbility](js-apis-service-extension-ability.md)
- - [@ohos.application.StartOptions](js-apis-application-StartOptions.md)
- - [@ohos.application.StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md)
- - [@ohos.application.uriPermissionManager](js-apis-uripermissionmanager.md)
- - [@ohos.application.Want](js-apis-application-Want.md)
- - [@ohos.wantAgent](js-apis-wantAgent.md)
- - ability/[dataAbilityHelper](js-apis-dataAbilityHelper.md)
- - app/[context](js-apis-Context.md)
- - application/[AbilityContext](js-apis-ability-context.md)
- - application/[ApplicationContext](js-apis-application-applicationContext.md)
- - application/[abilityDelegator](js-apis-application-abilityDelegator.md)
- - application/[abilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md)
- - application/[abilityMonitor](js-apis-application-abilityMonitor.md)
- - application/[AbilityRunningInfo](js-apis-abilityrunninginfo.md)
- - application/[AbilityStageContext](js-apis-abilitystagecontext.md)
- - application/[Context](js-apis-application-context.md)
- - application/[ExtensionContext](js-apis-extension-context.md)
- - application/[ExtensionRunningInfo](js-apis-extensionrunninginfo.md)
- - application/[FormExtensionContext](js-apis-formextensioncontext.md)
- - application/[MissionSnapshot](js-apis-application-MissionSnapshot.md)
- - application/[PermissionRequestResult](js-apis-permissionrequestresult.md)
- - application/[ProcessRunningInfo](js-apis-processrunninginfo.md)
- - application/[ServiceExtensionContext](js-apis-service-extension-context.md)
- - application/[shellCmdResult](js-apis-application-shellCmdResult.md)
- - application/[MissionInfo](js-apis-application-missionInfo.md)
-
+ - FA Model
+ - [@ohos.ability.featureAbility](js-apis-featureAbility.md)
+ - [@ohos.ability.particleAbility](js-apis-particleAbility.md)
+ - ability/[dataAbilityHelper](js-apis-dataAbilityHelper.md)
+ - app/[context](js-apis-Context.md)
+ - Stage Model
+ - [@ohos.application.Ability](js-apis-application-ability.md)
+ - [@ohos.application.AbilityConstant](js-apis-application-abilityConstant.md)
+ - [@ohos.application.AbilityStage](js-apis-application-abilitystage.md)
+ - [@ohos.application.abilityLifecycleCallback](js-apis-application-abilityLifecycleCallback.md)
+ - [@ohos.application.DataShareExtensionAbility](js-apis-application-DataShareExtensionAbility.md)
+ - [@ohos.application.FormExtension](js-apis-formextension.md)
+ - [@ohos.application.ServiceExtensionAbility](js-apis-service-extension-ability.md)
+ - [@ohos.application.StartOptions](js-apis-application-StartOptions.md)
+ - [@ohos.application.StaticSubscriberExtensionAbility](js-apis-application-staticSubscriberExtensionAbility.md)
+ - application/[AbilityContext](js-apis-ability-context.md)
+ - application/[ApplicationContext](js-apis-application-applicationContext.md)
+ - application/[AbilityStageContext](js-apis-abilitystagecontext.md)
+ - application/[Context](js-apis-application-context.md)
+ - application/[ExtensionContext](js-apis-extension-context.md)
+ - application/[FormExtensionContext](js-apis-formextensioncontext.md)
+ - application/[PermissionRequestResult](js-apis-permissionrequestresult.md)
+ - application/[ServiceExtensionContext](js-apis-service-extension-context.md)
+ - FA and Stage Models
+ - [@ohos.ability.dataUriUtils](js-apis-DataUriUtils.md)
+ - [@ohos.ability.errorCode](js-apis-ability-errorCode.md)
+ - [@ohos.ability.wantConstant](js-apis-ability-wantConstant.md)
+ - [@ohos.application.abilityDelegatorRegistry](js-apis-abilityDelegatorRegistry.md)
+ - [@ohos.application.abilityManager](js-apis-application-abilityManager.md)
+ - [@ohos.application.appManager](js-apis-appmanager.md)
+ - [@ohos.application.Configuration](js-apis-configuration.md)
+ - [@ohos.application.ConfigurationConstant](js-apis-configurationconstant.md)
+ - [@ohos.application.EnvironmentCallback](js-apis-application-EnvironmentCallback.md)
+ - [@ohos.application.formBindingData](js-apis-formbindingdata.md)
+ - [@ohos.application.formError](js-apis-formerror.md)
+ - [@ohos.application.formHost](js-apis-formhost.md)
+ - [@ohos.application.formInfo](js-apis-formInfo.md)
+ - [@ohos.application.formProvider](js-apis-formprovider.md)
+ - [@ohos.application.missionManager](js-apis-missionManager.md)
+ - [@ohos.application.Want](js-apis-application-Want.md)
+ - [@ohos.continuation.continuationManager](js-apis-continuation-continuationExtraParams.md)
+ - [@ohos.continuation.continuationManager](js-apis-continuation-continuationManager.md)
+ - [@ohos.wantAgent](js-apis-wantAgent.md)
+ - application/[abilityDelegator](js-apis-application-abilityDelegator.md)
+ - application/[abilityDelegatorArgs](js-apis-application-abilityDelegatorArgs.md)
+ - application/[abilityMonitor](js-apis-application-abilityMonitor.md)
+ - application/[AbilityRunningInfo](js-apis-abilityrunninginfo.md)
+ - application/[ExtensionRunningInfo](js-apis-extensionrunninginfo.md)
+ - application/[MissionSnapshot](js-apis-application-MissionSnapshot.md)
+ - application/[ProcessRunningInfo](js-apis-processrunninginfo.md)
+ - application/[shellCmdResult](js-apis-application-shellCmdResult.md)
+ - continuation/[ContinuationResult](js-apis-continuation-continuationResult.md)
- Common Event and Notification
- [@ohos.commonEvent](js-apis-commonEvent.md)
@@ -55,7 +63,7 @@
- [@ohos.notification](js-apis-notification.md)
- [@ohos.reminderAgent](js-apis-reminderAgent.md)
- application/[EventHub](js-apis-eventhub.md)
-
+
- Bundle Management
- [@ohos.bundle](js-apis-Bundle.md)
@@ -66,26 +74,30 @@
- bundle/[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)
- bundle/[BundleInfo](js-apis-bundle-BundleInfo.md)
- bundle/[CustomizeData](js-apis-bundle-CustomizeData.md)
+ - bundle/[ElementName](js-apis-bundle-ElementName.md)
- bundle/[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)
- bundle/[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)
- bundle/[Metadata](js-apis-bundle-Metadata.md)
- bundle/[ModuleInfo](js-apis-bundle-ModuleInfo.md)
-
+
- UI Page
- [@ohos.animator](js-apis-animator.md)
- [@ohos.mediaquery](js-apis-mediaquery.md)
- [@ohos.prompt](js-apis-prompt.md)
- [@ohos.router](js-apis-router.md)
-
+ - [@ohos.uiAppearance](js-apis-uiappearance.md)
+
- Graphics
- [@ohos.display ](js-apis-display.md)
+ - [@ohos.effectKit](js-apis-effectKit.md)
+ - [@ohos.screen](js-apis-screen.md)
- [@ohos.screenshot](js-apis-screenshot.md)
- [@ohos.window](js-apis-window.md)
- [webgl](js-apis-webgl.md)
- [webgl2](js-apis-webgl2.md)
-
+
- Media
- [@ohos.multimedia.audio](js-apis-audio.md)
@@ -93,41 +105,46 @@
- [@ohos.multimedia.image](js-apis-image.md)
- [@ohos.multimedia.media](js-apis-media.md)
- [@ohos.multimedia.medialibrary](js-apis-medialibrary.md)
-
+
- Resource Management
+
- [@ohos.i18n](js-apis-i18n.md)
- [@ohos.intl](js-apis-intl.md)
- [@ohos.resourceManager](js-apis-resource-manager.md)
-
+
- Resource Scheduling
- [@ohos.backgroundTaskManager](js-apis-backgroundTaskManager.md)
- [@ohos.workScheduler ](js-apis-workScheduler.md)
- [@ohos.WorkSchedulerExtensionAbility](js-apis-WorkSchedulerExtensionAbility.md)
-
+
- Custom Management
- [@ohos.configPolicy](js-apis-config-policy.md)
- [@ohos.enterpriseDeviceManager](js-apis-enterprise-device-manager.md)
- [@ohos.EnterpriseAdminExtensionAbility](js-apis-EnterpriseAdminExtensionAbility.md)
-
+
- Security
- [@ohos.abilityAccessCtrl](js-apis-abilityAccessCtrl.md)
+ - [@ohos.privacyManager](js-apis-privacyManager.md)
- [@ohos.security.huks ](js-apis-huks.md)
- [@ohos.userIAM.userAuth ](js-apis-useriam-userauth.md)
- [@system.cipher](js-apis-system-cipher.md)
-
+
- Data Management
- [@ohos.data.dataAbility ](js-apis-data-ability.md)
+ - [@ohos.data.dataShare](js-apis-data-dataShare.md)
+ - [@ohos.data.dataSharePredicates](js-apis-data-dataSharePredicates.md)
+ - [@ohos.data.dataShareResultSet](js-apis-data-DataShareResultSet.md)
- [@ohos.data.distributedData](js-apis-distributed-data.md)
- [@ohos.data.distributedDataObject](js-apis-data-distributedobject.md)
- [@ohos.data.preferences](js-apis-data-preferences.md)
- [@ohos.data.rdb](js-apis-data-rdb.md)
- - [@ohos.settings](js-apis-settings.md)
+ - [@ohos.data.ValuesBucket](js-apis-data-ValuesBucket.md)
- data/rdb/[resultSet](js-apis-data-resultset.md)
-
+
- File Management
- [@ohos.document](js-apis-document.md)
@@ -138,7 +155,7 @@
- [@ohos.storageStatistics](js-apis-storage-statistics.md)
- [@ohos.volumeManager](js-apis-volumemanager.md)
- [@ohos.securityLabel](js-apis-securityLabel.md)
-
+
- Telephony Service
- [@ohos.contact](js-apis-contact.md)
@@ -148,14 +165,15 @@
- [@ohos.telephony.sim](js-apis-sim.md)
- [@ohos.telephony.sms](js-apis-sms.md)
- [@ohos.telephony.data](js-apis-telephony-data.md)
-
+
- Network Management
+
- [@ohos.net.connection](js-apis-net-connection.md)
- [@ohos.net.http](js-apis-http.md)
- [@ohos.request](js-apis-request.md)
- [@ohos.net.socket](js-apis-socket.md)
- [@ohos.net.webSocket](js-apis-webSocket.md)
-
+
- Connectivity
- [@ohos.bluetooth](js-apis-bluetooth.md)
@@ -166,7 +184,7 @@
- [@ohos.rpc](js-apis-rpc.md)
- [@ohos.wifi](js-apis-wifi.md)
- [@ohos.wifiext](js-apis-wifiext.md)
-
+
- Basic Features
- [@ohos.accessibility](js-apis-accessibility.md)
@@ -185,7 +203,7 @@
- [@ohos.systemTime](js-apis-system-time.md)
- [@ohos.wallpaper](js-apis-wallpaper.md)
- [Timer](js-apis-timer.md)
-
+
- Device Management
- [@ohos.batteryInfo ](js-apis-battery-info.md)
@@ -205,18 +223,19 @@
- [@ohos.power](js-apis-power.md)
- [@ohos.runningLock](js-apis-runninglock.md)
- [@ohos.sensor](js-apis-sensor.md)
+ - [@ohos.settings](js-apis-settings.md)
- [@ohos.systemParameter](js-apis-system-parameter.md)
- [@ohos.thermal](js-apis-thermal.md)
- [@ohos.update](js-apis-update.md)
- [@ohos.usb](js-apis-usb.md)
- [@ohos.vibrator](js-apis-vibrator.md)
-
+
- Account Management
- [@ohos.account.appAccount](js-apis-appAccount.md)
- [@ohos.account.distributedAccount](js-apis-distributed-account.md)
- [@ohos.account.osAccount](js-apis-osAccount.md)
-
+
- Language Base Class Library
- [@ohos.convertxml](js-apis-convertxml.md)
@@ -240,11 +259,12 @@
- [@ohos.util.Vector](js-apis-vector.md)
- [@ohos.worker](js-apis-worker.md)
- [@ohos.xml](js-apis-xml.md)
-
+
- Test
+
- [@ohos.application.testRunner](js-apis-testRunner.md)
- [@ohos.uitest](js-apis-uitest.md)
-
+
- APIs No Longer Maintained
- [@ohos.bytrace](js-apis-bytrace.md)
diff --git a/en/application-dev/reference/apis/development-intro.md b/en/application-dev/reference/apis/development-intro.md
new file mode 100644
index 0000000000000000000000000000000000000000..8528a10ab6f4ba3dd14186079357ce28e650ee6a
--- /dev/null
+++ b/en/application-dev/reference/apis/development-intro.md
@@ -0,0 +1,51 @@
+# API Reference Document Description
+
+API references provide the description of APIs used for application development. This topic describes common fields in the API references to help you better use the reference document.
+
+## Version Description
+
+In API references, the earliest versions of APIs and components are specified in the following ways:
+
+- For a new API or component, the version information is provided at the beginning of the reference document. Example: "The initial APIs of this module are supported since API version 7."
+- For a new feature of an existing API or component, a superscript is added following the feature. For example, "uid8+" indicates that the **uid** attribute is supported since API version 8.
+
+## Ability Framework Model Description
+
+Ability is the minimum unit for the system to schedule applications. An application can contain one or more `Ability` instances. Ability framework models are classified into the FA model and stage model. For details, see [Ability Framework Overview](../../ability/ability-brief.md).
+
+- If all the APIs of a module support only one model, the following description is provided at the beginning of the reference document: "The APIs of this module can be used only in the FA model." or "The APIs of this module can be used only in the stage model."
+- If certain APIs of a module support only one model, the following description is provided individually for these APIs: "This API can be used only in the FA model." or "This API can be used only in the stage model."
+- If both models are supported, no special description is provided.
+
+## Available APIs
+
+Certain APIs provided by OpenHarmony are system APIs, which can be used only by original equipment manufacturers (OEMs) and cannot be used by non-system applications.
+
+A description regarding system APIs will be provided in the document.
+
+- If all the APIs of a module are system APIs, the following description is provided at the beginning of the reference document: "All the APIs of this module are system APIs."
+- If a specific API of a module is a system API, the following description is provided individually for the API: "This is a system API."
+
+## Permission Description
+
+By default, applications can access limited system resources. However, in some cases, an application needs to access excess data (including personal data) and functions of the system or another application to implement extended functions. For details, see [Access Control Overview](../../security/accesstoken-overview.md).
+
+To call APIs to access these resources, you must apply for the corresponding permissions by following the instructions provided in [Access Control Development](../../security/accesstoken-guidelines.md).
+
+- If an application can call an API only after it has obtained a specific permission, the following description is provided for the API: "**Required permissions**: ohos.permission.xxxx"
+- If an application can call an API without any permission, no special description is provided.
+
+To determine whether an application can apply for a specific permission, see [Permission List](../../security/permission-list.md).
+
+## System Capability Description
+
+System capability refers to a relatively independent feature in the operating system. Different devices provide different system capabilities, and multiple APIs implement a system capability. You can determine whether an API can be used based on system capabilities. For details, see [SysCap](../../quick-start/syscap.md).
+
+The following description is provided for each API in the reference document to describe the system capability of the API: "**System capability**: SystemCapability.xxx.xxx"
+
+## Sample Code Language Description
+
+OpenHarmony supports two development languages: JS and TS.
+
+- When a code block is labeled with `js`, the sample code can be used in the JS and eTS projects.
+- When a code block is labeled with `ts`, the sample code can be used only in the eTS project.
diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md
index 20e8f1573b48402b5561e69c1a67ac0c6a1dd9ea..409cb84c143a04dc46ec010fe9323f009b66c7ab 100644
--- a/en/application-dev/reference/apis/js-apis-Bundle.md
+++ b/en/application-dev/reference/apis/js-apis-Bundle.md
@@ -1,14 +1,14 @@
# Bundle
-The **Bundle** module provides APIs for querying bundle information, application information, abilities, Extension abilities, and application states.
+The **Bundle** module provides APIs for querying the information about bundles, applications, abilities, Extension abilities, and application states.
> **NOTE**
->
+>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> API version 9 is a canary version for trial use. The APIs of this version may be unstable.
## Modules to Import
-```
+```js
import bundle from '@ohos.bundle';
```
@@ -23,8 +23,9 @@ SystemCapability.BundleManager.BundleFramework
| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about a specified application. |
| ohos.permission.GET_BUNDLE_INFO_PRIVILEGED| system_basic | Permission to query information about all applications.|
| ohos.permission.INSTALL_BUNDLE | system_core | Permission to install or uninstall applications. |
+| ohos.permission.MANAGE_DISPOSED_APP_STATUS | system_core | Permission to set and query the application disposal status. |
-For details, see “Permission Levels” in [Access Control Overview](../../security/accesstoken-overview.md).
+For details, see "Permission Levels" in [Access Control Overview](../../security/accesstoken-overview.md).
## bundle.getApplicationInfo
@@ -44,7 +45,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | --------------------------------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | No | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
@@ -68,8 +69,6 @@ bundle.getApplicationInfo(bundleName, bundleFlags, userId)
})
```
-
-
## bundle.getApplicationInfo
getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, callback: AsyncCallback\): void
@@ -88,7 +87,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| userId | number | Yes | User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0. |
| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information. |
@@ -108,7 +107,6 @@ bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => {
})
```
-
## bundle.getApplicationInfo
getApplicationInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\): void
@@ -127,7 +125,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------------------------------- | ---- | --------------------------------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<[ApplicationInfo](js-apis-bundle-ApplicationInfo.md)> | Yes | Callback used to return the application information. |
@@ -145,7 +143,6 @@ bundle.getApplicationInfo(bundleName, bundleFlags, (err, data) => {
})
```
-
## bundle.getAllBundleInfo
getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise>
@@ -186,8 +183,6 @@ bundle.getAllBundleInfo(bundleFlag, userId)
})
```
-
-
## bundle.getAllBundleInfo
getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback>): void
@@ -222,7 +217,6 @@ bundle.getAllBundleInfo(bundleFlag, (err, data) => {
})
```
-
## bundle.getAllBundleInfo
getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): void
@@ -259,8 +253,6 @@ bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => {
})
```
-
-
## bundle.getBundleInfo
getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\
@@ -279,7 +271,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------------- | ---- | --------------------------------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| options | [BundleOptions](#bundleoptions) | No | Includes **userId**. |
@@ -305,8 +297,6 @@ bundle.getBundleInfo(bundleName, bundleFlags, options)
})
```
-
-
## bundle.getBundleInfo
getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\): void
@@ -325,7 +315,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | -------------------------- | ---- | --------------------------------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the bundle information. |
@@ -362,7 +352,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | -------------------------- | ---- | --------------------------------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| bundleFlags | number | Yes | Type of information that will be returned. The default value is **0**. The value must be greater than or equal to 0.|
| options | [BundleOptions](#bundleoptions) | Yes | Includes **userId**. |
| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the bundle information. |
@@ -384,6 +374,466 @@ bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => {
})
```
+## bundle.getBundleInstaller
+
+getBundleInstaller(): Promise<BundleInstaller>;
+
+Obtains the installation package information. This API uses a promise to return the result.
+
+**Required permissions**
+
+ohos.permission.INSTALL_BUNDLE
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------------------ | -------------------------------------------- |
+| Promise<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | Promise used to return the installation package information.|
+
+## bundle.getBundleInstaller
+
+getBundleInstaller(callback: AsyncCallback<BundleInstaller>): void;
+
+Obtains the installation package information. This API uses an asynchronous callback to return the result.
+
+**Required permissions**
+
+ohos.permission.INSTALL_BUNDLE
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | ---------------- |
+| callback | AsyncCallback<[BundleInstaller](js-apis-bundle-BundleInstaller.md)> | Yes | Callback used to return the installation package information.|
+
+## bundle.cleanBundleCacheFiles8+
+
+cleanBundleCacheFiles(bundleName: string, callback: AsyncCallback<void>): void;
+
+Clears the cache data of an application. This API uses an asynchronous callback to return the result.
+
+**Required permissions**
+
+ohos.permission.REMOVE_CACHE_FILES
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------- | ---- | ------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+## bundle.cleanBundleCacheFiles8+
+
+cleanBundleCacheFiles(bundleName: string): Promise<void>
+
+Clears the cache data of an application. This API uses a promise to return the result.
+
+**Required permissions**
+
+ohos.permission.REMOVE_CACHE_FILES
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------ | ---- | ------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application.|
+
+**Return value**
+
+| Type | Description |
+| ------------- | ------------------------------------ |
+| Promise\ | Promise that returns no value.|
+
+## bundle.setApplicationEnabled8+
+
+setApplicationEnabled(bundleName: string, isEnable: boolean, callback: AsyncCallback<void>): void;
+
+Sets whether to enable an application. This API uses an asynchronous callback to return the result.
+
+**Required permissions**
+
+ohos.permission.CHANGE_ABILITY_ENABLED_STATE
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------- | ---- | ----------------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| isEnable | boolean | Yes | Whether to enable the application. The value **true** means to enable the application, and **false** means the opposite.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+## bundle.setApplicationEnabled8+
+
+setApplicationEnabled(bundleName: string, isEnable: boolean): Promise<void>
+
+Sets whether to enable an application. This API uses a promise to return the result.
+
+**Required permissions**
+
+ohos.permission.CHANGE_ABILITY_ENABLED_STATE
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------- | ---- | ----------------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| isEnable | boolean | Yes | Whether to enable the application. The value **true** means to enable the application, and **false** means the opposite.|
+
+**Return value**
+
+| Type | Description |
+| ------------- | ------------------------------------ |
+| Promise\ | Promise that returns no value.|
+
+## bundle.setAbilityEnabled8+
+
+setAbilityEnabled(info: AbilityInfo, isEnable: boolean, callback: AsyncCallback<void>): void;
+
+Sets whether to enable an ability. This API uses an asynchronous callback to return the result.
+
+**Required permissions**
+
+ohos.permission.CHANGE_ABILITY_ENABLED_STATE
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------------------------------- | ---- | ----------------------------------------------- |
+| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information. |
+| isEnable | boolean | Yes | Whether to enable the ability. The value **true** means to enable the ability, and **false** means the opposite.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+## bundle.setAbilityEnabled8+
+
+setAbilityEnabled(info: AbilityInfo, isEnable: boolean): Promise<void>
+
+Sets whether to enable an ability. This API uses a promise to return the result.
+
+**Required permissions**
+
+ohos.permission.CHANGE_ABILITY_ENABLED_STATE
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------------------------------- | ---- | ----------------------------------------------- |
+| info | [AbilityInfo](js-apis-bundle-AbilityInfo.md) | Yes | Ability information. |
+| isEnable | boolean | Yes | Whether to enable the ability. The value **true** means to enable the ability, and **false** means the opposite.|
+
+**Return value**
+
+| Type | Description |
+| ------------- | ------------------------------------ |
+| Promise\ | Promise that returns no value.|
+
+## bundle.getPermissionDef8+
+
+getPermissionDef(permissionName: string, callback: AsyncCallback<PermissionDef>): void;
+
+Obtains the permission details by permission name. This API uses an asynchronous callback to return the result.
+
+**Required permissions**
+
+ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------ |
+| permissionName | string | Yes | Name of the permission. |
+| callback | AsyncCallback<[PermissionDef](js-apis-bundle-PermissionDef)> | Yes | Callback used to return the permission details.|
+
+## bundle.getPermissionDef8+
+
+getPermissionDef(permissionName: string): Promise<PermissionDef>
+
+Obtains the permission details by permission name. This API uses a promise to return the result.
+
+**Required permissions**
+
+ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ------ | ---- | ---------------- |
+| permissionName | string | Yes | Name of the permission.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------------ | ------------------------------------------------------ |
+| Promise<[PermissionDef](js-apis-bundle-PermissionDef)> | Promise used to return the permission details.|
+
+## bundle.setModuleUpgradeFlag9+
+
+setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag, callback: AsyncCallback<void>):void;
+
+Sets whether the module needs an upgrade. This API uses an asynchronous callback to return the result.
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | --------------------------- | ---- | ---------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| moduleName | string | Yes | Module name of the application. |
+| upgradeFlag | [UpgradeFlag](#upgradeflag) | Yes | Upgrade flag, which is used only by the internal system. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+
+## bundle.setModuleUpgradeFlag9+
+
+setModuleUpgradeFlag(bundleName: string, moduleName: string, upgradeFlag: UpgradeFlag): Promise<void>
+
+Sets whether the module needs an upgrade. This API uses a promise to return the result.
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | --------------------------- | ---- | ---------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| moduleName | string | Yes | Module name of the application. |
+| upgradeFlag | [UpgradeFlag](#upgradeflag) | Yes | Upgrade flag, which is used only by the internal system.|
+
+**Return value**
+
+| Type | Description |
+| ------------- | ------------------------------------ |
+| Promise\ | Promise that returns no value.|
+
+## bundle.isModuleRemovable9+
+
+isModuleRemovable(bundleName: string, moduleName: string, callback: AsyncCallback<boolean>): void;
+
+Checks whether a module is removable. This API uses an asynchronous callback to return the result.
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ---------------------- | ---- | --------------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| moduleName | string | Yes | Module name of the application. |
+| callback | AsyncCallback | Yes | Callback used to return the result. If the module is removable, **true** is returned. Otherwise, **false** is returned.|
+
+## bundle.isModuleRemovable9+
+
+isModuleRemovable(bundleName: string, moduleName: string): Promise<boolean>
+
+Checks whether a module is removable. This API uses a promise to return the result.
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------ | ---- | ------------------ |
+| bundleName | string | Yes | Bundle name of an application. |
+| moduleName | string | Yes | Module name of the application.|
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ---------------------------- |
+| Promise | Promise used to return the result. If the module is removable, **true** is returned. Otherwise, **false** is returned.|
+
+## bundle.getBundlePackInfo9+
+
+getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag, callback: AsyncCallback<pack.BundlePackInfo>): void;
+
+Obtains the bundle package information based on a given bundle name and bundle flags. This API uses an asynchronous callback to return the result.
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ---------------------------------- | ---- | ---------------------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package. |
+| callback | AsyncCallback | Yes | Callback used to return the bundle package information.|
+
+## bundle.getBundlePackInfo9+
+
+getBundlePackInfo(bundleName: string, bundlePackFlag : pack.BundlePackFlag): Promise<pack.BundlePackInfo>;
+
+Obtains the bundle package information based on a given bundle name and bundle flags. This API uses a promise to return the result.
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ------------------- | ---- | ---------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| bundlePackFlag | pack.BundlePackFlag | Yes | Flags of the bundle package.|
+
+**Return value**
+
+| Type | Description |
+| ---------------------------- | ----------------------------------- |
+| Promise | Promise used to return the bundle package information.|
+
+## bundle.getDispatcherVersion9+
+
+getDispatcherVersion(callback: AsyncCallback<DispatchInfo>): void;
+
+Obtains the dispatcher version. This API uses an asynchronous callback to return the result.
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| callback | AsyncCallback<[DispatchInfo](js-apis-dispatchInfo.md)> | Yes | Callback used to return the [DispatchInfo](js-apis-dispatchInfo.md).|
+
+## bundle.getDispatcherVersion9+
+
+getDispatcherVersion(): Promise<DispatchInfo>;
+
+Obtains the dispatcher version. This API uses a promise to return the result.
+
+**System capability**
+
+SystemCapability.BundleManager.BundleFramework
+
+**System API**
+
+This is a system API and cannot be called by third-party applications.
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------ | ------------------------------------------------------------ |
+| Promise<[DispatchInfo](js-apis-dispatchInfo.md)> | Promise used to return the [DispatchInfo](js-apis-dispatchInfo.md).|
## bundle.getAllApplicationInfo
@@ -584,7 +1034,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| abilityName | string | Yes | Ability name.|
**Return value**
@@ -624,7 +1074,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------------ | ---- | ---------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| abilityName | string | Yes | Ability name.|
| callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | Callback used to return the ability information.|
@@ -659,7 +1109,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| moduleName | string | Yes | Module name of the application. |
| abilityName | string | Yes | Ability name.|
@@ -701,7 +1151,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------------ | ---- | ---------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| moduleName | string | Yes | Module name of the application. |
| abilityName | string | Yes | Ability name.|
| callback | AsyncCallback\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | Callback used to return the ability information.|
@@ -739,7 +1189,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| abilityName | string | Yes | Ability name.|
**Return value**
@@ -779,7 +1229,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ---------------------- | ---- | ---------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| abilityName | string | Yes | Ability name.|
| callback | AsyncCallback\ | Yes | Callback used to return the application name. |
@@ -814,7 +1264,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ------ | ---- | ---------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| moduleName | string | Yes | Module name of the application. |
| abilityName | string | Yes | Ability name.|
@@ -856,7 +1306,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ----------- | ---------------------- | ---- | ---------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| moduleName | string | Yes | Module name of the application. |
| abilityName | string | Yes | Ability name.|
| callback | AsyncCallback\ | Yes | Callback used to return the application name. |
@@ -959,7 +1409,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
-| bundleName | string | Yes | Bundle name of the application.|
+| bundleName | string | Yes | Bundle name of an application.|
**Return value**
@@ -993,7 +1443,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ---------- | ----------------------- | ---- | --------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| callback | AsyncCallback\ | Yes | Callback used to return whether the ability is enabled. If the ability is enabled, **true** will be returned; otherwise, **false** will be returned.|
**Example**
@@ -1156,7 +1606,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ---------- | ------ | ---- | ------------ |
-| bundleName | string | Yes | Bundle name of the application.|
+| bundleName | string | Yes | Bundle name of an application.|
**Return value**
| Type | Description |
@@ -1193,7 +1643,7 @@ SystemCapability.BundleManager.BundleFramework
| Name | Type | Mandatory | Description |
| ---------- | -------------------- | ---- | ------------------------------ |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| callback | AsyncCallback\<[Want](js-apis-application-Want.md)> | Yes | Callback used to return the **Want** object.|
**Example**
@@ -1278,7 +1728,7 @@ bundle.getNameForUid(uid, (err, data) => {
getAbilityIcon(bundleName: string, abilityName: string): Promise\;
-Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses a promise to return the result.
+Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses a promise to return the result.
**Required permissions**
@@ -1298,7 +1748,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
-| Promise\ | Promise used to return the [PixelMap](js-apis-image.md).|
+| Promise\ | Promise used to return the [pixel map](js-apis-image.md).|
**Example**
@@ -1317,7 +1767,7 @@ bundle.getAbilityIcon(bundleName, abilityName)
getAbilityIcon(bundleName: string, abilityName: string, callback: AsyncCallback\): void;
-Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses an asynchronous callback to return the result.
+Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name and ability name. This API uses an asynchronous callback to return the result.
**Required permissions**
@@ -1333,7 +1783,7 @@ SystemCapability.BundleManager.BundleFramework
| ----------- | ---------------------------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
-| callback | AsyncCallback\ | Yes | Callback used to return the [PixelMap](js-apis-image.md).|
+| callback | AsyncCallback\ | Yes | Callback used to return the [pixel map](js-apis-image.md).|
**Example**
@@ -1353,11 +1803,11 @@ bundle.getAbilityIcon(bundleName, abilityName, (err, data) => {
getAbilityIcon(bundleName: string, moduleName: string, abilityName: string): Promise\;
-Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name, module name, and ability name. This API uses a promise to return the result.
+Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name, module name, and ability name. This API uses a promise to return the result.
**Required permissions**
-ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
+ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**
@@ -1374,7 +1824,7 @@ SystemCapability.BundleManager.BundleFramework
**Return value**
| Type | Description |
| --------------------- | ------------------------------------------------------------ |
-| Promise\ | Promise used to return the [PixelMap](js-apis-image.md).|
+| Promise\ | Promise used to return the [pixel map](js-apis-image.md).|
**Example**
@@ -1394,11 +1844,11 @@ bundle.getAbilityIcon(bundleName, moduleName, abilityName)
getAbilityIcon(bundleName: string, moduleName: string, abilityName: string, callback: AsyncCallback\): void;
-Obtains the [PixelMap](js-apis-image.md) of the icon corresponding to a given bundle name, module name, and ability name. This API uses an asynchronous callback to return the result.
+Obtains the [pixel map](js-apis-image.md) of the icon corresponding to a given bundle name, module name, and ability name. This API uses an asynchronous callback to return the result.
**Required permissions**
-ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
+ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**
@@ -1411,7 +1861,7 @@ SystemCapability.BundleManager.BundleFramework
| bundleName | string | Yes | Bundle name based on which the pixel map is to obtain. |
| moduleName | string | Yes | Module name based on which the pixel map is to obtain. |
| abilityName | string | Yes | Ability name based on which the pixel map is to obtain. |
-| callback | AsyncCallback\ | Yes | Callback used to return the [PixelMap](js-apis-image.md).|
+| callback | AsyncCallback\ | Yes | Callback used to return the [pixel map](js-apis-image.md).|
**Example**
@@ -1528,7 +1978,7 @@ Obtains the Extension ability information based on a given want. This API uses a
**Required permissions**
-ohos.permission.GET_BUNDLE_INFO_PRIVILEGED, ohos.permission.GET_BUNDLE_INFO
+ohos.permission.GET_BUNDLE_INFO_PRIVILEGED or ohos.permission.GET_BUNDLE_INFO
**System capability**
@@ -1693,6 +2143,142 @@ bundle.getProfileByExtensionAbility(moduleName, extensionAbilityName, metadataNa
})
```
+## bundle.setDisposedStatus9+
+
+setDisposedStatus(bundleName: string, status: number, callback: AsyncCallback\): void;
+
+Sets the disposal status for an application based on a given bundle name. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.MANAGE_DISPOSED_APP_STATUS
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| status | number | Yes | Disposal status to set. This parameter is reserved for the application market. The default value is **0**, indicating that no disposal is performed. |
+| callback | AsyncCallback\ | Yes | Callback that returns no value. |
+
+**Example**
+
+```js
+let bundleName = 'com.ohos.camera';
+let status = 1;
+const caller = function callback(err, data) {
+ console.error('Operation err is: ' + err);
+ console.error('Operation result is: ' + data);
+}
+bundle.setDisposedStatus(bundleName, status, caller)
+```
+
+## bundle.setDisposedStatus9+
+
+setDisposedStatus(bundleName: string, status: number): Promise\;
+
+Sets the disposal status for an application based on a given bundle name. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.MANAGE_DISPOSED_APP_STATUS
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| status | number | Yes | Disposal status to set. This parameter is reserved for the application market. The default value is **0**, indicating that no disposal is performed. |
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------- | ------------------------------ |
+| Promise\ | Promise that returns no value.|
+
+**Example**
+
+```js
+let bundleName = 'com.ohos.camera';
+let status = 1;
+
+bundle.setDisposedStatus(bundleName, status).then(data=>{
+ console.error('Operation result is: ' + data);
+}).catch(err=>{
+ console.error('Operation err is: ' + err);
+})
+```
+
+## bundle.getDisposedStatus9+
+
+getDisposedStatus(bundleName: string, callback: AsyncCallback\): void;
+
+Obtains the disposal status of an application based on a given bundle name. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.MANAGE_DISPOSED_APP_STATUS
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+| callback | AsyncCallback\ | Yes | Callback used to return the disposal status. |
+
+**Example**
+
+```js
+let bundleName = 'com.ohos.camera';
+const caller = function callback(err, data) {
+ console.error('Operation err is: ' + err);
+ console.error('Operation result is: ' + data);
+}
+bundle.getDisposedStatus(bundleName, caller)
+```
+
+## bundle.getDisposedStatus9+
+
+getDisposedStatus(bundleName: string): Promise\;
+
+Obtains the disposal status of an application based on a given bundle name. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.MANAGE_DISPOSED_APP_STATUS
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ---------------- | ---------------------------------- | ---- | ---------------------------------------- |
+| bundleName | string | Yes | Bundle name of an application. |
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------- | ------------------------------ |
+| Promise\ | Promise used to return the disposal status.|
+
+**Example**
+
+```js
+let bundleName = 'com.ohos.camera';
+
+bundle.getDisposedStatus(bundleName).then(data=>{
+ console.error('Operation result is: ' + data);
+}).catch(err=>{
+ console.error('Operation err is: ' + err);
+})
+```
+
## InstallErrorCode
**System capability**: SystemCapability.BundleManager.BundleFramework
@@ -1779,15 +2365,15 @@ Enumerates display orientations.
| LANDSCAPE | None | Landscape orientation. |
| PORTRAIT | None | Portrait orientation. |
| FOLLOW_RECENT | None | Orientation same as that of the nearest ability in the stack.|
-| LANDSCAPE_INVERTED |None | Reverse landscape orientation. |
-| PORTRAIT_INVERTED |None | Reverse portrait orientation. |
-| AUTO_ROTATION |None | Orientation determined by the sensor. |
-| AUTO_ROTATION_LANDSCAPE |None | Orientation determined by the sensor in the horizontal direction, including landscape and reverse landscape. |
-| AUTO_ROTATION_PORTRAIT |None | Orientation determined by the sensor in the vertical direction, including portrait and reverse portrait. |
-| AUTO_ROTATION_RESTRICTED |None | Orientation determined by the sensor when the sensor switch is enabled. |
-| AUTO_ROTATION_LANDSCAPE_RESTRICTED |None | Orientation determined by the sensor in the horizontal direction, including landscape and reverse landscape, when the sensor switch is enabled. |
-| AUTO_ROTATION_PORTRAIT_RESTRICTED |None | Orientation determined by the sensor in the vertical direction, including portrait and reverse portrait, when the sensor switch is enabled. |
-| LOCKED |None | Auto rotate locked. |
+| LANDSCAPE_INVERTED9+ |None | Reverse landscape orientation. |
+| PORTRAIT_INVERTED9+ |None | Reverse portrait orientation. |
+| AUTO_ROTATION9+ |None | Orientation determined by the sensor. |
+| AUTO_ROTATION_LANDSCAPE9+ |None | Orientation determined by the sensor in the horizontal direction, including landscape and reverse landscape. |
+| AUTO_ROTATION_PORTRAIT9+ |None | Orientation determined by the sensor in the vertical direction, including portrait and reverse portrait. |
+| AUTO_ROTATION_RESTRICTED9+ |None | Orientation determined by the sensor when the sensor switch is enabled. |
+| AUTO_ROTATION_LANDSCAPE_RESTRICTED9+ |None | Orientation determined by the sensor in the horizontal direction, including landscape and reverse landscape, when the sensor switch is enabled. |
+| AUTO_ROTATION_PORTRAIT_RESTRICTED9+ |None | Orientation determined by the sensor in the vertical direction, including portrait and reverse portrait, when the sensor switch is enabled. |
+| LOCKED9+ |None | Auto rotate disabled. |
## LaunchMode
Enumerates launch modes.
@@ -1827,9 +2413,12 @@ Enumerates Extension ability types.
| FILE_SHARE9+ | 6 | File sharing included.|
| STATIC_SUBSCRIBER9+ | 7 | Subscribers included. |
| WALLPAPER9+ | 8 | Wallpaper included. |
-| BACKUP9+ | 9 | Data backup and restore included.|
+| BACKUP9+ | 9 | Data backup and restore included.|
+| WINDOW9+ | 10 | Window type extension information included.|
| ENTERPRISE_ADMIN9+ | 11 | Enterprise administrators included. |
-| UNSPECIFIED9+ | 20 | Unspecified type. |
+| THUMBNAIL9+ | 13 | Thumbnails included.|
+| PREVIEW9+ | 14 | Preview included.|
+| UNSPECIFIED9+ | 255 | Unspecified type. |
## ExtensionFlag9+
@@ -1876,6 +2465,20 @@ Enumerates window modes.
| Name | Type | Description |
| ------------------ | ---- | ---- |
-| FULLSCREEN | None | Full screen.|
-| SPLIT | None | Split-screen. |
-| FLOATING | None | Floating. |
+| FULL_SCREEN9+ | 0 | Full screen.|
+| SPLIT9+ | 1 | Split-screen. |
+| FLOATING9+ | 2 | Floating. |
+
+## UpgradeFlag
+
+Enumerates the upgrade flags, which are for internal use only.
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+| Name | Value | Description |
+| ----------------------------- | ---- | ---------------- |
+| NOT_UPGRADE9+ | 0 | No module needs an upgrade. |
+| SINGLE_UPGRADE9+ | 1 | A single module needs an upgrade.|
+| RELATION_UPGRADE9+ | 2 | The module that has a relationship with the current one needs an upgrade.|
diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md
index 7e947ddbe0194fabeb31d1c10c44eab0dcfe1550..ce415ad942510c481755380bdd90adb7eb1c75ae 100644
--- a/en/application-dev/reference/apis/js-apis-Context.md
+++ b/en/application-dev/reference/apis/js-apis-Context.md
@@ -1,19 +1,16 @@
# Context
+The **Context** module provides context for abilities or applications. It allows access to application-specific resources, as well as permission requests and verification.
+
> **NOTE**
->
-> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>
+> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>
> The APIs of this module can be used only in the FA model.
-## Modules to Import
-
-```js
-import featureAbility from '@ohos.ability.featureAbility'
-```
-
## Usage
-The **Context** object is created in a **featureAbility** and returned through its **getContext()** API. Therefore, you must import the **@ohos.ability.featureAbility** package before using the Context module. An example is as follows:
+The **Context** object is created in a **featureAbility** and returned through its **getContext()** API. Therefore, you must import the **@ohos.ability.featureAbility** package before using the **Context** module. An example is as follows:
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -91,7 +88,7 @@ Verifies whether a specific PID and UID have the given permission. This API uses
| ---------- | --------------------------------------- | ---- | ------------------------------------- |
| permission | string | Yes | Name of the permission to verify. |
| options | [PermissionOptions](#permissionoptions) | Yes | Permission options. |
-| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
+| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.|
**Example**
@@ -119,7 +116,7 @@ Verifies whether the current PID and UID have the given permission. This API use
| Name | Type | Mandatory| Description |
| ---------- | ---------------------- | ---- | ------------------------------------- |
| permission | string | Yes | Name of the permission to verify. |
-| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
+| callback | AsyncCallback\ | Yes | Callback used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.|
**Example**
@@ -148,7 +145,7 @@ Verifies whether a specific PID and UID have the given permission. This API uses
| Type | Description |
| ---------------- | ----------------------------------------------------------- |
-| Promise\ | Promise used to return the permission verification result. The value **0** indicates that the PID and UID have the given permission, and the value **-1** indicates that the PID and UID do not have the given permission.|
+| Promise\ | Promise used to return the permission verification result. The value **0** means that the PID and UID have the given permission, and the value **-1** means the opposite.|
**Example**
@@ -255,7 +252,7 @@ context.getApplicationInfo().then((data) => {
getBundleName(callback: AsyncCallback\): void
-Obtains the bundle name of the current ability. This API uses an asynchronous callback to return the result.
+Obtains the bundle name of this ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -279,7 +276,7 @@ context.getBundleName()
getBundleName(): Promise\
-Obtains the bundle name of the current ability. This API uses a promise to return the result.
+Obtains the bundle name of this ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -300,6 +297,225 @@ context.getBundleName().then((data) => {
});
```
+## Context.getDisplayOrientation7+
+
+getDisplayOrientation(callback: AsyncCallback\): void
+
+Obtains the display orientation of this ability. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ----------------------------- |
+| callback | AsyncCallback\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | Yes | Callback used to return the display orientation.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+context.getDisplayOrientation()
+```
+
+## Context.getDisplayOrientation7+
+
+getDisplayOrientation(): Promise\;
+
+Obtains the display orientation of this ability. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ------------------------- |
+| Promise\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | Promise used to return the display orientation.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+context.getDisplayOrientation().then((data) => {
+ console.info("=======================>getDisplayOrientationCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
+});
+```
+
+## Context.setDisplayOrientation7+
+
+setDisplayOrientation(orientation: bundle.DisplayOrientation, callback: AsyncCallback\): void
+
+Obtains the display orientation for this ability. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ----------------------------- |
+| orientation | [bundle.DisplayOrientation](js-apis-bundle.md#displayorientation) | Yes | Display orientation to set.|
+| callback | AsyncCallback\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | Yes | Callback used to return the display orientation.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+import bundle from '@ohos.bundle'
+var context = featureAbility.getContext();
+var orientation=bundle.DisplayOrientation.UNSPECIFIED
+context.setDisplayOrientation(orientation, (err) => {
+ console.log('---------- setDisplayOrientation fail, err: -----------', err);
+});
+```
+
+## Context.setDisplayOrientation7+
+
+setDisplayOrientation(orientation: bundle.DisplayOrientation): Promise\;
+
+Obtains the display orientation for this ability. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ------------------------- |
+| orientation | [bundle.DisplayOrientation](js-apis-bundle.md#displayorientation) | Yes | Display orientation to set.|
+| Promise\<[bundle.DisplayOrientation](js-apis-bundle.md#displayorientation)> | Promise used to return the display orientation.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+import bundle from '@ohos.bundle'
+var context = featureAbility.getContext();
+var orientation=bundle.DisplayOrientation.UNSPECIFIED
+context.setDisplayOrientation(orientation).then((data) => {
+ console.info("=======================>setDisplayOrientationCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
+});
+```
+
+## Context.setShowOnLockScreen7+
+
+setShowOnLockScreen(show: boolean, callback: AsyncCallback\): void
+
+Sets whether to show this feature at the top of the lock screen each time the lock screen is displayed so that the feature remains activated. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ----------------------------- |
+| show | boolean | Yes | Whether to show this feature at the top of the lock screen. The value **true** means to show this feature at the top of the lock screen, and **false** means the opposite.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+var show=true
+context.setShowOnLockScreen(show, (err) => {
+ console.log('---------- setShowOnLockScreen fail, err: -----------', err);
+});
+```
+
+## Context.setShowOnLockScreen7+
+
+setShowOnLockScreen(show: boolean): Promise\;
+
+Sets whether to show this feature at the top of the lock screen each time the lock screen is displayed so that the feature remains activated. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ----------------------------- |
+| show | boolean | Yes | Whether to show this feature at the top of the lock screen. The value **true** means to show this feature at the top of the lock screen, and **false** means the opposite.|
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ------------------------- |
+| Promise\| Promise used to return the result.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+var show=true
+context.setShowOnLockScreen(show).then((data) => {
+ console.info("=======================>setShowOnLockScreenCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
+});
+```
+
+## Context.setWakeUpScreen7+
+
+setWakeUpScreen(wakeUp: boolean, callback: AsyncCallback\): void
+
+Sets whether to wake up the screen when this feature is restored. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ----------------------------- |
+| wakeUp | boolean | Yes | Whether to wake up the screen. The value **true** means to wake up the screen, and **false** means the opposite.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+var wakeUp=true
+context.setWakeUpScreen(wakeUp, (err) => {
+ console.log('---------- setWakeUpScreen fail, err: -----------', err);
+});
+```
+
+## Context.setWakeUpScreen7+
+
+setWakeUpScreen(wakeUp: boolean): Promise\;
+
+Sets whether to wake up the screen when this feature is restored. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ----------------------------- |
+| wakeUp | boolean | Yes | Whether to wake up the screen. The value **true** means to wake up the screen, and **false** means the opposite.|
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ------------------------- |
+| Promise\| Promise used to return the result.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+var wakeUp=true
+context.setWakeUpScreen(wakeUp).then((data) => {
+ console.info("=======================>setWakeUpScreenCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
+});
+```
+
+
## Context.getProcessInfo7+
@@ -357,7 +573,7 @@ context.getProcessInfo().then((data) => {
getElementName(callback: AsyncCallback\): void
-Obtains the **ohos.bundle.ElementName** object of the current ability. This API uses an asynchronous callback to return the result.
+Obtains the **ohos.bundle.ElementName** object of this ability. This API uses an asynchronous callback to return the result.
This API is available only to Page abilities.
@@ -383,7 +599,7 @@ context.getElementName()
getElementName(): Promise\
-Obtains the **ohos.bundle.ElementName** object of the current ability. This API uses a promise to return the result.
+Obtains the **ohos.bundle.ElementName** object of this ability. This API uses a promise to return the result.
This API is available only to Page abilities.
@@ -510,7 +726,7 @@ context.getCallingBundle().then((data) => {
getCacheDir(callback: AsyncCallback\): void
-Obtains the cache directory of the application on the internal storage. This API uses an asynchronous callback to return the result.
+Obtains the cache directory of the application in the internal storage. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -538,7 +754,7 @@ context.getCacheDir((err, data) => {
getCacheDir(): Promise\
-Obtains the cache directory of the application on the internal storage. This API uses a promise to return the result.
+Obtains the cache directory of the application in the internal storage. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -563,7 +779,7 @@ context.getCacheDir().then((data) => {
getFilesDir(callback: AsyncCallback\): void
-Obtains the file directory of the application on the internal storage. This API uses an asynchronous callback to return the result.
+Obtains the file directory of the application in the internal storage. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -591,7 +807,7 @@ context.getFilesDir((err, data) => {
getFilesDir(): Promise\
-Obtains the file directory of the application on the internal storage. This API uses a promise to return the result.
+Obtains the file directory of the application in the internal storage. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -732,7 +948,7 @@ Obtains the **ModuleInfo** object of the application. This API uses an asynchron
| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------- |
-| callback | AsyncCallback\<[HapModuleInfo](#hapmoduleinfo)> | Yes | Callback used to return the **ModuleInfo** object.|
+| callback | AsyncCallback\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Yes | Callback used to return the **ModuleInfo** object.|
**Example**
@@ -760,7 +976,7 @@ Obtains the **ModuleInfo** object of the application. This API uses a promise to
| Type | Description |
| --------------- | ------------------------- |
-| Promise\<[HapModuleInfo](#hapmoduleinfo)> | Promise used to return the **ModuleInfo** object.|
+| Promise\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Promise used to return the **ModuleInfo** object.|
**Example**
@@ -774,9 +990,9 @@ context.getHapModuleInfo().then((data) => {
## Context.getAppVersionInfo7+
-getAppVersionInfo(callback: AsyncCallback\): void
+getAppVersionInfo(callback: AsyncCallback\): void
-Obtains the version information of the application. This API uses an asynchronous callback to return the result.
+Obtains the version information of this application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -804,7 +1020,7 @@ context.getAppVersionInfo((err, data) => {
getAppVersionInfo(): Promise\
-Obtains the version information of the application. This API uses a promise to return the result.
+Obtains the version information of this application. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -828,7 +1044,7 @@ context.getAppVersionInfo().then((data) => {
getAbilityInfo(callback: AsyncCallback\): void
-Obtains information of the current ability. This API uses an asynchronous callback to return the result.
+Obtains information about this ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -856,7 +1072,7 @@ context.getAbilityInfo((err, data) => {
getAbilityInfo(): Promise\
-Obtains information of the current ability. This API uses a promise to return the result.
+Obtains information about this ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -897,6 +1113,111 @@ import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext().getApplicationContext();
```
+## Context.isUpdatingConfigurations7+
+
+isUpdatingConfigurations(callback: AsyncCallback\): void;
+
+Checks whether the configuration of this ability is being changed. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ------------------------- |
+| callback | AsyncCallback\ | Yes | Returns **true** if the configuration of the capability is being changed; returns **false** otherwise.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+context.isUpdatingConfigurations((err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+});
+```
+
+## Context.isUpdatingConfigurations7+
+
+isUpdatingConfigurations(): Promise\;
+
+Checks whether the configuration of this ability is being changed. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Return value**
+
+| Type | Description |
+| --------------- | ------------------------- |
+|Promise\ | Returns **true** if the configuration of the capability is being changed; returns **false** otherwise.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+context.isUpdatingConfigurations().then((data) => {
+ console.info("====>data====>" + JSON.stringify(data));
+});
+```
+
+## Context.printDrawnCompleted7+
+
+printDrawnCompleted(callback: AsyncCallback\): void;
+
+Notifies the system of the time required to draw this page function. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ------------------------- |
+| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+context.printDrawnCompleted((err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+});
+```
+
+## Context.printDrawnCompleted7+
+
+printDrawnCompleted(): Promise\;
+
+Notifies the system of the time required to draw this page function. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Return value**
+
+| Type | Description |
+| --------------- | ------------------------- |
+|Promise\ | Promise used to return the result.|
+
+**Example**
+
+```js
+import featureAbility from '@ohos.ability.featureAbility'
+var context = featureAbility.getContext();
+context.printDrawnCompleted().then((data) => {
+ console.info("====>data====>" + JSON.stringify(data));
+});
+```
+
+
## PermissionOptions7+
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -916,31 +1237,10 @@ var context = featureAbility.getContext().getApplicationContext();
| permissions | Read-only | Array\ | Yes | Permissions requested. |
| authResults | Read-only | Array\ | Yes | Permission request result. |
-## HapModuleInfo7+
-
-Describes the HAP module information.
-
-| Name | Type| Readable| Writable| Description|
-| ------ | ------ | ------ | ------ | ------ |
-| name | string | Yes | No | Module name. |
-| description | string | Yes | No | Module description. |
-| descriptionId | number | Yes | No | Module description ID. |
-| icon | string | Yes | No | Module icon. |
-| label | string | Yes | No | Module label. |
-| labelId | number | Yes | No | Module label ID. |
-| iconId | number | Yes | No | Module icon ID. |
-| backgroundImg | string | Yes | No | Module background image. |
-| supportedModes | number | Yes | No | Running modes supported by the module. |
-| reqCapabilities | Array\ | Yes | No | Capabilities required for module running.|
-| deviceTypes | Array\ | Yes | No | Device types supported by the module.|
-| abilityInfo | Array\ | Yes | No | Ability information. |
-| moduleName | string | Yes | No | Module name. |
-| mainAbilityName | string | Yes | No | Name of the main ability. |
-| installationFree | boolean | Yes | No | Whether installation-free is supported. |
-| mainElementName | string | Yes| No| Information about the main ability.|
-
## AppVersionInfo7+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
| Name | Type| Readable | Writable | Description|
| ------ | ------ | ------| ------ | ------ |
| appName | string | Yes | No | Module name. |
diff --git a/en/application-dev/reference/apis/js-apis-DataUriUtils.md b/en/application-dev/reference/apis/js-apis-DataUriUtils.md
index 584b7e1285c0087bc1109bd32d50eb1143360df1..18cfa0cdc0c54ea8e8aa85fc43fcf61b3d63fc7a 100644
--- a/en/application-dev/reference/apis/js-apis-DataUriUtils.md
+++ b/en/application-dev/reference/apis/js-apis-DataUriUtils.md
@@ -1,4 +1,6 @@
-# DataUriUtils Module
+# DataUriUtils
+
+The **DataUriUtils** module provides APIs to handle utility classes for objects using the **DataAbilityHelper** schema. You can use the APIs to attach an ID to the end of a given URI and obtain, delete, or update the ID attached to the end of a given URI.
> **NOTE**
>
diff --git a/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md b/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
index 5b7866478f7f527ceb806b2aec083bd21835800a..06cac3878b46d62fdc09e6a342bdcc9340714c4f 100644
--- a/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-EnterpriseAdminExtensionAbility.md
@@ -1,18 +1,22 @@
-# EnterpriseAdminExtentionAbility
+# EnterpriseAdminExtensionAbility
-The **EnterpriseAdminExtentionAbility** module provides APIs for Extension abilities of enterprise administrators.
+The **EnterpriseAdminExtensionAbility** module provides Extension abilities for enterprise administrators.
+
+To have the capabilities provided by the module, for example, receiving the application activation or deactivation notification sent by the system, an enterprise administrator application must have an **EnterpriseAdminExtensionAbility** instance and override the APIs in it.
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>
> The APIs of this module can be used only in the stage model.
+
## Modules to Import
```ts
-import EnterpriseAdminExtentionAbility from '@ohos.EnterpriseAdminExtentionAbility'
+import EnterpriseAdminExtensionAbility from '@ohos.EnterpriseAdminExtensionAbility'
```
-## EnterpriseAdminExtentionAbility.onAdminEnabled
+## EnterpriseAdminExtensionAbility.onAdminEnabled
onAdminEnabled(): void
@@ -22,14 +26,14 @@ Called when an enterprise administrator is enabled.
**Example**
- ```ts
+```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
- onAdminEnabled() {
- }
+ onAdminEnabled() {
+ }
};
- ```
+```
-## EnterpriseAdminExtentionAbility.onAdminDisabled
+## EnterpriseAdminExtensionAbility.onAdminDisabled
onAdminDisabled(): void
@@ -38,11 +42,10 @@ Called when an enterprise administrator is disabled.
**System capability**: SystemCapability.Customization.EnterpriseDeviceManager
**Example**
-
- ```ts
+```ts
export default class EnterpriseAdminAbility extends EnterpriseAdminExtensionAbility {
- onAdminDisabled() {
- }
+ onAdminDisabled() {
+ }
};
- ```
+```
diff --git a/en/application-dev/reference/apis/js-apis-ability-context.md b/en/application-dev/reference/apis/js-apis-ability-context.md
index b858d93cbd061d4f1df583ac9d4045e152105b7a..e2333a523a918e229c6a35c4e341df9383bfb26a 100644
--- a/en/application-dev/reference/apis/js-apis-ability-context.md
+++ b/en/application-dev/reference/apis/js-apis-ability-context.md
@@ -1,17 +1,14 @@
# AbilityContext
+The **AbilityContext** module, inherited from **Context**, implements the context for abilities.
+
+This module provides APIs for accessing ability-specific resources. You can use the APIs to start and terminate an ability, obtain the caller interface, and request permissions from users by displaying a pop-up window.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-Implements the ability context. This module is inherited from **Context**.
-
-## Modules to Import
-
-```js
-import Ability from '@ohos.application.Ability'
-```
## Usage
Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**.
@@ -25,7 +22,6 @@ class MainAbility extends Ability {
}
```
-
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -34,16 +30,18 @@ class MainAbility extends Ability {
| -------- | -------- | -------- | -------- | -------- |
| abilityInfo | AbilityInfo | Yes| No| Ability information.|
| currentHapModuleInfo | HapModuleInfo | Yes| No| Information about the current HAP.|
-
+| config | [Configuration](js-apis-configuration.md) | Yes| No| Configuration information.|
## AbilityContext.startAbility
startAbility(want: Want, callback: AsyncCallback<void>): void
-Starts an ability. This API uses a callback to return the result.
+Starts an ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System API**: This is a system API and cannot be called by third-party applications.
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -69,10 +67,12 @@ Starts an ability. This API uses a callback to return the result.
startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void
-Starts an ability. This API uses a callback to return the result.
+Starts an ability with start options specified. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System API**: This is a system API and cannot be called by third-party applications.
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -106,6 +106,8 @@ Starts an ability. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System API**: This is a system API and cannot be called by third-party applications.
+
**Parameters**
| Name| Type| Mandatory| Description|
@@ -143,7 +145,7 @@ Starts an ability. This API uses a promise to return the result.
startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>): void;
-Starts an ability. This API uses a callback to return the result when the ability is terminated.
+Starts an ability. This API uses an asynchronous callback to return the result when the ability is terminated.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -171,7 +173,7 @@ Starts an ability. This API uses a callback to return the result when the abilit
startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
-Starts an ability. This API uses a callback to return the result when the ability is terminated.
+Starts an ability with start options specified. This API uses an asynchronous callback to return the result when the ability is terminated.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -235,12 +237,134 @@ Starts an ability. This API uses a promise to return the result when the ability
})
```
+## AbilityContext.startAbilityForResultWithAccount
+
+startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback): void;
+
+Starts an ability. This API uses an asynchronous callback to return the result when the account of the ability is destroyed.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
+| accountId | number | Yes| ID of the account.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility"
+ };
+ var accountId = 100;
+ this.context.startAbilityWithAccount(want, accountId, (err, data) => {
+ console.log('---------- startAbilityWithAccount fail, err: -----------', err);
+ console.log('---------- startAbilityWithAccount success, data: -----------', data);
+ });
+ ```
+
+
+## AbilityContext.startAbilityForResultWithAccount
+
+startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\): void;
+
+Starts an ability with start options specified. This API uses an asynchronous callback to return the result when the account of the ability is destroyed.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
+| accountId | number | Yes| ID of the account.|
+| options | [StartOptions](js-apis-application-StartOptions.md) | Yes| Parameters used for starting the ability.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility"
+ };
+ var accountId = 100;
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbilityForResultWithAccount(want, accountId, options, (err) => {
+ console.log('---------- startAbilityForResultWithAccount fail, err: -----------', err);
+ });
+ ```
+
+
+ ## AbilityContext.startAbilityForResultWithAccount
+
+startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\;
+
+Starts an ability with start options specified. This API uses a promise to return the result when the account of the ability is destroyed.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
+| accountId | number | Yes| ID of the account.|
+| options | [StartOptions](js-apis-application-StartOptions.md) | No| Parameters used for starting the ability.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Promise<AbilityResult> | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility"
+ };
+ var accountId = 100;
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbilityForResultWithAccount(want, accountId, options)
+ .then((data) => {
+ console.log('---------- startAbilityForResultWithAccount success, data: -----------', data);
+ })
+ .catch((err) => {
+ console.log('---------- startAbilityForResultWithAccount fail, err: -----------', err);
+ })
+ ```
+
## AbilityContext.terminateSelf
terminateSelf(callback: AsyncCallback<void>): void;
-Terminates this ability. This API uses a callback to return the result.
+Terminates this ability. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -248,7 +372,7 @@ Terminates this ability. This API uses a callback to return the result.
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the API is successfully called.|
+| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Example**
@@ -271,12 +395,12 @@ Terminates this ability. This API uses a promise to return the result.
| Type| Description|
| -------- | -------- |
-| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
+| Promise<void> | Promise used to return the result.|
**Example**
```js
- this.context.terminateSelf(want).then((data) => {
+ this.context.terminateSelf().then((data) => {
console.log('success:' + JSON.stringify(data));
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
@@ -288,7 +412,7 @@ Terminates this ability. This API uses a promise to return the result.
terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<void>): void;
-Terminates this ability. This API uses a callback to return the information to the caller of **startAbilityForResult**.
+Terminates this ability. This API uses an asynchronous callback to return the information to the caller of **startAbilityForResult**.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -346,6 +470,149 @@ Terminates this ability. This API uses a promise to return information to the ca
)
```
+## AbilityContext.connectAbility
+
+connectAbility(want: Want, options: ConnectOptions): number;
+
+Uses the **AbilityInfo.AbilityType.SERVICE** template to connect this ability to another ability.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
+| options | [ConnectOptions](js-apis-featureAbility.md#connectoptions) | No| Remote object instance.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| number | Result code of the ability connection.|
+
+**Example**
+
+ ```js
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility"
+ };
+ var options = {
+ onConnect(elementName, remote) { console.log('----------- onConnect -----------') },
+ onDisconnect(elementName) { console.log('----------- onDisconnect -----------') },
+ onFailed(code) { console.log('----------- onFailed -----------') }
+ }
+ const result = this.context.connectAbility(want, options);
+ console.log('----------- connectAbilityResult: ------------', result);
+ ```
+
+
+## AbilityContext.connectAbilityWithAccount
+
+connectAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
+
+Uses the **AbilityInfo.AbilityType.SERVICE** template and account ID to connect this ability to another ability.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
+| accountId | number | Yes| ID of the account.|
+| options | [ConnectOptions](js-apis-featureAbility.md#connectoptions) | No| Parameters for the connection.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| number | Result code of the ability connection.|
+
+**Example**
+
+ ```js
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility"
+ };
+ var accountId = 100;
+ var options = {
+ onConnect(elementName, remote) { console.log('----------- onConnect -----------') },
+ onDisconnect(elementName) { console.log('----------- onDisconnect -----------') },
+ onFailed(code) { console.log('----------- onFailed -----------') }
+ }
+ const result = this.context.connectAbilityWithAccount(want, accountId, options);
+ console.log('----------- connectAbilityResult: ------------', result);
+ ```
+
+## AbilityContext.disconnectAbility
+
+disconnectAbility(connection: number): Promise\;
+
+Disconnects a connection. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| connection | number | Yes| Result code of the ability connection.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ var connectionNumber = 0;
+ this.context.disconnectAbility(connectionNumber).then((data) => {
+ console.log('disconnectAbility success, data: ', data);
+ }).catch((err) => {
+ console.log('disconnectAbility fail, err: ', err);
+ });
+ ```
+
+## AbilityContext.disconnectAbility
+
+disconnectAbility(connection: number, callback:AsyncCallback\): void;
+
+Disconnects a connection. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| connection | number | Yes| Result code of the ability connection.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ var connectionNumber = 0;
+ this.context.disconnectAbility(connectionNumber, (err) => {
+ console.log('---------- disconnectAbility fail, err: -----------', err);
+ });
+ ```
## AbilityContext.startAbilityByCall
@@ -388,12 +655,126 @@ Obtains the caller interface of the specified ability, and if the specified abil
}
```
+## AbilityContext.startAbilityWithAccount
+
+startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\): void;
+
+Starts an ability with the account ID specified. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
+| accountId | number | Yes| ID of the account.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility"
+ };
+ var accountId = 100;
+ this.context.startAbilityWithAccount(want, accountId, (err) => {
+ console.log('---------- startAbilityWithAccount fail, err: -----------', err);
+ });
+ ```
+
+
+## AbilityContext.startAbilityWithAccount
+
+startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback\): void;
+
+Starts an ability with the account ID and start options specified. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
+| accountId | number | Yes| ID of the account.|
+| options | [StartOptions](js-apis-application-StartOptions.md) | No| Parameters used for starting the ability.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility"
+ };
+ var accountId = 100;
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbilityWithAccount(want, accountId, options, (err) => {
+ console.log('---------- startAbilityWithAccount fail, err: -----------', err);
+ });
+ ```
+
+
+## AbilityContext.startAbilityWithAccount
+
+startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise\;
+
+Starts an ability with the account ID specified. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information about the **Want** used for starting an ability.|
+| accountId | number | Yes| ID of the account.|
+| options | [StartOptions](js-apis-application-StartOptions.md) | No| Parameters used for starting the ability.|
+
+**Example**
+
+ ```js
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility"
+ };
+ var accountId = 100;
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbilityWithAccount(want, accountId, options)
+ .then((data) => {
+ console.log('---------- startAbilityWithAccount success, data: -----------', data);
+ })
+ .catch((err) => {
+ console.log('---------- startAbilityWithAccount fail, err: -----------', err);
+ })
+ ```
## AbilityContext.requestPermissionsFromUser
requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>) : void;
-Requests permissions from the user by displaying a pop-up window. This API uses a callback to return the result.
+Requests permissions from the user by displaying a pop-up window. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -402,7 +783,7 @@ Requests permissions from the user by displaying a pop-up window. This API uses
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| permissions | Array<string> | Yes| Permissions to request.|
-| callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback used to return the result indicating whether the API is successfully called.|
+| callback | AsyncCallback<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Yes| Callback used to return the permission request result.|
**Example**
@@ -433,7 +814,7 @@ Requests permissions from the user by displaying a pop-up window. This API uses
| Type| Description|
| -------- | -------- |
-| Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result indicating whether the API is successfully called.|
+| Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the permission request result.|
**Example**
@@ -452,7 +833,7 @@ Requests permissions from the user by displaying a pop-up window. This API uses
setMissionLabel(label: string, callback:AsyncCallback<void>): void;
-Sets the label of the ability in the mission. This API uses an asynchronous callback to return the result.
+Sets a label for this ability in the mission. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -461,7 +842,7 @@ Sets the label of the ability in the mission. This API uses an asynchronous call
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| label | string | Yes| Label of the ability to set.|
-| callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the API is successfully called.|
+| callback | AsyncCallback<void> | Yes| Callback used to return the result.|
**Example**
@@ -476,7 +857,7 @@ Sets the label of the ability in the mission. This API uses an asynchronous call
setMissionLabel(label: string): Promise<void>
-Sets the label of the ability in the mission. This API uses a promise to return the result.
+Sets a label for this ability in the mission. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -490,7 +871,7 @@ Sets the label of the ability in the mission. This API uses a promise to return
| Type| Description|
| -------- | -------- |
-| Promise<void> | Promise used to return the result indicating whether the API is successfully called.|
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -501,6 +882,117 @@ Sets the label of the ability in the mission. This API uses a promise to return
console.log('failed:' + JSON.stringify(error));
});
```
+## AbilityContext.setMissionIcon
+
+setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\): void;
+
+Sets an icon for this ability in the mission. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| icon | image.PixelMap | Yes| Icon of the ability to set.|
+| callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ import image from '@ohos.multimedia.image'
+ var imagePixelMap;
+ var color = new ArrayBuffer(0);
+ var initializationOptions = {
+ size: {
+ height: 100,
+ width: 100
+ }
+ };
+ image.createPixelMap(color, initializationOptions)
+ .then((data) => {
+ imagePixelMap = data;
+ })
+ .catch((err) => {
+ console.log('--------- createPixelMap fail, err: ---------', err)
+ });
+ this.context.setMissionIcon(imagePixelMap, (err) => {
+ console.log('---------- setMissionIcon fail, err: -----------', err);
+ })
+ ```
+
+
+## AbilityContext.setMissionIcon
+
+setMissionIcon(icon: image.PixelMap): Promise\;
+
+Sets an icon for this ability in the mission. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| icon | image.PixelMap | Yes| Icon of the ability to set.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Promise<void> | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ import image from '@ohos.multimedia.image'
+ var imagePixelMap;
+ var color = new ArrayBuffer(0);
+ var initializationOptions = {
+ size: {
+ height: 100,
+ width: 100
+ }
+ };
+ image.createPixelMap(color, initializationOptions)
+ .then((data) => {
+ imagePixelMap = data;
+ })
+ .catch((err) => {
+ console.log('--------- createPixelMap fail, err: ---------', err)
+ });
+ this.context.setMissionIcon(imagePixelMap)
+ .then((data) => {
+ console.log('-------------- setMissionIcon success, data: -------------', data);
+ })
+ .catch((err) => {
+ console.log('-------------- setMissionIcon fail, err: -------------', err);
+ });
+ ```
+## AbilityContext.restoreWindowStage
+
+restoreWindowStage(localStorage: LocalStorage) : void;
+
+Restores the window stage data for this ability.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| localStorage | image.LocalStorage | Yes| Storage used to store the restored window stage.|
+
+**Example**
+
+ ```js
+ var storage = new LocalStorage();
+ this.context.restoreWindowStage(storage);
+ ```
## AbilityContext.isTerminating
diff --git a/en/application-dev/reference/apis/js-apis-ability-errorCode.md b/en/application-dev/reference/apis/js-apis-ability-errorCode.md
index cc0197f022957aadb0dd784c1d4ae8c6e0c50005..6a131521d3c447cfb2df65b53a592c5be89678be 100644
--- a/en/application-dev/reference/apis/js-apis-ability-errorCode.md
+++ b/en/application-dev/reference/apis/js-apis-ability-errorCode.md
@@ -1,8 +1,10 @@
# ErrorCode
+The **ErrorCode** module defines the error codes that can be used when the ability is started.
+
> **NOTE**
>
-> The initial APIs of this module are supported since API 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -12,7 +14,7 @@ import errorCode from '@ohos.ability.errorCode'
## ErrorCode
-Defines the error code used when the ability is started.
+Defines the error codes used when the ability is started.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
diff --git a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
index e1d57d47b1b77f1695f8ec79ac49bfbb22422d05..c2bb08c5314a44dcf6f4ad9246e6ee08a313ecd8 100644
--- a/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
+++ b/en/application-dev/reference/apis/js-apis-ability-wantConstant.md
@@ -1,8 +1,10 @@
# wantConstant
+The **wantConstant** module provides the action, entity, and flags used in **Want** objects.
+
> **NOTE**
>
-> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> The initial APIs of this module are supported since API 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -12,73 +14,75 @@ import wantConstant from '@ohos.ability.wantConstant'
## wantConstant.Action
-**System capability**: SystemCapability.Ability.AbilityBase
+Enumerates the action constants of the **Want** object.
-Lists the permissions.
+**System capability**: SystemCapability.Ability.AbilityBase
-| Common Event Macro | Common Event Name | Subscriber Permission |
+| Name | Value | Description |
| ------------ | ------------------ | ---------------------- |
-| ACTION_HOME | ohos.want.action.home | None |
-| ACTION_DIAL | ohos.want.action.dial | None |
-| ACTION_SEARCH | ohos.want.action.search | None |
-| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | None |
-| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | None |
-| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None |
-| ACTION_SET_ALARM | ohos.want.action.setAlarm | None |
-| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | None |
-| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | None |
-| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | None |
-| ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | None |
-| ACTION_SEND_SMS | ohos.want.action.sendSms | None |
-| ACTION_CHOOSE | ohos.want.action.choose | None |
-| ACTION_IMAGE_CAPTURE8+ | ohos.want.action.imageCapture | None |
-| ACTION_VIDEO_CAPTUR8+ | ohos.want.action.videoCapture | None |
-| ACTION_SELECT | ohos.want.action.select | None |
-| ACTION_SEND_DATA | ohos.want.action.sendData | None |
-| ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | None |
-| ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | None |
-| ACTION_VIEW_DATA | ohos.want.action.viewData | None |
-| ACTION_EDIT_DATA | ohos.want.action.editData | None |
-| INTENT_PARAMS_INTENT | ability.want.params.INTENT | None |
-| INTENT_PARAMS_TITLE | ability.want.params.TITLE | None |
-| ACTION_FILE_SELECT7+ | ohos.action.fileSelect | None |
-| PARAMS_STREAM7+ | ability.params.stream | None |
-| ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | None |
+| ACTION_HOME | ohos.want.action.home | Action of returning to the home page. |
+| ACTION_DIAL | ohos.want.action.dial | Action of launching the numeric keypad. |
+| ACTION_SEARCH | ohos.want.action.search | Action of launching the search function. |
+| ACTION_WIRELESS_SETTINGS | ohos.settings.wireless | Action of launching the UI that provides radio network settings, for example, Wi-Fi option. |
+| ACTION_MANAGE_APPLICATIONS_SETTINGS | ohos.settings.manage.applications | Action of launching the UI for managing installed applications. |
+| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | Action of launching the UI that displays the details of an application. |
+| ACTION_SET_ALARM | ohos.want.action.setAlarm | Action of launching the UI for setting the alarm clock. |
+| ACTION_SHOW_ALARMS | ohos.want.action.showAlarms | Action of launching the UI that displays all clock alarms. |
+| ACTION_SNOOZE_ALARM | ohos.want.action.snoozeAlarm | Action of launching the UI for snoozing an alarm. |
+| ACTION_DISMISS_ALARM | ohos.want.action.dismissAlarm | Action of launching the UI for deleting an alarm. |
+| ACTION_DISMISS_TIMER | ohos.want.action.dismissTimer | Action of launching the UI for dismissing a timer. |
+| ACTION_SEND_SMS | ohos.want.action.sendSms | Action of launching the UI for sending an SMS. |
+| ACTION_CHOOSE | ohos.want.action.choose | Action of launching the UI for openning a contact or picture. |
+| ACTION_IMAGE_CAPTURE8+ | ohos.want.action.imageCapture | Action of launching the UI for photographing. |
+| ACTION_VIDEO_CAPTURE8+ | ohos.want.action.videoCapture | Action of launching the UI for shooting a video. |
+| ACTION_SELECT | ohos.want.action.select | Action of launching the UI for application selection. |
+| ACTION_SEND_DATA | ohos.want.action.sendData | Action of launching the UI for sending a single data record. |
+| ACTION_SEND_MULTIPLE_DATA | ohos.want.action.sendMultipleData | Action of launching the UI for sending multiple data records. |
+| ACTION_SCAN_MEDIA_FILE | ohos.want.action.scanMediaFile | Action of requesting a media scanner to scan a file and add the file to the media library. |
+| ACTION_VIEW_DATA | ohos.want.action.viewData | Action of viewing data. |
+| ACTION_EDIT_DATA | ohos.want.action.editData | Action of editing data. |
+| INTENT_PARAMS_INTENT | ability.want.params.INTENT | Action of displaying selection options with an action selector. |
+| INTENT_PARAMS_TITLE | ability.want.params.TITLE | Title of the character sequence dialog box used with the action selector. |
+| ACTION_FILE_SELECT7+ | ohos.action.fileSelect | Action of selecting a file. |
+| PARAMS_STREAM7+ | ability.params.stream | URI of the data stream associated with the target when the data is sent. |
+| ACTION_APP_ACCOUNT_OAUTH 8+ | ohos.account.appAccount.action.oauth | Action of providing the OAuth service. |
+| ACTION_MARKER_DOWNLOAD 9+ | ohos.want.action.marketDownload | Action of downloading an application from the application market.
**System API**: This is a system API and cannot be called by third-party applications. |
## wantConstant.Entity
-**System capability**: SystemCapability.Ability.AbilityBase
+Enumerates the entity constants of the **Want** object.
-Lists the permissions.
+**System capability**: SystemCapability.Ability.AbilityBase
-| Common Event Macro | Common Event Name | Subscriber Permission |
+| Name | Value | Description |
| ------------ | ------------------ | ---------------------- |
-| ENTITY_DEFAULT | entity.system.default | None |
-| ENTITY_HOME | entity.system.homel | None |
-| ENTITY_VOICE | ENTITY_VOICE | None |
-| ENTITY_BROWSABLE | entity.system.browsable | None |
-| ENTITY_VIDEO | entity.system.video | None |
-| ACTION_APPLICATION_DETAILS_SETTINGS | ohos.settings.application.details | None |
+| ENTITY_DEFAULT | entity.system.default | Default entity. The default entity is used if no entity is specified. |
+| ENTITY_HOME | entity.system.home | Home screen entity. |
+| ENTITY_VOICE | entity.system.voice | Voice interaction entity. |
+| ENTITY_BROWSABLE | entity.system.browsable | Browser type entity. |
+| ENTITY_VIDEO | entity.system.video | Video type entity. |
+
+## wantConstant.Flags
-## flags
+Describes flags.
**System capability**: SystemCapability.Ability.AbilityBase
| Name | Value | Description |
| ------------------------------------ | ---------- | ------------------------------------------------------------ |
| FLAG_AUTH_READ_URI_PERMISSION | 0x00000001 | Indicates the permission to read the URI. |
-| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write the URI. |
+| FLAG_AUTH_WRITE_URI_PERMISSION | 0x00000002 | Indicates the permission to write data to the URI. |
| FLAG_ABILITY_FORWARD_RESULT | 0x00000004 | Returns the result to the ability. |
| FLAG_ABILITY_CONTINUATION | 0x00000008 | Indicates whether the ability on the local device can be continued on a remote device. |
| FLAG_NOT_OHOS_COMPONENT | 0x00000010 | Indicates that a component does not belong to OHOS. |
| FLAG_ABILITY_FORM_ENABLED | 0x00000020 | Indicates that an ability is enabled. |
-| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent. |
-| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching. |
+| FLAG_AUTH_PERSISTABLE_URI_PERMISSION | 0x00000040 | Indicates the permission to make the URI persistent.
**System API**: This is a system API and cannot be called by third-party applications. |
+| FLAG_AUTH_PREFIX_URI_PERMISSION | 0x00000080 | Indicates the permission to verify URIs by prefix matching.
**System API**: This is a system API and cannot be called by third-party applications.|
| FLAG_ABILITYSLICE_MULTI_DEVICE | 0x00000100 | Supports cross-device startup in a distributed scheduler. |
| FLAG_START_FOREGROUND_ABILITY | 0x00000200 | Indicates that the Service ability is started regardless of whether the host application has been started. |
-| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible. |
+| FLAG_ABILITY_CONTINUATION_REVERSIBLE | 0x00000400 | Indicates that ability continuation is reversible.
**System API**: This is a system API and cannot be called by third-party applications. |
| FLAG_INSTALL_ON_DEMAND | 0x00000800 | Indicates that the specific ability will be installed if it has not been installed. |
| FLAG_INSTALL_WITH_BACKGROUND_MODE | 0x80000000 | Indicates that the specific ability will be installed in the background if it has not been installed. |
| FLAG_ABILITY_CLEAR_MISSION | 0x00008000 | Clears other operation missions. This flag can be set for the **Want** object in the **startAbility** API passed to [ohos.app.Context](js-apis-ability-context.md) and must be used together with **flag_ABILITY_NEW_MISSION**.|
diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
index 5a21d564110cdf922e344c52ded3bd8d44604b2f..2b17d252af9d09d5519f36ece4306834e8085c5a 100644
--- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
+++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
@@ -1,6 +1,6 @@
# Ability Access Control
-Provides program permission management capabilities, including authentication, authorization, and revocation.
+The **AbilityAccessCtrl** module provides APIs for application permission management, including authentication, authorization, and revocation.
> **NOTE**
>
@@ -69,6 +69,36 @@ promise.then(data => {
});
```
+### verifyAccessTokenSync9+
+
+verifyAccessTokenSync(tokenID: number, permissionName: string): GrantStatus
+
+Checks whether an application has been granted the specified permission. This API synchronously returns the result.
+
+**System capability**: SystemCapability.Security.AccessToken
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------- | ---- | ------------------------------------------ |
+| tokenID | number | Yes | ID of the application. |
+| permissionName | string | Yes | Name of the permission to verify.|
+
+**Return value**
+
+| Type | Description |
+| :------------ | :---------------------------------- |
+| [GrantStatus](#grantstatus) | Permission grant state.|
+
+**Example**
+
+```js
+var AtManager = abilityAccessCtrl.createAtManager();
+let tokenID = 0;
+let data = verifyAccessTokenSync(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
+console.log(`data->${JSON.stringify(data)}`);
+```
+
### grantUserGrantedPermission
grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFlag: number): Promise<number>
diff --git a/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md b/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md
index a609e0df688e7a9cc5b32ea25907eda95ab14c47..d30dce2a75e700019c9f44ce1c918a9574f3cea7 100644
--- a/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md
+++ b/en/application-dev/reference/apis/js-apis-abilityDelegatorRegistry.md
@@ -1,5 +1,7 @@
# AbilityDelegatorRegistry
+The **AbilityDelegatorRegistry** module provides APIs for storing the global registers of the registered **AbilityDelegator** and **AbilityDelegatorArgs** objects. You can use the APIs to obtain the **AbilityDelegator** and **AbilityDelegatorArgs** objects of an application.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -24,8 +26,6 @@ Enumerates the ability lifecycle states.
| BACKGROUND | 3 | The ability is running in the background. |
| DESTROY | 4 | The ability is destroyed.|
-
-
## AbilityDelegatorRegistry.getAbilityDelegator
getAbilityDelegator(): AbilityDelegator
diff --git a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md
index 508463e3a428fffe336de4ae2c986623fb54d3b1..098f4ebba840a13d1f37d6e14256fcc9695f2a8d 100644
--- a/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md
+++ b/en/application-dev/reference/apis/js-apis-abilityrunninginfo.md
@@ -1,17 +1,11 @@
# AbilityRunningInfo
+The **AbilityRunningInfo** module implements ability running information and ability states.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-Provides ability running information.
-
-## Modules to Import
-
-```js
-import abilitymanager from '@ohos.application.abilityManager';
-```
-
## Usage
The ability running information is obtained by using the **getAbilityRunningInfos** API in **abilityManager**.
@@ -27,26 +21,13 @@ abilitymanager.getAbilityRunningInfos((err,data) => {
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System API**: This is a system API and cannot be called by third-party applications.
+
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| ability | ElementName | Yes| No| Information that matches an ability. |
-| pid | number | Yes| No| Process ID.|
-| uid | number | Yes| No| User ID. |
-| processName | string | Yes| No| Process name. |
-| startTime | number | Yes| No| Ability start time. |
-| abilityState | [abilityManager.AbilityState](#abilitymanagerabilitystate) | Yes| No| Ability state. |
-
-
-## abilityManager.AbilityState
-
-Enumerates the ability states.
-
-**System capability**: SystemCapability.Ability.AbilityRuntime.Core
-
-| Name| Value| Description|
-| -------- | -------- | -------- |
-| INITIAL | 0 | The ability is in the initial state.|
-| FOREGROUND | 9 | The ability is in the foreground state. |
-| BACKGROUND | 10 | The ability is in the background state. |
-| FOREGROUNDING | 11 | The ability is in the foregrounding state. |
-| BACKGROUNDING | 12 | The ability is in the backgrounding state. |
+| ability | ElementName | Yes| No| Information that matches an ability. |
+| pid | number | Yes| No| Process ID.|
+| uid | number | Yes| No| User ID. |
+| processName | string | Yes| No| Process name. |
+| startTime | number | Yes| No| Ability start time. |
+| abilityState | [abilityManager.AbilityState](js-apis-application-abilityManager.md#abilitystate) | Yes| No| Ability state. |
diff --git a/en/application-dev/reference/apis/js-apis-abilitystagecontext.md b/en/application-dev/reference/apis/js-apis-abilitystagecontext.md
index 65705aae3936cc2c9e9643f6142be6de6564124b..5475dc51466d01d8eadef472248cce237f1b6241 100644
--- a/en/application-dev/reference/apis/js-apis-abilitystagecontext.md
+++ b/en/application-dev/reference/apis/js-apis-abilitystagecontext.md
@@ -1,18 +1,14 @@
# AbilityStageContext
+The **AbilityStageContext** module, inherited from [Context](js-apis-application-context.md), implements the context of an ability stage.
+
+This module provides APIs for accessing a specific ability stage. You can use the APIs to obtain the **ModuleInfo** object and environment configuration of an ability stage.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-Implements the context of an ability stage. This module is inherited from [Context](js-apis-application-context.md).
-
-## Modules to Import
-
-```js
-import AbilityStage from '@ohos.application.AbilityStage';
-```
-
## Usage
The ability stage context is obtained through an **AbilityStage** instance.
diff --git a/en/application-dev/reference/apis/js-apis-accessibility.md b/en/application-dev/reference/apis/js-apis-accessibility.md
index 17ef631d0f7207b676177a59d0903cc77dcd1045..f9d286cbd34296fa43596032fe89f2ecdd6e5d93 100644
--- a/en/application-dev/reference/apis/js-apis-accessibility.md
+++ b/en/application-dev/reference/apis/js-apis-accessibility.md
@@ -1,6 +1,9 @@
# Accessibility
-> **NOTE**
+The **Accessibility** module implements the accessibility functions, including obtaining the accessibility application list, accessibility application enabled status, and captions configuration.
+
+> **NOTE**
+>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -13,162 +16,162 @@ import accessibility from '@ohos.accessibility';
Enumerates the states of an accessibility application.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- | Name | Description |
- | -------- | -------- |
- | enable | The accessibility application is enabled. |
- | disable | The accessibility application is disabled. |
- | install | The accessibility application has been installed. |
+| Name| Description|
+| -------- | -------- |
+| enable | The accessibility application is enabled.|
+| disable | The accessibility application is disabled.|
+| install | The accessibility application has been installed.|
## AbilityType
Enumerates the types of accessibility applications.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- | Name | Description |
- | -------- | -------- |
- | audible | The accessibility application provides audible feedback. |
- | generic | The accessibility application provides generic feedback. |
- | haptic | The accessibility application provides haptic feedback. |
- | spoken | The accessibility application provides spoken feedback. |
- | visual | The accessibility application provides visual feedback. |
+| Name| Description|
+| -------- | -------- |
+| audible | The accessibility application provides audible feedback.|
+| generic | The accessibility application provides generic feedback.|
+| haptic | The accessibility application provides haptic feedback.|
+| spoken | The accessibility application provides spoken feedback.|
+| visual | The accessibility application provides visual feedback.|
+| all9+ | All the preceding types.|
## AccessibilityAbilityInfo
Provides information about an accessibility application.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
- | Name | Type | Readable | Writable | Description |
- | -------- | -------- | -------- | -------- | -------- |
- | id | number | Yes | No | Ability ID. |
- | name | string | Yes | No | Ability name. |
- | bundleName | string | Yes | No | Bundle name. |
- | abilityTypes | Array<[AbilityType](#abilitytype)> | Yes | No | Accessibility application type. |
- | capabilities | Array<[Capability](#capability)> | Yes | No | Capabilities list of the accessibility application. |
- | description | string | Yes | No | Description of the accessibility application. |
- | eventTypes | Array<[EventType](#eventtype)> | Yes | No | List of events that the accessibility application focuses on. |
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| id | number | Yes| No| Ability ID.|
+| name | string | Yes| No| Ability name.|
+| bundleName | string | Yes| No| Bundle name.|
+| targetBundleNames9+ | Array<string> | Yes| No| Name of the target bundle.|
+| abilityTypes | Array<[AbilityType](#abilitytype)> | Yes| No| Accessibility application type.|
+| capabilities | Array<[Capability](#capability)> | Yes| No| Capabilities list of the accessibility application.|
+| description | string | Yes| No| Description of the accessibility application.|
+| eventTypes | Array<[EventType](#eventtype)> | Yes| No| List of events that the accessibility application focuses on.|
## Action
Describes the target action supported by an accessibility application.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
-
- | Name | Description |
- | -------- | -------- |
- | click | Clicking. |
- | longClick | Long pressing. |
- | scrollForward | Scrolling forward. |
- | scrollBackward | Scrolling backward. |
- | focus | Obtaining focus. |
- | clearFocus | Clearing focus. |
- | clearSelection | Clearing selection. |
- | accessibilityFocus | Obtaining the accessibility focus. |
- | clearAccessibilityFocus | Clearing the accessibility focus. |
- | cut | Cut. |
- | copy | Copy. |
- | paste | Paste. |
- | select | Select. |
- | setText | Setting the text. |
- | delete | Delete. |
- | setSelection | Setting the selection. |
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
+
+| Name| Description|
+| -------- | -------- |
+| click | Clicking.|
+| longClick | Long pressing.|
+| scrollForward | Scrolling forward.|
+| scrollBackward | Scrolling backward.|
+| focus | Obtaining focus.|
+| clearFocus | Clearing focus.|
+| clearSelection | Clearing selection.|
+| accessibilityFocus | Obtaining the accessibility focus.|
+| clearAccessibilityFocus | Clearing the accessibility focus.|
+| cut | Cut.|
+| copy | Copy.|
+| paste | Paste.|
+| select | Select.|
+| setText | Setting the text.|
+| delete | Delete.|
+| setSelection | Setting the selection.|
## Capability
Enumerates the capabilities of an auxiliary application.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- | Name | Description |
- | -------- | -------- |
- | retrieve | Capability to retrieve the window content. |
- | touchGuide | Capability of touch guide mode. |
- | keyEventObserver | Capability to filter key events. |
- | zoom | Capability to control the display zoom level. |
- | gesture | Capability to perform gesture actions. |
+| Name| Description|
+| -------- | -------- |
+| retrieve | Capability to retrieve the window content.|
+| touchGuide | Capability of touch guide mode.|
+| keyEventObserver | Capability to filter key events.|
+| zoom | Capability to control the display zoom level.|
+| gesture | Capability to perform gesture actions.|
## CaptionsFontEdgeType8+
-Enumerates the caption font edge type.
+Enumerates the font edge types of captions.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing
+**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing
- | Name | Description |
- | -------- | -------- |
- | none | No effect. |
- | raised | Raised effect. |
- | depressed | Depressed effect. |
- | uniform | Uniform effect. |
- | dropShadow | Drop shadow effect. |
+| Name| Description|
+| -------- | -------- |
+| none | No effect.|
+| raised | Raised effect.|
+| depressed | Depressed effect.|
+| uniform | Uniform effect.|
+| dropShadow | Drop shadow effect.|
## CaptionsFontFamily8+
-Enumerates the caption font families.
+Enumerates the font families of captions.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing
+**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing
- | Name | Description |
- | -------- | -------- |
- | default | Default font family. |
- | monospacedSerif | Monospaced Serif fonts, which use the same width for each character. |
- | serif | Serif fonts. |
- | monospacedSansSerif | Monospaced Sans Serif fonts, which use the same width for each character. |
- | sansSerif | Sans Serif fonts. |
- | casual | Casual fonts. |
- | cursive | Cursive fonts. |
- | smallCapitals | Small caps fonts. |
+| Name| Description|
+| -------- | -------- |
+| default | Default font family.|
+| monospacedSerif | Monospaced Serif fonts, which use the same width for each character.|
+| serif | Serif fonts.|
+| monospacedSansSerif | Monospaced Sans Serif fonts, which use the same width for each character.|
+| sansSerif | Sans Serif fonts.|
+| casual | Casual fonts.|
+| cursive | Cursive fonts.|
+| smallCapitals | Small caps fonts.|
## CaptionsStyle8+
-Describes the caption style.
+Describes the style of captions.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing
+**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing
- | Name | Type | Readable | Writable | Description |
- | -------- | -------- | -------- | -------- | -------- |
- | fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes | No | Font family of the captions. |
- | fontScale | number | Yes | No | Font scale of the captions. |
- | fontColor | number \ | string | Yes | No | Font color of the captions. |
- | fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes | No | Font edge type of the captions. |
- | backgroundColor | number \ | string | Yes | No | Background color of the captions. |
- | windowColor | number \ | string | Yes | No | Window color of the captions. |
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| fontFamily | [CaptionsFontFamily](#captionsfontfamily8) | Yes| No| Font family of captions.|
+| fontScale | number | Yes| No| Font scale of captions.|
+| fontColor | number \| string | Yes| No| Font color of captions.|
+| fontEdgeType | [CaptionsFontEdgeType](#captionsfontedgetype8) | Yes| No| Font edge type of captions.|
+| backgroundColor | number \| string | Yes| No| Background color of captions.|
+| windowColor | number \| string | Yes| No| Window color of captions.|
## CaptionsManager8+
-Implements caption configuration management.
+Implements configuration management for captions.
-### Attributes
+**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing
- | Name | Type | Readable | Writable | Description |
- | -------- | -------- | -------- | -------- | -------- |
- | enabled | boolean | Yes | No | Whether to enable caption configuration. |
- | style | [CaptionsStyle](#captionsstyle8) | Yes | No | Caption style. |
+### Attributes
-### Methods
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| enabled | boolean | Yes| No| Whether to enable captions configuration.|
+| style | [CaptionsStyle](#captionsstyle8) | Yes| No| Style of captions.|
-In the following API examples, you must first use the [accessibility.getCaptionsManager()](#accessibilitygetcaptionsmanager8) method to obtain a **captionsManager** instance, and then call the methods using the obtained instance.
+In the following API examples, you must first use the [accessibility.getCaptionsManager()](#accessibilitygetcaptionsmanager8) API to obtain a **captionsManager** instance, and then call the methods using the obtained instance.
-#### on('enableChange')
+### on('enableChange')
on(type: 'enableChange', callback: Callback<boolean>): void;
-Enables listening for enable status changes of caption configuration.
-
-**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing
+Enables listening for enabled status changes of captions configuration.
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | type | string | Yes | Type of the event to listen for, which is set to **enableChange** in this API. |
- | callback | Callback<boolean> | Yes | Callback invoked when the enable status of caption configuration changes. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Type of the event to listen for, which is set to **enableChange** in this API.|
+ | callback | Callback<boolean> | Yes| Callback invoked when the enabled status of captions configuration changes.|
-- Example
+- **Example**
```typescript
captionsManager.on('enableChange',(data) => {
@@ -176,22 +179,20 @@ Enables listening for enable status changes of caption configuration.
})
```
-#### on('styleChange')
+### on('styleChange')
on(type: 'styleChange', callback: Callback<CaptionsStyle>): void;
-Enables listening for caption style changes.
-
-**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing
+Enables listening for captions style changes.
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | type | string | Yes | Type of the event to listen for, which is set to **styleChange** in this API. |
- | callback | Callback<[CaptionsStyle](#captionsstyle8)> | Yes | Callback invoked when the caption style changes. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Type of the event to listen for, which is set to **styleChange** in this API.|
+ | callback | Callback<[CaptionsStyle](#captionsstyle8)> | Yes| Callback invoked when the style of captions changes.|
-- Example
+- **Example**
```typescript
captionsManager.on('styleChange',(data) => {
@@ -199,43 +200,39 @@ Enables listening for caption style changes.
})
```
-#### off('enableChange')
+### off('enableChange')
off(type: 'enableChange', callback?: Callback<boolean>): void;
-Disables listening for enable status changes of caption configuration.
-
-**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing
+Disables listening for enabled status changes of captions configuration.
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | type | string | Yes | Type of the event to listen for, which is set to **enableChange** in this API. |
- | callback | Callback<boolean> | No | Callback invoked when the enable status of caption configuration changes. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Type of the event to listen for, which is set to **enableChange** in this API.|
+ | callback | Callback<boolean> | No| Callback invoked when the enabled status of captions configuration changes.|
-- Example
+- **Example**
```typescript
captionsManager.off('enableChange')
```
-#### off('styleChange')
+### off('styleChange')
off(type: 'styleChange', callback?: Callback<CaptionsStyle>): void;
-Disables listening for caption style changes.s is removed.
-
-**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing
+Disables listening for captions style changes.
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | type | string | Yes | Type of the event to listen for, which is set to **styleChange** in this API. |
- | callback | Callback<[CaptionsStyle](#captionsstyle8)> | No | Callback invoked when the caption style changes. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Type of the event to listen for, which is set to **styleChange** in this API.|
+ | callback | Callback<[CaptionsStyle](#captionsstyle8)> | No| Callback invoked when the style of captions changes.|
-- Example
+- **Example**
```typescript
captionsManager.off('styleChange')
@@ -245,80 +242,92 @@ Disables listening for caption style changes.s is removed.
Describes a GUI change event.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
### Attributes
- | Name | Type | Readable | Writable | Description |
- | -------- | -------- | -------- | -------- | -------- |
- | type | [EventType](#eventtype) | Yes | Yes | Accessibility event type. |
- | windowUpdateType | [WindowUpdateType](#windowupdatetype) | Yes | Yes | Window update type. |
- | bundleName | string | Yes | Yes | Target application name. |
- | componentType | string | Yes | Yes | Type of the event source component, for example, button or chart. |
- | pageId | number | Yes | Yes | Page ID of the event source. |
- | description | string | Yes | Yes | Event description. |
- | triggerAction | [Action](#action) | Yes | Yes | Action that triggers the event. |
- | textMoveUnit | [TextMoveUnit](#textmoveunit) | Yes | Yes | Text movement unit. |
- | contents | Array<string> | Yes | Yes | Array of contents. |
- | lastContent | string | Yes | Yes | Latest content. |
- | beginIndex | number | Yes | Yes | Sequence number of the first item displayed on the page. |
- | currentIndex | number | Yes | Yes | Sequence number of the current item. |
- | endIndex | number | Yes | Yes | Sequence number of the last item displayed on the page. |
- | itemCount | number | Yes | Yes | Total number of items. |
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| type | [EventType](#eventtype) | Yes| Yes| Accessibility event type.|
+| windowUpdateType | [WindowUpdateType](#windowupdatetype) | Yes| Yes| Window update type.|
+| bundleName | string | Yes| Yes| Target application name.|
+| componentType | string | Yes| Yes| Type of the event source component, for example, button or chart.|
+| pageId | number | Yes| Yes| Page ID of the event source.|
+| description | string | Yes| Yes| Event description.|
+| triggerAction | [Action](#action) | Yes| Yes| Action that triggers the event.|
+| textMoveUnit | [TextMoveUnit](#textmoveunit) | Yes| Yes| Text movement unit.|
+| contents | Array<string> | Yes| Yes| Array of contents.|
+| lastContent | string | Yes| Yes| Latest content.|
+| beginIndex | number | Yes| Yes| Sequence number of the first item displayed on the page.|
+| currentIndex | number | Yes| Yes| Sequence number of the current item.|
+| endIndex | number | Yes| Yes| Sequence number of the last item displayed on the page.|
+| itemCount | number | Yes| Yes| Total number of items.|
+
+### constructor
+
+constructor(jsonObject)
+
+Implements a constructor.
+
+- **Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | jsonObject | string | Yes| JSON string required for creating an object.|
+
+- **Example**
+
+ ```typescript
+ let eventInfo = new accessibility.EventInfo({"type":"click","bundleName":"com.example.MyApplication","triggerAction":"click"})
+ ```
## EventType
Enumerates accessibility event types.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
-
- | Name | Description |
- | -------- | -------- |
- | click | Event of clicking a component. |
- | longClick | Event of long-pressing a component. |
- | select | Event of selecting a component. |
- | focus | Event indicating that the component obtains the focus. |
- | textUpdate | Event indicating that the component text has been updated. |
- | hoverEnter | Event indicating that the hover enters a component. |
- | hoverExit | Event indicating that the hover exits a component. |
- | scroll | Event of the scroll view. |
- | textSelectionUpdate | Event indicating that the selected text has been updated. |
- | accessibilityFocus | Event indicating that the accessibility focus has been obtained. |
- | accessibilityFocusClear | Event indicating that the accessibility focus has been cleared. |
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
+
+| Name| Description|
+| -------- | -------- |
+| click | Event of clicking a component.|
+| longClick | Event of long-pressing a component.|
+| select | Event of selecting a component.|
+| focus | Event indicating that the component obtains the focus.|
+| textUpdate | Event indicating that the component text has been updated.|
+| hoverEnter | Event indicating that the hover enters a component.|
+| hoverExit | Event indicating that the hover exits a component.|
+| scroll | Event of the scroll view.|
+| textSelectionUpdate | Event indicating that the selected text has been updated.|
+| accessibilityFocus | Event indicating that the accessibility focus has been obtained.|
+| accessibilityFocusClear | Event indicating that the accessibility focus has been cleared.|
## TextMoveUnit
Enumerates the movement units for traversing the node text.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- | Name | Description |
- | -------- | -------- |
- | char | The movement unit for traversing the node text is by character. |
- | word | The movement unit for traversing the node text is by word. |
- | line | The movement unit for traversing the node text is by line. |
- | page | The movement unit for traversing the node text is by page. |
- | paragraph | The movement unit for traversing the node text is by paragraph. |
+| Name| Description|
+| -------- | -------- |
+| char | The movement unit for traversing the node text is by character.|
+| word | The movement unit for traversing the node text is by word.|
+| line | The movement unit for traversing the node text is by line.|
+| page | The movement unit for traversing the node text is by page.|
+| paragraph | The movement unit for traversing the node text is by paragraph.|
## WindowUpdateType
Enumerates window update types.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
-
- | Name | Description |
- | -------- | -------- |
- | add | Window adding. |
- | remove | Window deletion. |
- | title | Window title change. |
- | bounds | Window boundary change. |
- | layer | Window layer change. |
- | active | Window activity change. |
- | focus | Window focus change. |
- | accessibilityFocus | Window accessibility focus change. |
- | parent | Parent window change. |
- | children | Child window change. |
- | pip | Picture-in-picture (PIP) mode change. |
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
+
+| Name| Description|
+| -------- | -------- |
+| add | Window adding.|
+| remove | Window deletion.|
+| bounds | Window boundary change.|
+| active | Window activity change.|
+| focus | Window focus change.|
## accessibility.getAbilityLists
@@ -326,22 +335,22 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState): Promise<A
Obtains the accessibility application list. This API uses a promise to return the result.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | abilityType | [AbilityType](#abilitytype) | Yes | Accessibility application type. |
- | stateType | [AbilityState](#abilitystate) | Yes | Accessibility application status. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | abilityType | [AbilityType](#abilitytype) | Yes| Accessibility application type.|
+ | stateType | [AbilityState](#abilitystate) | Yes| Accessibility application status.|
-- Return value
+- **Return value**
- | Type | Description |
- | -------- | -------- |
- | Promise<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Promise used to return the accessibility application list. |
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Promise used to return the accessibility application list.|
-- Example
+- **Example**
```typescript
accessibility.getAbilityLists("spoken", "enable")
@@ -369,17 +378,17 @@ getAbilityLists(abilityType: AbilityType, stateType: AbilityState,callback: Asyn
Obtains the accessibility application list. This API uses an asynchronous callback to return the result.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | abilityType | [AbilityType](#abilitytype) | Yes | Accessibility application type. |
- | stateType | [AbilityState](#abilitystate) | Yes | Accessibility application status. |
- | callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Yes | Callback used to return the accessibility application list. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | abilityType | [AbilityType](#abilitytype) | Yes| Accessibility application type.|
+ | stateType | [AbilityState](#abilitystate) | Yes| Accessibility application status.|
+ | callback | AsyncCallback<Array<[AccessibilityAbilityInfo](#accessibilityabilityinfo)>> | Yes| Callback used to return the accessibility application list.|
-- Example
+- **Example**
```typescript
accessibility.getAbilityLists("visual", "enable", (err, data) => {
@@ -406,17 +415,17 @@ Obtains the accessibility application list. This API uses an asynchronous callba
getCaptionsManager(): CaptionsManager
-Obtains the accessibility caption configuration.
+Obtains the captions configuration.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Hearing
+**System capability**: SystemCapability.BarrierFree.Accessibility.Hearing
-- Return value
+- **Return value**
- | Type | Description |
- | -------- | -------- |
- | [CaptionsManager](#captionsmanager8) | Accessibility caption configuration. |
+ | Type| Description|
+ | -------- | -------- |
+ | [CaptionsManager](#captionsmanager8) | Captions configuration.|
-- Example
+- **Example**
```typescript
captionsManager = accessibility.getCaptionsManager()
@@ -430,12 +439,12 @@ Enables listening for the accessibility application or touch guide mode status c
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | type | string | Yes | Type of the event to listen for.
- **accessibilityStateChange** means to listen for enable status changes of the accessibility application.
**System capability**: SystemCapability.Barrierfree.Accessibility.Core
- **touchGuideStateChange** means to listen for enable status changes of the touch guide mode.
**System capability**: SystemCapability.Barrierfree.Accessibility.Vision |
- | callback | Callback<boolean> | Yes | Callback invoked when the enable status changes. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Type of the event to listen for.
- **'accessibilityStateChange'** means to listen for enabled status changes of the accessibility application.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- **'touchGuideStateChange'** means to listen for enabled status changes of the touch guide mode.
**System capability**: SystemCapability.BarrierFree.Accessibility.Vision|
+ | callback | Callback<boolean> | Yes| Callback invoked when the enabled status of captions configuration changes.|
-- Example
+- **Example**
```typescript
accessibility.on('accessibilityStateChange',(data) => {
@@ -447,18 +456,16 @@ Enables listening for the accessibility application or touch guide mode status c
off(type: 'accessibilityStateChange ' | 'touchGuideStateChange', callback?: Callback<boolean>): void
-Disables listening for the accessibility application or touch guide mode status changes.
-
-
+Disables listening for the accessibility application or touch guide mode status changes.
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | type | string | No | Type of the event to listen for.
- **accessibilityStateChange** means to listen for enable status changes of the accessibility application.
**System capability**: SystemCapability.Barrierfree.Accessibility.Core
- **touchGuideStateChange** means to listen for enable status changes of the touch guide mode.
**System capability**: SystemCapability.Barrierfree.Accessibility.Vision |
- | callback | Callback<boolean> | No | Callback invoked when the enable status changes. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | No| Type of the event to listen for.
- **'accessibilityStateChange'** means to listen for enabled status changes of the accessibility application.
**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- **'touchGuideStateChange'** means to listen for enabled status changes of the touch guide mode.
**System capability**: SystemCapability.BarrierFree.Accessibility.Vision|
+ | callback | Callback<boolean> | No| Callback invoked when the enabled status changes.|
-- Example
+- **Example**
```typescript
accessibility.off('accessibilityStateChange',(data) => {
@@ -472,15 +479,15 @@ isOpenAccessibility(): Promise<boolean>
Checks whether accessibility is enabled. This API uses a promise to return the result.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
-- Return value
+- **Return value**
- | Type | Description |
- | -------- | -------- |
- | Promise<boolean> | Returns **true** if accessibility is enabled; returns **false** otherwise. |
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<boolean> | Returns **true** if accessibility is enabled; returns **false** otherwise.|
-- Example
+- **Example**
```typescript
accessibility.isOpenAccessibility()
@@ -497,15 +504,15 @@ isOpenAccessibility(callback: AsyncCallback<boolean>): void
Checks whether accessibility is enabled. This API uses an asynchronous callback to return the result.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
-- Parameters
+- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Returns **true** if accessibility is enabled; returns **false** otherwise. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if accessibility is enabled; returns **false** otherwise.|
-- Example
+- **Example**
```typescript
accessibility.isOpenAccessibility((err, data) => {
@@ -523,15 +530,15 @@ isOpenTouchGuide(): Promise<boolean>
Checks whether touch guide mode is enabled. This API uses a promise to return the result.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Vision
-- Return value
+- **Return value**
- | Type | Description |
- | -------- | -------- |
- | Promise<boolean> | Returns **true** if touch guide mode is enabled; returns **false** otherwise. |
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<boolean> | Returns **true** if touch guide mode is enabled; returns **false** otherwise.|
-- Example
+- **Example**
```typescript
accessibility.isOpenTouchGuide()
@@ -548,15 +555,15 @@ isOpenTouchGuide(callback: AsyncCallback<boolean>): void
Checks whether touch guide mode is enabled. This API uses an asynchronous callback to return the result.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Vision
-- Parameters
+- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<boolean> | Yes | Callback used to return the result. Returns **true** if touch guide mode is enabled; returns **false** otherwise. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. Returns **true** if touch guide mode is enabled; returns **false** otherwise.|
-- Example
+- **Example**
```typescript
accessibility.isOpenTouchGuide((err, data) => {
@@ -574,21 +581,21 @@ sendEvent(event: EventInfo): Promise<void>
Sends an accessibility event. This API uses a promise to return the result.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | event | [EventInfo](#eventinfo) | Yes | Accessibility event. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | event | [EventInfo](#eventinfo) | Yes| Accessibility event.|
-- Return value
+- **Return value**
- | Type | Description |
- | -------- | -------- |
- | Promise<void> | Promise used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise. |
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<void> | Promise used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise.|
-- Example
+- **Example**
```typescript
accessibility.sendEvent(this.eventInfo)
@@ -605,16 +612,16 @@ sendEvent(event: EventInfo, callback: AsyncCallback<void>): void
Sends an accessibility event. This API uses an asynchronous callback to return the result.
-**System capability**: SystemCapability.Barrierfree.Accessibility.Core
+**System capability**: SystemCapability.BarrierFree.Accessibility.Core
- **Parameters**
- | Name | Type | Mandatory | Description |
- | -------- | -------- | -------- | -------- |
- | event | [EventInfo](#eventinfo) | Yes | Accessibility event. |
- | callback | AsyncCallback<void> | Yes | Callback used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | event | [EventInfo](#eventinfo) | Yes| Accessibility event.|
+ | callback | AsyncCallback<void> | Yes| Callback used to return the result. Returns data if the accessibility event is sent successfully; returns an error otherwise.|
-- Example
+- **Example**
```typescript
accessibility.sendEvent(this.eventInfo,(err, data) => {
diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md
index 60f404c4b0510809a4c1d515c3cc99c184796ab9..2a3dc0d9e34fd7ba2dd3e37c018292bec6da8be9 100644
--- a/en/application-dev/reference/apis/js-apis-appAccount.md
+++ b/en/application-dev/reference/apis/js-apis-appAccount.md
@@ -21,7 +21,7 @@ Creates an **AppAccountManager** instance.
**System capability**: SystemCapability.Account.AppAccount
-**Return Value**
+**Return value**
| Type | Description |
| ----------------- | ------------ |
@@ -102,7 +102,7 @@ Adds an app account name and additional information (information that can be con
| name | string | Yes | Name of the app account to add. |
| extraInfo | string | Yes | Additional information to add. The additional information cannot contain sensitive information, such as the app account password.|
-**Return Value**
+**Return value**
| Type | Description |
| ------------------- | --------------------- |
@@ -198,7 +198,7 @@ Deletes an app account from the **AppAccountManager** service. This API uses a p
| ---- | ------ | ---- | ----------- |
| name | string | Yes | Name of the app account to delete.|
-**Return Value**
+**Return value**
| Type | Description |
| :------------------ | :-------------------- |
@@ -255,7 +255,7 @@ Disables an app account from accessing an app with the given bundle name. This A
| name | string | Yes | Name of the target app account.|
| bundleName | string | Yes | Bundle name of the app. |
-**Return Value**
+**Return value**
| Type | Description |
| :------------------ | :-------------------- |
@@ -312,7 +312,7 @@ Enables an app account to access an app with the given bundle name. This API use
| name | string | Yes | Name of the target app account. |
| bundleName | string | Yes | Bundle name of the app.|
-**Return Value**
+**Return value**
| Type | Description |
| :------------------ | :-------------------- |
@@ -371,7 +371,7 @@ Checks whether an app account allows app data synchronization. This API uses a p
| ---- | ------ | ---- | ------- |
| name | string | Yes | Name of the target app account.|
-**Return Value**
+**Return value**
| Type | Description |
| :--------------------- | :-------------------- |
@@ -430,7 +430,7 @@ Sets a credential for an app account. This API uses a promise to return the resu
| credentialType | string | Yes | Type of the credential to set.|
| credential | string | Yes | Credential to set. |
-**Return Value**
+**Return value**
| Type | Description |
| :------------------ | :-------------------- |
@@ -487,7 +487,7 @@ Sets additional information for an app account. This API uses a promise to retur
| name | string | Yes | Name of the target app account. |
| extraInfo | string | Yes | Additional information to set.|
-**Return Value**
+**Return value**
| Type | Description |
| :------------------ | :-------------------- |
@@ -548,7 +548,7 @@ Sets whether to enable app data synchronization for an app account. This API use
| name | string | Yes | Name of the target app account. |
| isEnable | boolean | Yes | Whether to enable app data synchronization.|
-**Return Value**
+**Return value**
| Type | Description |
| :------------------ | :-------------------- |
@@ -606,7 +606,7 @@ Sets data to be associated with an app account. This API uses a promise to retur
| key | string | Yes | Key of the data to set. The private key can be customized.|
| value | string | Yes | Value of the data to be set. |
-**Return Value**
+**Return value**
| Type | Description |
| :------------------ | :-------------------- |
@@ -664,7 +664,7 @@ Obtains the credential of an app account. This API uses a promise to return the
| name | string | Yes | Name of the target app account. |
| credentialType | string | Yes | Type of the credential to obtain.|
-**Return Value**
+**Return value**
| Type | Description |
| :-------------------- | :-------------------- |
@@ -720,7 +720,7 @@ Obtains additional information of an app account. This API uses a promise to ret
| ---- | ------ | ---- | ------- |
| name | string | Yes | Name of the target app account.|
-**Return Value**
+**Return value**
| Type | Description |
| :-------------------- | :-------------------- |
@@ -778,7 +778,7 @@ Obtains data associated with an app account. This API uses a promise to return t
| name | string | Yes | Name of the target app account. |
| key | string | Yes | Key of the data to obtain.|
-**Return Value**
+**Return value**
| Type | Description |
| :-------------------- | :-------------------- |
diff --git a/en/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md
new file mode 100644
index 0000000000000000000000000000000000000000..3289f1d2efc43a5af0a8fa3266f41b1ff3139aaa
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-application-DataShareExtensionAbility.md
@@ -0,0 +1,429 @@
+# Data Share Extension Ability
+
+The **DataShareExtensionAbility** module provides Extension abilities for data share services.
+
+>**NOTE**
+>
+>The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>
+>The APIs provided by this module are system APIs.
+>
+>The APIs of this module can be used only in the stage model.
+
+
+## Modules to Import
+
+```ts
+import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility'
+```
+
+## Attributes
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| context | [ExtensionContext](js-apis-extension-context.md) | Yes| No|Context of the DataShare Extension ability.|
+
+## onCreate
+
+onCreate?(want: Want, callback: AsyncCallback<void>): void
+
+Called by the server to initialize service logic when the DataShare client connects to the DataShareExtensionAbility server. This API can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| ----- | ------ | ------ | ------ |
+| want | [Want](js-apis-application-Want.md#want) | Yes | **Want** information, including the ability name and bundle name.|
+| callback | AsyncCallback<void> | Yes| Callback that returns no value.|
+
+**Example**
+
+```ts
+import rdb from '@ohos.data.rdb';
+
+let DB_NAME = "DB00.db";
+let TBL_NAME = "TBL00";
+let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
++ TBL_NAME
++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
+let rdbStore;
+
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ onCreate(want, callback) {
+ rdb.getRdbStore(this.context, {
+ name: DB_NAME
+ }, 1, function (err, data) {
+ console.log('getRdbStore done, data : ' + data);
+ rdbStore = data;
+ rdbStore.executeSql(DDL_TBL_CREATE, [], function (err) {
+ console.log('executeSql done, error message : ' + err);
+ });
+ if (callback) {
+ callback();
+ }
+ });
+ }
+};
+```
+
+## getFileTypes
+
+getFileTypes?(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void
+
+Obtains the Multipurpose Internet Mail Extensions (MIME) types supported by a file. This API is called by the server and can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ---------------------------------------- | ---- | ---------------------------------- |
+| uri | string | Yes | URI of the file. |
+| mimeTypeFilter | string | Yes | MIME types to match. |
+| callback | AsyncCallback<Array<string>> | Yes | Callback invoked to return the MIME types obtained.|
+
+**Example**
+
+```ts
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ getFileTypes(uri, mimeTypeFilter, callback) {
+ let err = {"code":0};
+ let ret = new Array("type01", "type02", "type03");
+ callback(err, ret);
+ }
+};
+```
+
+## openFile
+
+openFile?(uri: string, mode: string, callback: AsyncCallback<number>): void
+
+Opens a file. This API is called by the server and can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | --------------------- | ---- | ------------------------------------------ |
+| uri | string | Yes | URI of the file to open. |
+| mode | string | Yes | File open mode, which can be read-only or read/write.|
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the file descriptor. |
+
+**Example**
+
+```ts
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ openFile(uri, mode, callback) {
+ let err = {"code":0};
+ let fd = 0;
+ callback(err,fd);
+ }
+};
+```
+
+## insert
+
+insert?(uri: string, valueBucket: ValuesBucket, callback: AsyncCallback<number>): void
+
+Inserts data into the database. This API can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| ----- | ------ | ------ | ------ |
+| uri |string | Yes | URI of the data to insert.|
+| valueBucket |[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes| Data to insert.|
+| callback |AsyncCallback<number> | Yes| Callback invoked to return the index of the data inserted.|
+
+**Example**
+
+```ts
+import rdb from '@ohos.data.rdb';
+
+let DB_NAME = "DB00.db";
+let TBL_NAME = "TBL00";
+let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
++ TBL_NAME
++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
+let rdbStore;
+
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ insert(uri, valueBucket, callback) {
+ if (valueBucket == null) {
+ console.info('invalid valueBuckets');
+ return;
+ }
+ rdbStore.insert(TBL_NAME, valueBucket, function (err, ret) {
+ console.info('callback ret:' + ret);
+ if (callback != undefined) {
+ callback(err, ret);
+ }
+ });
+ }
+};
+```
+
+## update
+
+update?(uri: string, predicates: dataSharePredicates.DataSharePredicates, valueBucket: ValuesBucket, callback: AsyncCallback<number>): void
+
+Updates data in the database. This API can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| ----- | ------ | ------ | ------ |
+| uri | string | Yes | URI of the data to update.|
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria for updating data.|
+| valueBucket | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes| New data.|
+| callback | AsyncCallback<number> | Yes| Callback invoked to return the number of updated data records.|
+
+**Example**
+
+```ts
+import rdb from '@ohos.data.rdb';
+
+let DB_NAME = "DB00.db";
+let TBL_NAME = "TBL00";
+let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
++ TBL_NAME
++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
+let rdbStore;
+
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ update(uri, predicates, valueBucket, callback) {
+ if (predicates == null || predicates == undefined) {
+ return;
+ }
+ rdbStore.update(TBL_NAME, valueBucket, predicates, function (err, ret) {
+ if (callback != undefined) {
+ callback(err, ret);
+ }
+ });
+ }
+};
+```
+
+## delete
+
+delete?(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void
+
+Deletes data from the database. This API can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ---------------------------------- |
+| uri | string | Yes | URI of the data to delete. |
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria for deleting data. |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of data records deleted.|
+
+**Example**
+
+```ts
+import rdb from '@ohos.data.rdb';
+
+let DB_NAME = "DB00.db";
+let TBL_NAME = "TBL00";
+let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
++ TBL_NAME
++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
+let rdbStore;
+
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ delete(uri, predicates, callback) {
+ if (predicates == null || predicates == undefined) {
+ return;
+ }
+ rdbStore.delete(TBL_NAME, predicates, function (err, ret) {
+ if (callback != undefined) {
+ callback(err, ret);
+ }
+ });
+ }
+};
+```
+
+## query
+
+query?(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<Object>): void
+
+Queries data from the database. This API can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| ----- | ------ | ------ | ------ |
+| uri | string | Yes | URI of the data to query.|
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria for querying data.|
+| columns | Array<string> | Yes| Columns to query. If this parameter is empty, all columns will be queried.|
+| callback | AsyncCallback<Object> | Yes| Callback invoked to return the result set.|
+
+**Example**
+
+```ts
+import rdb from '@ohos.data.rdb';
+
+let DB_NAME = "DB00.db";
+let TBL_NAME = "TBL00";
+let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
++ TBL_NAME
++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
+let rdbStore;
+
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ query(uri, predicates, columns, callback) {
+ if (predicates == null || predicates == undefined) {
+ return;
+ }
+ rdbStore.query(TBL_NAME, predicates, columns, function (err, resultSet) {
+ if (resultSet != undefined) {
+ console.info('resultSet.rowCount: ' + resultSet.rowCount);
+ }
+ if (callback != undefined) {
+ callback(err, resultSet);
+ }
+ });
+ }
+};
+```
+
+## getType
+
+getType?(uri: string, callback: AsyncCallback<string>): void
+
+Obtains the MIME type corresponding to the given URI. This API can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| ----- | ------ | ------ | ------ |
+| uri | string | Yes | URI of the target data.|
+| callback | AsyncCallback<string> | Yes| Callback invoked to return the MIME type obtained.|
+
+**Example**
+
+```ts
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ getType(uri, callback) {
+ let err = {"code":0};
+ let ret = "image";
+ callback(err, ret);
+ }
+};
+```
+
+## batchInsert
+
+batchInsert?(uri: string, valueBuckets: Array<ValuesBucket>, callback: AsyncCallback<number>): void
+
+Batch inserts data into the database. This API is called by the server and can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------ | ------------------------------------------------------------ | ---- | -------------------------------- |
+| uri | string | Yes | URI of the data to insert. |
+| valueBuckets | Array<[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket)> | Yes | Data to insert. |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the number of inserted data records.|
+
+**Example**
+
+```ts
+import rdb from '@ohos.data.rdb';
+
+let DB_NAME = "DB00.db";
+let TBL_NAME = "TBL00";
+let DDL_TBL_CREATE = "CREATE TABLE IF NOT EXISTS "
++ TBL_NAME
++ " (id INTEGER PRIMARY KEY AUTOINCREMENT, name TEXT, age INTEGER, phoneNumber DOUBLE, isStudent BOOLEAN, Binary BINARY)";
+let rdbStore;
+
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ batchInsert(uri, valueBuckets, callback) {
+ if (valueBuckets == null || valueBuckets.length == undefined) {
+ console.info('invalid valueBuckets');
+ return;
+ }
+ let resultNum = valueBuckets.length
+ valueBuckets.forEach(vb => {
+ rdbStore.insert(TBL_NAME, vb, function (err, ret) {
+ if (callback != undefined) {
+ callback(err, resultNum);
+ }
+ });
+ });
+ }
+};
+```
+
+## normalizeUri
+
+normalizeUri?(uri: string, callback: AsyncCallback<string>): void
+
+Normalizes a URI. This API can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | --------------------- | ---- | ----------------------- |
+| uri | string | Yes | [URI](js-apis-uri.md#uri) to normalize.|
+| callback | AsyncCallback<string> | Yes | Callback used to return the result. If the operation is successful, the normalized URI is returned. Otherwise, **null** is returned.|
+
+**Example**
+
+```ts
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ normalizeUri(uri, callback) {
+ let err = {"code":0};
+ let ret = "normalize+" + uri;
+ callback(err, ret);
+ }
+};
+```
+
+## denormalizeUri
+
+denormalizeUri?(uri: string, callback: AsyncCallback<string>): void
+
+Denormalizes a URI. This API can be overridden as required.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Provider
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | --------------------- | ---- | ----------------------- |
+| uri | string | Yes | [URI](js-apis-uri.md#uri) to denormalize.|
+| callback | AsyncCallback<string> | Yes | Callback used to return the result. If the operation is successful, the denormalized URI is returned. If the URI passed in is returned, denormalization is not required. If denormalization is not supported, **null** is returned.|
+
+**Example**
+
+```ts
+export default class DataShareExtAbility extends DataShareExtensionAbility {
+ denormalizeUri(uri, callback) {
+ let err = {"code":0};
+ let ret = "denormalize+" + uri;
+ callback(err, ret);
+ }
+};
+```
diff --git a/en/application-dev/reference/apis/js-apis-application-EnvironmentCallback.md b/en/application-dev/reference/apis/js-apis-application-EnvironmentCallback.md
new file mode 100644
index 0000000000000000000000000000000000000000..f0d75fc57deed25160bbb080ef1565a45a94679d
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-application-EnvironmentCallback.md
@@ -0,0 +1,62 @@
+# EnvironmentCallback
+
+The **EnvironmentCallback** module provides the **onConfigurationUpdated** API for the application context to listen for system environment changes.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> The APIs of this module can be used only in the stage model.
+
+
+## Modules to Import
+
+```js
+import EnvironmentCallback from "@ohos.application.EnvironmentCallback";
+```
+
+
+## EnvironmentCallback.onConfigurationUpdated
+
+onConfigurationUpdated(config: Configuration): void;
+
+Called when the system environment changes.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | config | [Configuration](js-apis-configuration.md) | Yes| **Configuration** object after the change.|
+
+**Example**
+
+
+ ```js
+import AbilityStage from "@ohos.application.AbilityStage";
+
+var callbackId;
+
+export default class MyAbilityStage extends AbilityStage {
+ onCreate() {
+ console.log("MyAbilityStage onCreate")
+ globalThis.applicationContext = this.context.getApplicationContext();
+ let EnvironmentCallback = {
+ onConfigurationUpdated(config){
+ console.log("onConfigurationUpdated config:" + JSON.stringify(config));
+ },
+ }
+ // 1. Obtain an applicationContext object.
+ let applicationContext = globalThis.applicationContext;
+ // 2. Register a listener for the environment changes through the applicationContext object.
+ callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback);
+ console.log("registerEnvironmentCallback number: " + JSON.stringify(callbackId));
+ }
+ onDestroy() {
+ let applicationContext = globalThis.applicationContext;
+ applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => {
+ console.log("unregisterEnvironmentCallback success, err: " + JSON.stringify(error));
+ });
+ }
+}
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-application-MissionSnapshot.md b/en/application-dev/reference/apis/js-apis-application-MissionSnapshot.md
index c850915c4d2743d7ee8f03ce0b96d6a4f7739525..c97515fa2bd988b91c4fd5c27a8e27ed285f141c 100644
--- a/en/application-dev/reference/apis/js-apis-application-MissionSnapshot.md
+++ b/en/application-dev/reference/apis/js-apis-application-MissionSnapshot.md
@@ -1,23 +1,39 @@
# MissionSnapshot
+The **MissionSnapshot** module provides the mission snapshot information of an ability.
+
> **NOTE**
->
+>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> The APIs of this module are system APIs and cannot be called by third-party applications.
-Provides the snapshot of a mission.
+## Usage
-## Modules to Import
+The mission snapshot information can be obtained by using **getMissionSnapShot** in **missionManager**.
-```
-import missionManager from '@ohos.application.missionManager'
+```js
import ElementName from '@ohos.bundle';
import image from '@ohos.multimedia.image';
-```
+import missionManager from '@ohos.application.missionManager'
+
+ missionManager.getMissionInfos("", 10, (error, missions) => {
+ console.log("getMissionInfos is called, error.code = " + error.code);
+ console.log("size = " + missions.length);
+ console.log("missions = " + JSON.stringify(missions));
+ var id = missions[0].missionId;
+ missionManager.getMissionSnapShot("", id, (error, snapshot) => {
+ console.log("getMissionSnapShot is called, error.code = " + error.code);
+ console.log("bundleName = " + snapshot.ability.bundleName);
+ })
+ })
+```
## MissionSnapshot
Describes the mission snapshot.
+**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
+
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| ability | ElementName | Yes| Yes| Information that matches an ability.|
diff --git a/en/application-dev/reference/apis/js-apis-application-StartOptions.md b/en/application-dev/reference/apis/js-apis-application-StartOptions.md
index e221f4506244b56ea43e24ef916085ef1f3fac63..d1d7416500d37ab61523633f3880670ad8b98779 100644
--- a/en/application-dev/reference/apis/js-apis-application-StartOptions.md
+++ b/en/application-dev/reference/apis/js-apis-application-StartOptions.md
@@ -1,12 +1,12 @@
# StartOptions
+The **StartOptions** module implements ability startup options.
+
> **NOTE**
->
-> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-**StartOptions** is the basic communication component of the system.
-
## Modules to Import
```
@@ -15,10 +15,9 @@ import StartOptions from '@ohos.application.StartOptions';
## Attributes
-**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name| Readable| Writable| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- | -------- | -------- |
-| [windowMode](js-apis-window.md#windowmode) | Yes| No| number | No| Window mode.|
+| [windowMode](js-apis-application-abilityConstant.md#AbilityConstant.WindowMode) | Yes| No| number | No| Window mode.|
| displayId | Yes| No| number | No| Display ID.|
-
diff --git a/en/application-dev/reference/apis/js-apis-application-Want.md b/en/application-dev/reference/apis/js-apis-application-Want.md
index 26c0cd030bcdf36cee488cba5066b2beba38a3d3..f51fee8402c98f9c36e81f355df105a3154e0105 100644
--- a/en/application-dev/reference/apis/js-apis-application-Want.md
+++ b/en/application-dev/reference/apis/js-apis-application-Want.md
@@ -1,11 +1,11 @@
# Want
+The **Want** module provides the basic communication component of the system.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-**Want** is the basic communication component of the system.
-
## Modules to Import
```
@@ -20,11 +20,26 @@ import Want from '@ohos.application.Want';
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
| deviceId | Read only | string | No | ID of the device running the ability. |
| bundleName | Read only | string | No | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.|
-| abilityName | Read only | string | No | Name of the ability. If both **package** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability.|
+| abilityName | Read only | string | No | Name of the ability. If both **package** and **abilityName** are specified in a **Want** object, the **Want** object can match a specific ability. The value of **abilityName** must be unique in an application.|
| uri | Read only | string | No | URI information to match. If **uri** is specified in a **Want** object, the **Want** object will match the specified URI information, including **scheme**, **schemeSpecificPart**, **authority**, and **path**.|
| type | Read only | string | No | MIME type, for example, **text/plain** or **image/***. |
| flags | Read only | number | No | How the **Want** object will be handled. By default, numbers are passed in. For details, see [flags](js-apis-featureAbility.md#flags).|
| action | Read only | string | No | Action option. |
-| parameters | Read only | {[key: string]: any} | No | List of parameters in the **Want** object. |
+| parameters | Read only | {[key: string]: any} | No | Want parameters in the form of custom key-value (KV) pairs. By default, the following keys are carried:
**ohos.aafwk.callerPid**: PID of the caller.
**ohos.aafwk.param.callerToken**: token of the caller.
**ohos.aafwk.param.callerUid**: UID of the caller. The **userId** parameter in the [Bundle](js-apis-Bundle.js) module can be used to obtain application and bundle information. |
| entities | Read only | Array\ | No | List of entities. |
-| moduleName9+ | Read only | string | No | Module to which the ability belongs. Different abilities among HAP files in an application may use the same name. If the abilities cannot be distinguished by the combination of **bundleName** and **abilityName**, you can set **moduleName** for better distinguishing.| |
+| moduleName9+ | Read only | string | No | Module to which the ability belongs.|
+
+**Example**
+
+``` js
+ var want = {
+ "deviceId": "", // An empty deviceId indicates the local device.
+ "bundleName": "com.extreme.test",
+ "abilityName": "MainAbility",
+ "moduleName": "entry" // moduleName is optional.
+ };
+ this.context.startAbility(want, (error) => {
+ // Start an ability explicitly. The bundleName, abilityName, and moduleName parameters uniquely identify an ability.
+ console.log("error.code = " + error.code)
+ })
+```
diff --git a/en/application-dev/reference/apis/js-apis-application-ability.md b/en/application-dev/reference/apis/js-apis-application-ability.md
index bdf719b34ed6e7ba0dcc227ff5866c8ae7b87a87..565210637c6e83f83ec734c0905e11596baaf0db 100644
--- a/en/application-dev/reference/apis/js-apis-application-ability.md
+++ b/en/application-dev/reference/apis/js-apis-application-ability.md
@@ -1,12 +1,17 @@
# Ability
+The **Ability** module manages the ability lifecycle and context, such as creating and destroying an ability, and dumping client information.
+
+This module provides the following common ability-related functions:
+
+- [Caller](#caller): implements sending of sequenceable data to the target ability when an ability (caller) invokes the target ability (callee).
+- [Callee](#callee): implements callbacks for registration and deregistration of caller notifications.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-Manages the ability lifecycle and context.
-
## Modules to Import
```
@@ -17,14 +22,12 @@ import Ability from '@ohos.application.Ability';
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-| Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.|
-| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.|
-| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.|
-| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.|
-
-
+| context | [AbilityContext](js-apis-ability-context.md) | Yes| No| Context of an ability.|
+| launchWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters for starting the ability.|
+| lastRequestWant | [Want](js-apis-application-Want.md) | Yes| No| Parameters used when the ability was started last time.|
+| callee | [Callee](#callee) | Yes| No| Object that invokes the stub service.|
## Ability.onCreate
@@ -36,13 +39,13 @@ Called to initialize the service logic when an ability is created.
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.|
- | param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Information related to this ability, including the ability name and bundle name.|
+| param | AbilityConstant.LaunchParam | Yes| Parameters for starting the ability, and the reason for the last abnormal exit.|
+
+**Example**
-**Example**
-
```js
class myAbility extends Ability {
onCreate(want, param) {
@@ -62,12 +65,12 @@ Called when a **WindowStage** is created for this ability.
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | windowStage | window.WindowStage | Yes| **WindowStage** information.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| windowStage | window.WindowStage | Yes| **WindowStage** information.|
+
+**Example**
-**Example**
-
```js
class myAbility extends Ability {
onWindowStageCreate(windowStage) {
@@ -85,8 +88,8 @@ Called when the **WindowStage** is destroyed for this ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
class myAbility extends Ability {
onWindowStageDestroy() {
@@ -106,12 +109,12 @@ Called when the **WindowStage** is restored during the migration of this ability
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | windowStage | window.WindowStage | Yes| **WindowStage** information.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| windowStage | window.WindowStage | Yes| **WindowStage** information.|
+
+**Example**
-**Example**
-
```js
class myAbility extends Ability {
onWindowStageRestore(windowStage) {
@@ -129,8 +132,8 @@ Called when this ability is destroyed to clear resources.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
class myAbility extends Ability {
onDestroy() {
@@ -148,8 +151,8 @@ Called when this ability is switched from the background to the foreground.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
class myAbility extends Ability {
onForeground() {
@@ -167,8 +170,8 @@ Called when this ability is switched from the foreground to the background.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
class myAbility extends Ability {
onBackground() {
@@ -188,18 +191,18 @@ Called to save data during the ability migration preparation process.
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | wantParam | {[key: string]: any} | Yes| **want** parameter.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| wantParam | {[key: string]: any} | Yes| **want** parameter.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | AbilityConstant.OnContinueResult | Continuation result.|
+| Type| Description|
+| -------- | -------- |
+| AbilityConstant.OnContinueResult | Continuation result.|
+
+**Example**
-**Example**
-
```js
import AbilityConstant from "@ohos.application.AbilityConstant"
class myAbility extends Ability {
@@ -222,13 +225,13 @@ Called when the ability startup mode is set to singleton.
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.|
- | launchParams | AbilityConstant.LaunchParam | Yes| Reason for the ability startup and the last abnormal exit.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| want | [Want](js-apis-application-Want.md) | Yes| Want parameters, such as the ability name and bundle name.|
+| launchParams | AbilityConstant.LaunchParam | Yes| Reason for the ability startup and the last abnormal exit.|
+
+**Example**
-**Example**
-
```js
class myAbility extends Ability {
onNewWant(want, launchParams) {
@@ -251,12 +254,12 @@ Called when the configuration of the environment where the ability is running is
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | config | [Configuration](js-apis-configuration.md) | Yes| New configuration.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| config | [Configuration](js-apis-configuration.md) | Yes| New configuration.|
+
+**Example**
-**Example**
-
```js
class myAbility extends Ability {
onConfigurationUpdated(config) {
@@ -269,18 +272,18 @@ Called when the configuration of the environment where the ability is running is
dump(params: Array\): Array\;
-Called when the client information is dumped.
+Dumps client information.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | params | Array\ | Yes| Parameters in the form of a command.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| params | Array\ | Yes| Parameters in the form of a command.|
+
+**Example**
-**Example**
-
```js
class myAbility extends Ability {
dump(params) {
@@ -307,19 +310,19 @@ Sends sequenceable data to the target ability.
**Parameters**
- | 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.Sequenceable | Yes| Sequenceable data. You need to customize the 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.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<void> | Promise used to return a response.|
+| Type| Description|
+| -------- | -------- |
+| Promise<void> | Promise used to return a response.|
+
+**Example**
-**Example**
-
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{ // Custom sequenceable data structure
@@ -380,19 +383,19 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
**Parameters**
- | 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.Sequenceable | Yes| Sequenceable data. You need to customize the 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.Sequenceable | Yes| Sequenceable data. You need to customize the data.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.|
+| Type| Description|
+| -------- | -------- |
+| Promise<rpc.MessageParcel> | Promise used to return the sequenceable data from the target ability.|
+
+**Example**
-**Example**
-
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{
@@ -452,8 +455,8 @@ Releases the caller interface of the target ability.
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-**Example**
-
+**Example**
+
```js
import Ability from '@ohos.application.Ability';
var caller;
@@ -489,12 +492,12 @@ Registers a callback that is invoked when the stub on the target ability is disc
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callback | OnReleaseCallBack | Yes| Callback used for the **onRelease** API.|
+
+**Example**
-**Example**
-
```js
import Ability from '@ohos.application.Ability';
var caller;
@@ -529,7 +532,7 @@ Implements callbacks for caller notification registration and deregistration.
## Callee.on
-on(method: string, callback: CaleeCallBack): void;
+on(method: string, callback: CalleeCallBack): void;
Registers a caller notification callback, which is invoked when the target ability registers a function.
@@ -537,13 +540,12 @@ Registers a caller notification callback, which is invoked when the target abili
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | method | string | Yes| Notification message string negotiated between the two abilities.|
- | callback | CaleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| method | string | Yes| Notification message string negotiated between the two abilities.|
+| callback | CalleeCallBack | Yes| JS notification synchronization callback of the **rpc.MessageParcel** type. The callback must return at least one empty **rpc.Sequenceable** object. Otherwise, the function execution fails.|
-**Example**
-
+**Example**
```js
import Ability from '@ohos.application.Ability';
class MyMessageAble{
@@ -593,9 +595,9 @@ Deregisters a caller notification callback, which is invoked when the target abi
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | method | string | Yes| Registered notification message string.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| method | string | Yes| Registered notification message string.|
**Example**
@@ -616,17 +618,17 @@ Deregisters a caller notification callback, which is invoked when the target abi
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-| Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| (msg: string) | function | Yes| No| Prototype of the listener function interface registered by the caller.|
-
+| (msg: string) | function | Yes| No| Prototype of the listener function registered by the caller.|
+
- ## CaleeCallBack
+ ## CalleeCallBack
(indata: rpc.MessageParcel): rpc.Sequenceable;
**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
-| Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the message listener function interface registered by the callee.|
+| (indata: rpc.MessageParcel) | rpc.Sequenceable | Yes| No| Prototype of the listener function registered by the callee.|
diff --git a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md
index 3b2a958f7f403cade73487d61ff3695e5935d1bb..ca3269353344ca06935afaf6b390ae0c906f1a1a 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilityConstant.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityConstant.md
@@ -1,12 +1,14 @@
# AbilityConstant
+The **AbilityConstant** module provides ability launch parameters.
+
+The parameters include the initial launch reasons, reasons for the last exit, and ability continuation results.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-Provides parameters related to ability launch.
-
## Modules to Import
```js
@@ -17,10 +19,10 @@ import AbilityConstant from '@ohos.application.AbilityConstant';
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
-| Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| launchReason | LaunchReason| Yes| Yes| Ability launch reason.|
-| lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.|
+| launchReason | LaunchReason| Yes| Yes| Ability launch reason.|
+| lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.|
## AbilityConstant.LaunchReason
@@ -60,3 +62,17 @@ Enumerates ability continuation results.
| AGREE | 0 | Continuation agreed.|
| REJECT | 1 | Continuation denied.|
| MISMATCH | 2 | Mismatch.|
+
+## AbilityConstant.WindowMode
+
+Enumerates the window modes when an ability is started.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+| Name | Value| Description |
+| --- | --- | --- |
+| WINDOW_MODE_UNDEFINED | 0 | Undefined window mode. |
+| WINDOW_MODE_FULLSCREEN | 1 | The ability is displayed in full screen. |
+| WINDOW_MODE_SPLIT_PRIMARY | 100 | The ability is displayed in the primary window in split-screen mode. |
+| WINDOW_MODE_SPLIT_SECONDARY | 101 | The ability is displayed in the secondary window in split-screen mode. |
+| WINDOW_MODE_FLOATING | 102 | The ability is displayed in a floating window.|
diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md
index ec8655be70c9037622328066aa63d2cc643421d1..542214482f3e5bc8a74dad3d9990e1817b3f02e8 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegator.md
@@ -1,13 +1,21 @@
# AbilityDelegator
+The **AbilityDelegator** module provides APIs for managing **AbilityMonitor** instances that are used to monitor the lifecycle state changes of a specified ability. You can use the APIs to add and remove **AbilityMonitor** instances, wait for an ability to reach the **OnCreate** lifecycle state, set the waiting time, obtain the lifecycle state of an ability, obtain the top ability of the current application, and start an ability.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-## Modules to Import
+## Usage
+The ability delegator can be obtained by calling **getAbilityDelegator** in **AbilityDelegatorRegistry**.
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+var abilityDelegator;
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+
```
## AbilityDelegator
@@ -174,7 +182,7 @@ abilityDelegator.removeAbilityMonitor(monitor).then(() => {
waitAbilityMonitor(monitor: AbilityMonitor, callback: AsyncCallback\): void
-Waits for the ability that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle and returns the **Ability** instance. This API uses an asynchronous callback to return the result.
+Waits for the **Ability** instance that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle state and returns the **Ability** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -211,7 +219,7 @@ abilityDelegator.waitAbilityMonitor(monitor, (err : any, data : any) => {
waitAbilityMonitor(monitor: AbilityMonitor, timeout: number, callback: AsyncCallback\): void
-Waits a period of time for the ability that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle and returns the **Ability** instance. This API uses an asynchronous callback to return the result.
+Waits a period of time for the **Ability** instance that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle state and returns the **Ability** instance. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -250,7 +258,7 @@ abilityDelegator.waitAbilityMonitor(monitor, timeout, (err : any, data : any) =>
waitAbilityMonitor(monitor: AbilityMonitor, timeout?: number): Promise\
-Waits a period of time for the ability that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle and returns the **Ability** instance. This API uses a promise to return the result.
+Waits a period of time for the **Ability** instance that matches the **AbilityMonitor** instance to reach the **OnCreate** lifecycle state and returns the **Ability** instance. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -355,7 +363,7 @@ abilityDelegator.getCurrentTopAbility((err : any, data : any) => {
getCurrentTopAbility(callback: AsyncCallback\): void
-Obtains the top ability of the application. This API uses an asynchronous callback to return the result.
+Obtains the top ability of this application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -384,7 +392,7 @@ abilityDelegator.getCurrentTopAbility((err : any, data : any) => {
getCurrentTopAbility(): Promise\
-Obtains the top ability of the application. This API uses a promise to return the result.
+Obtains the top ability of this application. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -491,7 +499,7 @@ Schedules the lifecycle state of an ability to **Foreground**. This API uses an
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------------------------------------------- |
| ability | Ability | Yes | Target ability. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation fails.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation failed.|
**Example**
@@ -529,7 +537,7 @@ Schedules the lifecycle state of an ability to **Foreground**. This API uses a p
| Type | Description |
| ----------------- | ------------------------------------------------------------ |
-| Promise\ | Promise used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation fails.|
+| Promise\ | Promise used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation failed.|
**Example**
@@ -562,7 +570,7 @@ Schedules the lifecycle state of an ability to **Background**. This API uses an
| Name | Type | Mandatory| Description |
| -------- | ----------------------- | ---- | ------------------------------------------------------- |
| ability | Ability | Yes | Target ability. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation fails.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation failed.|
**Example**
@@ -600,7 +608,7 @@ Schedules the lifecycle state of an ability to **Background**. This API uses a p
| Type | Description |
| ----------------- | ------------------------------------------------------------ |
-| Promise\ | Promise used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation fails.|
+| Promise\ | Promise used to return the result.
\- **true**: The operation is successful.
\- **false**: The operation failed.|
**Example**
@@ -620,6 +628,32 @@ abilityDelegator.getCurrentTopAbility((err : any, data : any) => {
+### printSync9+
+
+printSync(msg: string): void
+
+Prints log information to the unit test console.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ---------- |
+| msg | string | Yes | Log string.|
+
+**Example**
+
+```js
+var abilityDelegator;
+var msg = "msg";
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.printSync(msg);
+```
+
+
+
### print
print(msg: string, callback: AsyncCallback\): void
diff --git a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md
index ad43acc77bd9e7ff82b9d5bb7e01467e6b36c656..dffe0e39e69e38123bf7e89338b3d4efb14ad82a 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityDelegatorArgs.md
@@ -1,22 +1,30 @@
# AbilityDelegatorArgs
+The **AbilityDelegatorArgs** module provides a global register to store the registered **AbilityDelegator** and **AbilityDelegatorArgs** instances during application startup.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-## Modules to Import
+## Usage
+
+The ability delegator arguments are obtained by calling **getArguments** in **AbilityDelegatorRegistry**.
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+
+var args = AbilityDelegatorRegistry.getArguments();
```
## AbilityDelegatorArgs
-Describes the test parameters.
+Describes the ability delegator arguments.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Readable| Writable| Description |
| ------------------- | ---------------------- | ---- | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes | Yes | Bundle name of the application to test.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| parameters | {[key:string]: string} | Yes | Yes | Parameters of the unit test that is started currently.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| testCaseNames | string | Yes | Yes | Test case names.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| testRunnerClassName | string | Yes | Yes | Names of the test executors that execute the test cases.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
+| bundleName | string | Yes | Yes | Bundle name of the application to test. |
+| parameters | {[key:string]: string} | Yes | Yes | Parameters of the unit test that is started currently. |
+| testCaseNames | string | Yes | Yes | Test case names. |
+| testRunnerClassName | string | Yes | Yes | Names of the test case executors. |
diff --git a/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md b/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md
index 02803ad07bcde72288958a9be4981a15b8b4b555..42974b5fd683af842146b53fec22022edca84de6 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityLifecycleCallback.md
@@ -1,17 +1,17 @@
# AbilityLifecycleCallback
+The **AbilityLifecycleCallback** module provides callbacks, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to receive lifecycle state changes in the application context.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-A callback class that provides APIs, such as **onAbilityCreate**, **onAbilityWindowStageCreate**, and **onAbilityWindowStageDestroy**, to listen for the lifecycle of the application context.
-
## Modules to Import
```js
-import AbilityLifecycleCallback from "@ohos.application.abilityLifecycleCallback";
+import AbilityLifecycleCallback from "@ohos.application.AbilityLifecycleCallback";
```
diff --git a/en/application-dev/reference/apis/js-apis-abilityManager.md b/en/application-dev/reference/apis/js-apis-application-abilityManager.md
similarity index 94%
rename from en/application-dev/reference/apis/js-apis-abilityManager.md
rename to en/application-dev/reference/apis/js-apis-application-abilityManager.md
index 28c5cd31b0350ca0e8b24c8bfbda21fb039adcd7..e1bf96bae511de4e1fb83d92df6ee05bdddbf990 100644
--- a/en/application-dev/reference/apis/js-apis-abilityManager.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityManager.md
@@ -7,7 +7,7 @@ The **AbilityManager** module provides APIs for obtaining, adding, and modifying
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module are system APIs and cannot be called by third-party applications.
-# Modules to Import
+## Modules to Import
```js
import AbilityManager from '@ohos.application.abilityManager'
@@ -21,24 +21,24 @@ Enumerates the ability states.
**System API**: This is a system API and cannot be called by third-party applications.
-| Name| Value| Description|
+| Name| Value| Description|
| -------- | -------- | -------- |
-| INITIAL | 0 | The ability is in the initial state.|
-| FOREGROUND | 9 | The ability is in the foreground state. |
-| BACKGROUND | 10 | The ability is in the background state. |
-| FOREGROUNDING | 11 | The ability is in the foregrounding state. |
-| BACKGROUNDING | 12 | The ability is in the backgrounding state. |
+| INITIAL | 0 | The ability is in the initial state.|
+| FOREGROUND | 9 | The ability is in the foreground state. |
+| BACKGROUND | 10 | The ability is in the background state. |
+| FOREGROUNDING | 11 | The ability is in the foregrounding state. |
+| BACKGROUNDING | 12 | The ability is in the backgrounding state. |
## updateConfiguration
updateConfiguration(config: Configuration, callback: AsyncCallback\): void
-Obtains the ability running information. This API uses an asynchronous callback to return the result.
+Updates the configuration. This API uses an asynchronous callback to return the result.
**Permission required**: ohos.permission.UPDATE_CONFIGURATION
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
-
+
**Parameters**
| Name | Type | Mandatory | Description |
@@ -80,7 +80,7 @@ Updates the configuration. This API uses a promise to return the result.
| Type | Description |
| ---------------------------------------- | ------- |
-| Promise\ | Promise used to return the result. |
+| Promise\ | Promise used to return the result.|
**Example**
@@ -138,7 +138,7 @@ Obtains the ability running information. This API uses a promise to return the r
| Type | Description |
| ---------------------------------------- | ------- |
-| Promise\> | Promise used to return the result. |
+| Promise\> | Promise used to return the result.|
**Example**
@@ -186,7 +186,7 @@ abilitymanager.getExtensionRunningInfos(upperLimit, (err,data) => {
getExtensionRunningInfos(upperLimit: number): Promise\>
Obtains the extension running information. This API uses a promise to return the result.
-
+
**Required permissions**: ohos.permission.GET_RUNNING_INFO
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
@@ -201,7 +201,7 @@ Obtains the extension running information. This API uses a promise to return the
| Type | Description |
| ---------------------------------------- | ------- |
-| Promise\> | Promise used to return the result. |
+| Promise\> | Promise used to return the result.|
**Example**
@@ -246,14 +246,14 @@ abilitymanager.getTopAbility((err,data) => {
getTopAbility(): Promise\;
Obtains the top ability, which is the ability that has the window focus. This API uses a promise to return the result.
-
+
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Return value**
| Type | Description |
| ---------------------------------------- | ------- |
-| Promise\| Promise used to return the result. |
+| Promise\| Promise used to return the result.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md b/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md
index e7f017b48ebb0f440b021386e7a427e2d0a59852..33feda3afdd757e91ed7b7f682dca1ef597a7847 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilityMonitor.md
@@ -1,26 +1,47 @@
# AbilityMonitor
+The **AbilityMonitor** module provides monitors for abilities that meet specified conditions. The latest matched abilities are stored in an **AbilityMonitor** object.
+
> **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
+## Usage
+
+The ability monitor is set by calling **addAbilityMonitor** in **abilityDelegator**.
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+var abilityDelegator;
+
+function onAbilityCreateCallback(data) {
+ console.info("onAbilityCreateCallback");
+}
+
+var monitor = {
+ abilityName: "abilityname",
+ onAbilityCreate: onAbilityCreateCallback
+}
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.addAbilityMonitor(monitor, (err : any) => {
+ console.info("addAbilityMonitor callback");
+});
```
## AbilityMonitor
Describes an ability monitor.
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
| Name | Type | Readable| Writable| Description |
| ------------------------------------------------------------ | -------- | ---- | ---- | ------------------------------------------------------------ |
-| abilityName | string | Yes | Yes | Name of the ability bound to the ability monitor.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| onAbilityCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| onAbilityForeground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the foreground.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| onAbilityBackground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the background.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| onAbilityDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| onWindowStageCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| onWindowStageRestore?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is restored.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| onWindowStageDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
+| abilityName | string | Yes | Yes | Name of the ability bound to the ability monitor. |
+| onAbilityCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received. |
+| onAbilityForeground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the foreground.
If this attribute is not set, the corresponding lifecycle callback cannot be received. |
+| onAbilityBackground?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability starts to run in the background.
If this attribute is not set, the corresponding lifecycle callback cannot be received. |
+| onAbilityDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the ability is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received. |
+| onWindowStageCreate?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is created.
If this attribute is not set, the corresponding lifecycle callback cannot be received. |
+| onWindowStageRestore?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is restored.
If this attribute is not set, the corresponding lifecycle callback cannot be received. |
+| onWindowStageDestroy?:(data: [Ability](js-apis-application-ability.md#Ability)) | function | Yes | Yes | Called when the window stage is destroyed.
If this attribute is not set, the corresponding lifecycle callback cannot be received. |
diff --git a/en/application-dev/reference/apis/js-apis-application-abilitystage.md b/en/application-dev/reference/apis/js-apis-application-abilitystage.md
index 731d21305f151cd0318b14813e270bc14a27a3d2..c4f5da0e2989b5565d6405198a8c83ad7f20ee65 100644
--- a/en/application-dev/reference/apis/js-apis-application-abilitystage.md
+++ b/en/application-dev/reference/apis/js-apis-application-abilitystage.md
@@ -1,12 +1,14 @@
# AbilityStage
+**AbilityStage** is a runtime class for HAP files.
+
+The **AbilityStage** module notifies you of when you can perform HAP initialization such as resource pre-loading and thread creation during the HAP loading.
+
> **NOTE**
>
-> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-Runtime class for HAP files. It provides APIs to notify you when a HAP file starts loading. You can then initialize the HAP file, for example, pre-load resources and create threads.
-
## Modules to Import
```js
diff --git a/en/application-dev/reference/apis/js-apis-application-applicationContext.md b/en/application-dev/reference/apis/js-apis-application-applicationContext.md
index 517d9fb529fce872c5972a1aada50ce9f9b54ec9..7a76626655a193e7f146190df319fbbeafe8430d 100644
--- a/en/application-dev/reference/apis/js-apis-application-applicationContext.md
+++ b/en/application-dev/reference/apis/js-apis-application-applicationContext.md
@@ -1,18 +1,12 @@
# ApplicationContext
+The **ApplicationContext** module provides application-level context. You can use the APIs of this module to register and deregister the ability lifecycle listener in an application.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-Provides application-level context and APIs for registering and deregistering the ability lifecycle listener in an application.
-
-## Modules to Import
-
-```
-import Ability from '@ohos.application.Ability';
-```
-
## How to Use
Before calling any APIs in **ApplicationContext**, obtain an **ApplicationContext** instance through the **context** instance.
@@ -42,6 +36,54 @@ Registers a listener to monitor the ability lifecycle of the application.
| ------ | ------------------------------ |
| number | ID of the registered listener. The ID is incremented by 1 each time the listener is registered. When the ID exceeds 2^63-1, **-1** is returned.|
+**Example**
+
+ ```js
+import AbilityStage from "@ohos.application.AbilityStage";
+
+var lifecycleId;
+
+export default class MyAbilityStage extends AbilityStage {
+ onCreate() {
+ console.log("MyAbilityStage onCreate")
+ let AbilityLifecycleCallback = {
+ onAbilityCreate(ability){
+ console.log("AbilityLifecycleCallback onAbilityCreate ability:" + JSON.stringify(ability));
+ },
+ onAbilityWindowStageCreate(ability){
+ console.log("AbilityLifecycleCallback onAbilityWindowStageCreate ability:" + JSON.stringify(ability));
+ },
+ onAbilityWindowStageDestroy(ability){
+ console.log("AbilityLifecycleCallback onAbilityWindowStageDestroy ability:" + JSON.stringify(ability));
+ },
+ onAbilityDestroy(ability){
+ console.log("AbilityLifecycleCallback onAbilityDestroy ability:" + JSON.stringify(ability));
+ },
+ onAbilityForeground(ability){
+ console.log("AbilityLifecycleCallback onAbilityForeground ability:" + JSON.stringify(ability));
+ },
+ onAbilityBackground(ability){
+ console.log("AbilityLifecycleCallback onAbilityBackground ability:" + JSON.stringify(ability));
+ },
+ onAbilityContinue(ability){
+ console.log("AbilityLifecycleCallback onAbilityContinue ability:" + JSON.stringify(ability));
+ }
+ }
+ // 1. Obtain applicationContext through the context attribute.
+ let applicationContext = this.context.getApplicationContext();
+ // 2. Use applicationContext to register a listener for the ability lifecycle in the application.
+ lifecycleId = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
+ console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleId));
+ }
+ onDestroy() {
+ let applicationContext = this.context.getApplicationContext();
+ applicationContext.unregisterAbilityLifecycleCallback(lifecycleId, (error, data) => {
+ console.log("unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error));
+ });
+ }
+}
+ ```
+
## ApplicationContext.unregisterAbilityLifecycleCallback
@@ -61,47 +103,86 @@ Deregisters the listener that monitors the ability lifecycle of the application.
**Example**
```js
- import AbilityStage from "@ohos.application.AbilityStage";
-
- var lifecycleid;
-
- export default class MyAbilityStage extends AbilityStage {
- onCreate() {
- console.log("MyAbilityStage onCreate")
- let AbilityLifecycleCallback = {
- onAbilityCreate(ability){
- console.log("AbilityLifecycleCallback onAbilityCreate ability:" + JSON.stringify(ability));
- },
- onAbilityWindowStageCreate(ability){
- console.log("AbilityLifecycleCallback onAbilityWindowStageCreate ability:" + JSON.stringify(ability));
- },
- onAbilityWindowStageDestroy(ability){
- console.log("AbilityLifecycleCallback onAbilityWindowStageDestroy ability:" + JSON.stringify(ability));
- },
- onAbilityDestroy(ability){
- console.log("AbilityLifecycleCallback onAbilityDestroy ability:" + JSON.stringify(ability));
- },
- onAbilityForeground(ability){
- console.log("AbilityLifecycleCallback onAbilityForeground ability:" + JSON.stringify(ability));
- },
- onAbilityBackground(ability){
- console.log("AbilityLifecycleCallback onAbilityBackground ability:" + JSON.stringify(ability));
- },
- onAbilityContinue(ability){
- console.log("AbilityLifecycleCallback onAbilityContinue ability:" + JSON.stringify(ability));
- }
- }
- // 1. Obtain applicationContext through the context attribute.
- let applicationContext = this.context.getApplicationContext();
- // 2. Use applicationContext to register a listener for the ability lifecycle in the application.
- lifecycleid = applicationContext.registerAbilityLifecycleCallback(AbilityLifecycleCallback);
- console.log("registerAbilityLifecycleCallback number: " + JSON.stringify(lifecycleid));
- }
- onDestroy() {
- let applicationContext = this.context.getApplicationContext();
- applicationContext.unregisterAbilityLifecycleCallback(lifecycleid, (error, data) => {
- console.log("unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error));
- });
- }
- }
+ let applicationContext = this.context.getApplicationContext();
+ let lifecycleId = 1;
+ console.log("stage applicationContext: " + JSON.stringify(applicationContext));
+ applicationContext.unregisterAbilityLifecycleCallback(lifecycleId, (error, data) => {
+ console.log("unregisterAbilityLifecycleCallback success, err: " + JSON.stringify(error));
+ });
+ ```
+
+## ApplicationContext.registerEnvironmentCallback
+
+registerEnvironmentCallback(callback: EnvironmentCallback): **number**;
+
+Registers a listener for system environment changes. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------------------ | -------- | ---- | ------------------------------ |
+| [EnvironmentCallback](js-apis-application-EnvironmentCallback.md) | callback | Yes | Callback used to return the ID of the registered listener.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ------------------------------ |
+| number | ID of the registered listener. The ID is incremented by 1 each time the listener is registered. When the ID exceeds 2^63-1, **-1** is returned.|
+
+**Example**
+
+ ```js
+import AbilityStage from "@ohos.application.AbilityStage";
+
+var callbackId;
+
+export default class MyAbilityStage extends AbilityStage {
+ onCreate() {
+ console.log("MyAbilityStage onCreate")
+ globalThis.applicationContext = this.context.getApplicationContext();
+ let EnvironmentCallback = {
+ onConfigurationUpdated(config){
+ console.log("onConfigurationUpdated config:" + JSON.stringify(config));
+ },
+ }
+ // 1. Obtain an applicationContext object.
+ let applicationContext = globalThis.applicationContext;
+ // 2. Use applicationContext to register a listener for the ability lifecycle in the application.
+ callbackId = applicationContext.registerEnvironmentCallback(EnvironmentCallback);
+ console.log("registerEnvironmentCallback number: " + JSON.stringify(callbackId));
+ }
+ onDestroy() {
+ let applicationContext = globalThis.applicationContext;
+ applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => {
+ console.log("unregisterEnvironmentCallback success, err: " + JSON.stringify(error));
+ });
+ }
+}
+ ```
+
+## ApplicationContext.unregisterEnvironmentCallback
+
+unregisterEnvironmentCallback(callbackId: **number**, callback: AsyncCallback<**void**>): **void**;
+
+Deregisters the listener for system environment changes. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------------- | -------- | ---- | -------------------------- |
+| callbackId | number | Yes | ID of the listener to deregister. |
+| AsyncCallback | callback | Yes | Callback used to return the result. |
+
+**Example**
+
+ ```js
+ let applicationContext = this.context.getApplicationContext();
+ let callbackId = 1;
+ applicationContext.unregisterEnvironmentCallback(callbackId, (error, data) => {
+ console.log("unregisterEnvironmentCallback success, err: " + JSON.stringify(error));
+ });
```
diff --git a/en/application-dev/reference/apis/js-apis-application-context.md b/en/application-dev/reference/apis/js-apis-application-context.md
index 66cd6b7150041bdbf45d4d0e0adf105e0ade044b..cf5291224477451554ea36e823ecedc0629cbfe0 100644
--- a/en/application-dev/reference/apis/js-apis-application-context.md
+++ b/en/application-dev/reference/apis/js-apis-application-context.md
@@ -1,39 +1,43 @@
# Context
+The **Context** module provides the context for running code. You can use the APIs to query and set the application information and resource manager.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
-Provides the context for running code, including **applicationInfo** and **resourceManager**.
-
-## Modules to Import
-```
-import AbilityContext from '@ohos.application.Ability';
-```
-
## Usage
You must extend **AbilityContext** to implement this module.
+ ```js
+import AbilityContext from '@ohos.application.Ability'
+ class MainAbility extends AbilityContext {
+ onWindowStageCreate(windowStage) {
+ let test = "com.example.test";
+ let context = this.context.createBundleContext(test);
+ }
+ }
+ ```
+
## Attributes
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
- | Name| Type| Readable| Writable| Description|
+| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
-| resourceManager | ResourceManager | Yes| No| **ResourceManager** object.|
+| resourceManager | resmgr.ResourceManager; | Yes| No| **ResourceManager** object.|
| applicationInfo | ApplicationInfo | Yes| No| Information about the application.|
| cacheDir | string | Yes| No| Cache directory of the application on the internal storage.|
| tempDir | string | Yes| No| Temporary file directory of the application.|
| filesDir | string | Yes| No| File directory of the application on the internal storage.|
| databaseDir | string | Yes| No| Storage directory of local data.|
-| storageDir | string | Yes| No| Storage directory of lightweight data.|
| bundleCodeDir | string | Yes| No| Application installation path.|
| distributedFilesDir | string | Yes| No| Storage directory of distributed application data files.|
| eventHub | [EventHub](js-apis-eventhub.md) | Yes| No| Event hub information.|
| area | [AreaMode](#areamode) | Yes| Yes| Area in which the file to be access is located.|
-
+| preferencesDir | string | Yes| Yes| Preferences directory of the application.|
## Context.createBundleContext
@@ -41,19 +45,23 @@ createBundleContext(bundleName: string): Context;
Creates a context for a given application.
+**Required permissions**: ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
+
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System API**: This is a system API and cannot be called by third-party applications.
+
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | bundleName | string | Yes| Application bundle name.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| bundleName | string | Yes| Application bundle name.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Context | Context created.|
+| Type| Description|
+| -------- | -------- |
+| Context | Context created.|
**Example**
@@ -79,15 +87,15 @@ Creates a context for a given HAP.
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | moduleName | string | Yes| HAP name in the application.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| moduleName | string | Yes| HAP name in the application.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Context | Context created.|
+| Type| Description|
+| -------- | -------- |
+| Context | Context created.|
**Example**
@@ -111,18 +119,20 @@ Creates a context for a given HAP in an application.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System API**: This is a system API and cannot be called by third-party applications.
+
**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | bundleName | string | Yes| Application bundle name.|
- | moduleName | string | Yes| HAP name in the application.|
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| bundleName | string | Yes| Application bundle name.|
+| moduleName | string | Yes| HAP name in the application.|
**Return value**
- | Type| Description|
- | -------- | -------- |
- | Context | Context created.|
+| Type| Description|
+| -------- | -------- |
+| Context | Context created.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-application-missionInfo.md b/en/application-dev/reference/apis/js-apis-application-missionInfo.md
deleted file mode 100644
index 05938521e10970192409f856e68b816c18d3f3f0..0000000000000000000000000000000000000000
--- a/en/application-dev/reference/apis/js-apis-application-missionInfo.md
+++ /dev/null
@@ -1,28 +0,0 @@
-# MissionInfo
-
-> **NOTE**
->
-> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-
-## Modules to Import
-
-```js
-import MissionInfo from '@ohos.application.missionInfo'
-```
-
-## MissionInfo
-
-Provides the mission information.
-
-**System capability**: SystemCapability.Ability.AbilityBase
-
-| Name| Type| Readable| Writable| Description|
-| -------- | -------- | -------- | -------- | -------- |
-| missionId | number | Yes| Yes| Mission ID.|
-| runningState | number | Yes| Yes| Running state of the mission.|
-| lockedState | boolean | Yes| Yes| Locked state of the mission.|
-| timestamp | string | Yes| Yes| Latest time when the mission was created or updated.|
-| want | [Want](js-apis-application-Want.md) | Yes| Yes| **Want** information of the mission.|
-| label | string | Yes| Yes| Label of the mission.|
-| iconPath | string | Yes| Yes| Path of the mission icon.|
-| continuable | boolean | Yes| Yes| Whether the mission is continuable.|
diff --git a/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md b/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md
index e0cddeee652418cdd714507cee826971fce73e28..9c47b27f1173eba688942f542cf8eef6e9c90666 100644
--- a/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md
+++ b/en/application-dev/reference/apis/js-apis-application-shellCmdResult.md
@@ -1,20 +1,34 @@
# ShellCmdResult
+The **ShellCmdResult** module provides the shell command execution result.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-## Modules to Import
+## Usage
+
+The result is obtained by calling **executeShellCommand** in **abilityDelegator**.
```js
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
+var abilityDelegator;
+var cmd = "cmd";
+var timeout = 100;
+
+abilityDelegator = AbilityDelegatorRegistry.getAbilityDelegator();
+abilityDelegator.executeShellCommand(cmd, timeout).then((data : any) => {
+ console.info("executeShellCommand promise");
+});
```
## ShellCmdResult
Describes the shell command execution result.
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
| Name | Type | Readable| Writable| Description |
| --------- | ------ | ---- | ---- | ------------------------------------------------------------ |
-| stdResult | string | Yes | Yes | Standard output content.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
-| exitCode | number | Yes | Yes | Result code.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
+| stdResult | string | Yes | Yes | Standard output content. |
+| exitCode | number | Yes | Yes | Result code. |
diff --git a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md
index abd004e82d684fc3b038aebf8fb1153602137476..7c5ba607718d5d14317a55645627022b78976461 100644
--- a/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md
+++ b/en/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md
@@ -1,5 +1,7 @@
# StaticSubscriberExtensionAbility
+The **StaticSubscriberExtensionAbility** module provides Extension abilities for static subscribers.
+
> **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.
@@ -16,13 +18,15 @@ onReceiveEvent(event: CommonEventData): void;
Callback of the common event of a static subscriber.
-**System capability**: SystemCapability.Ability.AbilityRuntime.AbilityCore
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | event | CommonEventData | Yes| Callback of the common event of a static subscriber.|
+ | event | CommonEventData | Yes| Common event of a static subscriber.|
**Example**
diff --git a/en/application-dev/reference/apis/js-apis-appmanager.md b/en/application-dev/reference/apis/js-apis-appmanager.md
index 236ed9c1af1231ebb1ddc8c63356a20f57cb3010..05ff78e77e6d6d54527148782b18d0dbca007cd6 100644
--- a/en/application-dev/reference/apis/js-apis-appmanager.md
+++ b/en/application-dev/reference/apis/js-apis-appmanager.md
@@ -1,21 +1,17 @@
# appManager
+The **appManager** module implements application management. You can use the APIs of this module to query whether the application is undergoing a stability test, whether the application is running on a RAM constrained device, the memory size of the application, and information about the running process.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-
-Implements application management.
-
-
## Modules to Import
-
```js
import app from '@ohos.application.appManager';
```
-
## appManager.isRunningInStabilityTest8+
static isRunningInStabilityTest(callback: AsyncCallback<boolean>): void
@@ -165,6 +161,8 @@ getProcessRunningInfos(): Promise\>;
Obtains information about the running processes. This API uses a promise to return the result.
+**Required permissions**: ohos.permission.GET_RUNNING_INFO
+
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Return value**
@@ -189,6 +187,8 @@ getProcessRunningInfos(callback: AsyncCallback\>): vo
Obtains information about the running processes. This API uses an asynchronous callback to return the result.
+**Required permissions**: ohos.permission.GET_RUNNING_INFO
+
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**Parameters**
@@ -206,13 +206,533 @@ Obtains information about the running processes. This API uses an asynchronous c
})
```
-## ProcessRunningInfo
+## appManager.registerApplicationStateObserver8+
+
+registerApplicationStateObserver(observer: ApplicationStateObserver): number;
+
+Registers the application state observer.
+
+**Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| observer | ApplicationStateObserver | No| Numeric code of the observer.|
+
+**Example**
+
+ ```js
+ var applicationStateObserver = {
+ onForegroundApplicationChanged(appStateData) {
+ console.log('------------ onForegroundApplicationChanged -----------', appStateData);
+ },
+ onAbilityStateChanged(abilityStateData) {
+ console.log('------------ onAbilityStateChanged -----------', abilityStateData);
+ },
+ onProcessCreated(processData) {
+ console.log('------------ onProcessCreated -----------', processData);
+ },
+ onProcessDied(processData) {
+ console.log('------------ onProcessDied -----------', processData);
+ }
+ }
+ const observerCode = app.registerApplicationStateObserver(applicationStateObserver);
+ console.log('-------- observerCode: ---------', observerCode);
+
+ ```
+## appManager.unregisterApplicationStateObserver8+
+
+unregisterApplicationStateObserver(observerId: number, callback: AsyncCallback\): void;
+
+Deregisters the application state observer. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| observerId | number | No| Numeric code of the observer.|
+| callback | AsyncCallback\ | No| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ var observerId = 100;
+
+ function unregisterApplicationStateObserverCallback(err) {
+ if (err) {
+ console.log('------------ unregisterApplicationStateObserverCallback ------------', err);
+ }
+ }
+ app.unregisterApplicationStateObserver(observerId, unregisterApplicationStateObserverCallback);
+ ```
+
+## appManager.unregisterApplicationStateObserver8+
+
+unregisterApplicationStateObserver(observerId: number): Promise\;
+
+Deregisters the application state observer. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.RUNNING_STATE_OBSERVER
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| observerId | number | No| Numeric code of the observer.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ var observerId = 100;
+
+ app.unregisterApplicationStateObserver(observerId)
+ .then((data) => {
+ console.log('----------- unregisterApplicationStateObserver success ----------', data);
+ })
+ .catch((err) => {
+ console.log('----------- unregisterApplicationStateObserver fail ----------', err);
+ })
+ ```
+
+## appManager.getForegroundApplications8+
+
+getForegroundApplications(callback: AsyncCallback\>): void;
+
+Obtains applications that run in the foreground. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.GET_RUNNING_INFO
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callback | AsyncCallback\> | No| Callback used to return the application state data.|
+
+**Example**
+
+ ```js
+ function getForegroundApplicationsCallback(err, data) {
+ if (err) {
+ console.log('--------- getForegroundApplicationsCallback fail ---------', err);
+ } else {
+ console.log('--------- getForegroundApplicationsCallback success ---------', data)
+ }
+ }
+ app.getForegroundApplications(getForegroundApplicationsCallback);
+ ```
+
+## appManager.getForegroundApplications8+
+
+getForegroundApplications(): Promise\>;
+
+Obtains applications that run in the foreground. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.GET_RUNNING_INFO
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Promise\> | Promise used to return the application state data.|
+
+**Example**
+
+ ```js
+ app.getForegroundApplications()
+ .then((data) => {
+ console.log('--------- getForegroundApplications success -------', data);
+ })
+ .catch((err) => {
+ console.log('--------- getForegroundApplications fail -------', err);
+ })
+ ```
+
+## appManager.killProcessWithAccount8+
+
+killProcessWithAccount(bundleName: string, accountId: number): Promise\
+
+Kills the process by bundle name and account ID. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | bundleName | string | Yes| Bundle name of an application.|
+ | accountId | number | Yes| Account ID.|
+
+**Example**
+
+```js
+var bundleName = 'bundleName';
+var accountId = 0;
+app.killProcessWithAccount(bundleName, accountId)
+ .then((data) => {
+ console.log('------------ killProcessWithAccount success ------------', data);
+ })
+ .catch((err) => {
+ console.log('------------ killProcessWithAccount fail ------------', err);
+ })
+```
+
+
+## appManager.killProcessWithAccount8+
+
+killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCallback\): void
+
+Kills the process by bundle name and account ID. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Required permissions**: ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS and ohos.permission.CLEAN_BACKGROUND_PROCESSES
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | bundleName | string | Yes| Bundle name of an application.|
+ | accountId | number | Yes| Account ID.|
+ | callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+```js
+var bundleName = 'bundleName';
+var accountId = 0;
+function killProcessWithAccountCallback(err, data) {
+ if (err) {
+ console.log('------------- killProcessWithAccountCallback fail, err: --------------', err);
+ } else {
+ console.log('------------- killProcessWithAccountCallback success, data: --------------', data);
+ }
+}
+app.killProcessWithAccount(bundleName, accountId, killProcessWithAccountCallback);
+```
+
+## appManager.killProcessesByBundleName8+
+
+killProcessesByBundleName(bundleName: string, callback: AsyncCallback\);
+
+Kills a process by bundle name. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| bundleName | string | No| Bundle name of an application.|
+| callback | AsyncCallback\ | No| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ var bundleName = 'bundleName';
+ function killProcessesByBundleNameCallback(err, data) {
+ if (err) {
+ console.log('------------- killProcessesByBundleNameCallback fail, err: --------------', err);
+ } else {
+ console.log('------------- killProcessesByBundleNameCallback success, data: --------------', data);
+ }
+ }
+ app.killProcessesByBundleName(bundleName, killProcessesByBundleNameCallback);
+ ```
+
+## appManager.killProcessesByBundleName8+
+
+killProcessesByBundleName(bundleName: string): Promise\;
+
+Kills a process by bundle name. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.CLEAN_BACKGROUND_PROCESSES
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| bundleName | string | No| Bundle name of an application.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+ ```js
+var bundleName = 'bundleName';
+app.killProcessesByBundleName(bundleName)
+ .then((data) => {
+ console.log('------------ killProcessesByBundleName success ------------', data);
+ })
+ .catch((err) => {
+ console.log('------------ killProcessesByBundleName fail ------------', err);
+ })
+
+ ```
+
+## appManager.clearUpApplicationData8+
+
+clearUpApplicationData(bundleName: string, callback: AsyncCallback\);
+
+Clears application data by bundle name. This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.CLEAN_APPLICATION_DATA
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| bundleName | string | No| Bundle name of an application.|
+| callback | AsyncCallback\ | No| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ var bundleName = 'bundleName';
+ function clearUpApplicationDataCallback(err, data) {
+ if (err) {
+ console.log('------------- clearUpApplicationDataCallback fail, err: --------------', err);
+ } else {
+ console.log('------------- clearUpApplicationDataCallback success, data: --------------', data);
+ }
+ }
+ app.clearUpApplicationData(bundleName, clearUpApplicationDataCallback);
+
+ ```
+
+## appManager.clearUpApplicationData8+
+
+clearUpApplicationData(bundleName: string): Promise\;
+
+Clears application data by bundle name. This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.CLEAN_APPLICATION_DATA
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| bundleName | string | No| Bundle name of an application.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ var bundleName = 'bundleName';
+ app.clearUpApplicationData(bundleName)
+ .then((data) => {
+ console.log('------------ clearUpApplicationData success ------------', data);
+ })
+ .catch((err) => {
+ console.log('------------ clearUpApplicationData fail ------------', err);
+ })
+
+ ```
+
+## ApplicationStateObserver.onForegroundApplicationChanged8+
+
+onForegroundApplicationChanged(appStateData: AppStateData): void;
+
+Called when the application state changes.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| appStateData | [AppStateData](#appstatedata) | No| Information about the application whose state is changed.|
+
+**Example**
+
+```js
+import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver'
+const foregroundApplicationInfo = ApplicationStateObserver.onForegroundApplicationChanged();
+console.log('-------- foregroundApplicationInfo: ---------', foregroundApplicationInfo);
+```
+
+## ApplicationStateObserver.onAbilityStateChanged8+
+
+onAbilityStateChanged(abilityStateData: AbilityStateData): void;
+
+Called when the ability state changes.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| abilityStateData | [AbilityStateData](#abilitystatedata) | No| Information about the ability whose state is changed.|
+
+**Example**
+
+```js
+import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver'
+const abilityStateChangedInfo = ApplicationStateObserver.onAbilityStateChanged();
+console.log('-------- abilityStateChangedInfo: ---------', abilityStateChangedInfo);
+```
+
+## ApplicationStateObserver.onProcessCreated8+
+
+onProcessCreated(processData: ProcessData): void;
+
+Called when a process is created.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| processData | [ProcessData](#processdata) | No| Process information.|
+
+**Example**
+
+```js
+import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver'
+const processCreatedInfo = ApplicationStateObserver.onProcessCreated();
+console.log('-------- processCreatedInfo: ---------', processCreatedInfo);
+```
+
+## ApplicationStateObserver.onProcessDied8+
+
+onProcessDied(processData: ProcessData): void;
+
+Called when a process is terminated.
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| processData | ProcessData | No| Process information.|
+
+**Example**
+
+```js
+import ApplicationStateObserver from '@ohos.application.ApplicationStateObserver'
+const processDiedInfo = ApplicationStateObserver.onProcessDied();
+console.log('-------- processDiedInfo: ---------', processDiedInfo);
+```
+
+## AppStateData
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
-| pid8+ | Read only | number | No | Process ID. |
+| bundleName8+ | Read only | string | No | Bundle name of an application. |
| uid8+ | Read only | number | No | User ID.|
-| processName8+ | Read only | string | No | Process name.|
-| bundleNames8+ | Read only | Array\ | No | **bundleName** array in the running processes.|
+| state8+ | Read only | number | No | Application state.|
+
+## AbilityStateData
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+| Name | Type | Readable| Writable| Description |
+| ----------------------- | ---------| ---- | ---- | ------------------------- |
+| pid8+ | number | Yes | No | Process ID. |
+| bundleName8+ | string | Yes | No | Bundle name of an application. |
+| abilityName8+ | string | Yes | No | Ability name. |
+| uid8+ | number | Yes | No | User ID. |
+| state8+ | number | Yes | No | Application information. |
+| moduleName9+ | string | Yes | No | Name of the HAP file to which the ability belongs. |
+| abilityType8+ | string | Yes | No | Ability type. |
+
+## ProcessData
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+| Name | Type | Readable| Writable| Description |
+| ----------------------- | ---------| ---- | ---- | ------------------------- |
+| pid8+ | number | Yes | No | Process ID. |
+| bundleName8+ | string | Yes | No | Bundle name of an application. |
+| uid8+ | number | Yes | No | User ID. |
+
+
+
+## ProcessRunningInfo
+
+**System capability**: SystemCapability.Ability.AbilityRuntime.Core
+
+| Name | Readable/Writable| Type | Mandatory| Description |
+| ----------- | -------- | -------------------- | ---- | ------------------------------------------------------------ |
+| pid9+ | Read only | number | No | Process ID. |
+| uid9+ | Read only | number | No | User ID.|
+| processName9+ | Read only | string | No | Process name.|
+| bundleNames9+ | Read only | Array\ | No | **bundleName** array in the running processes.|
diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md
index 894370d603afe13fef35c965beb2adaec6f1ef8b..68d01ed3f45885cf6b53fb3de35fc9b3e6c45da5 100644
--- a/en/application-dev/reference/apis/js-apis-audio.md
+++ b/en/application-dev/reference/apis/js-apis-audio.md
@@ -2273,7 +2273,43 @@ Writes the buffer. This API uses an asynchronous callback to return the result.
```
import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio';
+import featureAbility from '@ohos.ability.featureAbility'
+var audioStreamInfo = {
+ samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
+ channels: audio.AudioChannel.CHANNEL_2,
+ sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
+ encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
+}
+
+var audioRendererInfo = {
+ content: audio.ContentType.CONTENT_TYPE_SPEECH,
+ usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION
+ rendererFlags: 1
+}
+
+var audioRendererOptions = {
+ streamInfo: audioStreamInfo,
+ rendererInfo: audioRendererInfo
+}
+var audioRenderer;
+audio.createAudioRenderer(audioRendererOptions).then((data)=> {
+ audioRenderer = data;
+ console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
+ }).catch((err) => {
+ console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
+ });
+var bufferSize;
+audioRenderer.getBufferSize().then((data)=> {
+ console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
+ bufferSize = data;
+ }).catch((err) => {
+ console.info.('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
+ });
+console.info('Buffer size:'+bufferSize);
+var context = featureAbility.getContext();
+var path = await context.getCacheDir();
+var filePath = path+"/StarWars10s-2C-48000-4SW.wav"
let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize);
ss.readSync(buf);
@@ -2305,7 +2341,42 @@ Writes the buffer. This API uses a promise to return the result.
```
import audio from '@ohos.multimedia.audio';
import fileio from '@ohos.fileio';
+import featureAbility from '@ohos.ability.featureAbility'
+
+var audioStreamInfo = {
+ samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000,
+ channels:audio.AudioChannel.CHANNEL_2,
+ sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
+ encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW
+}
+
+var audioRendererInfo = {
+ content: audio.ContentType.CONTENT_TYPE_SPEECH,
+ usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
+ rendererFlags: 1
+}
+var audioRendererOptions = {
+ streamInfo: audioStreamInfo,
+ rendererInfo: audioRendererInfo
+}
+var audioRenderer;
+audio.createAudioRenderer(audioRendererOptions).then((data) => {
+ audioRenderer = data;
+ console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
+ }).catch((err) => {
+ console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
+ });
+var bufferSize;
+audioRenderer.getBufferSize().then((data) => {
+ console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
+ bufferSize = data;
+ }).catch((err) => {
+ console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
+ });
+console.info('BufferSize: ' + bufferSize);
+var context = featureAbility.getContext();
+var path = await context.getCacheDir();
var filePath = 'data/StarWars10s-2C-48000-4SW.wav';
let ss = fileio.createStreamSync(filePath, 'r');
let buf = new ArrayBuffer(bufferSize);
@@ -2408,12 +2479,39 @@ Obtains a reasonable minimum buffer size in bytes for rendering. This API uses a
**Example**
```
+import audio from '@ohos.multimedia.audio';
+import fileio from '@ohos.fileio';
+
+var audioStreamInfo = {
+ samplingRate:audio.AudioSamplingRate.SAMPLE_RATE_48000,
+ channels:audio.AudioChannel.CHANNEL_2,
+ sampleFormat.audio.AudioSampleFormat.SAMPLE_FORMAT_S32LE,
+ encodingType.audio.AudioEncodingType.ENCODING_TYPE_RAW
+}
+
+var audioRendererInfo = {
+ content: audio.ContentType.CONTENT_TYPE_SPEECH,
+ usage: audio.streamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
+ rendererFlags: 1
+}
+
+var audioRendererOptions = {
+ streamInfo: audioStreamInfo,
+ rendererInfo: audioRendererInfo
+}
+var audioRenderer;
+audio.createAudioRenderer(audioRendererOptions).then((data) => {
+ audioRenderer = data;
+ console.info('AudioFrameworkRenderLog: AudioRenderer Created: SUCCESS');
+ }).catch((err) => {
+ console.info('AudioFrameworkRenderLog: AudioRenderer Created: ERROR: '+err.message);
+ });
var bufferSize;
-await audioRenderer.getBufferSize().then(async function (data) => {
- console.info('AudioFrameworkRenderLog: getBufferSize :SUCCESS '+data);
+audioRenderer.getBufferSize().then((data) => {
+ console.info('AudioFrameworkRenderLog: getBufferSize: SUCCESS '+data);
bufferSize=data;
}).catch((err) => {
- console.info('AudioFrameworkRenderLog: getBufferSize :ERROR : '+err.message);
+ console.info('AudioFrameworkRenderLog: getBufferSize: ERROR: '+err.message);
});
```
@@ -2542,7 +2640,8 @@ Sets the audio interruption mode for the application. This API uses a promise to
**Example**
```
-audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE).then(() => {
+const audioManager = audio.getAudioManager();
+audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE).then(() => {
console.log('Promise returned to indicate a successful volume setting.');
});
```
@@ -2564,7 +2663,8 @@ Sets the audio interruption mode for the application. This API uses a callback t
**Example**
```
-audioManager.setInterruptMode(audio.InterruptType.SHARE_MODE,()=>{
+const audioManager = audio.getAudioManager();
+audioManager.setInterruptMode(audio.InterruptMode.SHARE_MODE,()=>{
console.log('Callback returned to indicate a successful volume setting.');
});
```
@@ -2654,7 +2754,7 @@ Subscribes to mark reached events. When the number of frames rendered reaches th
```
audioRenderer.on('markReach', 1000, (position) => {
- if (position == "1000") {
+ if (position == 1000) {
console.log('ON Triggered successfully');
}
});
@@ -2701,7 +2801,7 @@ Subscribes to period reached events. When the period of frame rendering reaches
```
audioRenderer.on('periodReach', 1000, (position) => {
- if (position == "1000") {
+ if (position == 1000) {
console.log('ON Triggered successfully');
}
});
@@ -2935,13 +3035,35 @@ Starts capturing. This API uses a promise to return the result.
**Example**
```
+import audio from '@ohos.multimedia.audio';
+import fileio from '@ohos.fileio';
+
+var audioStreamInfo = {
+ samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
+ channels: audio.AudioChannel.CHANNEL_2,
+ sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
+ encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
+}
+
+var audioCapturerInfo = {
+ source: audio.SourceType.SOURCE_TYPE_MIC,
+ capturerFlags = 1
+}
+
+var audioCapturer;
+audio.createAudioCapturer(audioCapturerOptions).then((data) => {
+ audioCapturer = data;
+ console.info('AudioFrameworkRecLog: AudioCapturer Created: SUCCESS');
+ }).catch((err) => {
+ console.info('AudioFrameworkRecLog: AudioCapturer Created: ERROR: '+err.message);
+ });
audioCapturer.start().then(() => {
console.info('AudioFrameworkRecLog: ---------START---------');
- console.info('AudioFrameworkRecLog: Capturer started :SUCCESS ');
- console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state);
- console.info('AudioFrameworkRecLog: Capturer started :SUCCESS ');
+ console.info('AudioFrameworkRecLog: Capturer started: SUCCESS');
+ console.info('AudioFrameworkRecLog: AudioCapturer: STATE: '+audioCapturer.state);
+ console.info('AudioFrameworkRecLog: Capturer started: SUCCESS ');
if ((audioCapturer.state == audio.AudioState.STATE_RUNNING)) {
- stateFlag = true;
+ console.info('AudioFrameworkRecLog: AudioCapturer is in Running State');
}
}).catch((err) => {
console.info('AudioFrameworkRecLog: Capturer start :ERROR : '+err.message);
@@ -2994,15 +3116,13 @@ Stops capturing. This API uses a promise to return the result.
```
audioCapturer.stop().then(() => {
- console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
- console.info('AudioFrameworkRecLog: Capturer stopped : SUCCESS');
+ console.info('AudioFrameworkRecLog: ---------STOP RECORD---------');
+ console.info('AudioFrameworkRecLog: Capturer stopped: SUCCESS');
if ((audioCapturer.state == audio.AudioState.STATE_STOPPED)){
- stateFlag=true;
- console.info('AudioFrameworkRecLog: resultFlag : '+stateFlag);
+ console.info('AudioFrameworkRecLog: State is Stopped': ');
}
}).catch((err) => {
- console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message);
- stateFlag=false;
+ console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
});
```
@@ -3054,11 +3174,9 @@ audioCapturer.release().then(() => {
console.info('AudioFrameworkRecLog: ---------RELEASE RECORD---------');
console.info('AudioFrameworkRecLog: Capturer release : SUCCESS');
console.info('AudioFrameworkRecLog: AudioCapturer : STATE : '+audioCapturer.state);
- stateFlag=true;
console.info('AudioFrameworkRecLog: stateFlag : '+stateFlag);
}).catch((err) => {
- console.info('AudioFrameworkRecLog: Capturer stop:ERROR : '+err.message);
- stateFlag=false
+ console.info('AudioFrameworkRecLog: Capturer stop: ERROR: '+err.message);
});
```
@@ -3082,6 +3200,13 @@ Reads the buffer. This API uses an asynchronous callback to return the result.
**Example**
```
+var bufferSize;
+audioCapturer.getBufferSize().then((data) => {
+ console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data);
+ bufferSize = data;
+ }).catch((err) => {
+ console.info('AudioFrameworkRecLog: getBufferSize: EROOR: '+err.message);
+ });
audioCapturer.read(bufferSize, true, async(err, buffer) => {
if (!err) {
console.log("Success in reading the buffer data");
@@ -3114,6 +3239,14 @@ Reads the buffer. This API uses a promise to return the result.
**Example**
```
+var bufferSize;
+audioCapturer.getBufferSize().then((data) => {
+ console.info('AudioFrameworkRecLog: getBufferSize: SUCCESS '+data);
+ bufferSize = data;
+ }).catch((err) => {
+ console.info('AudioFrameworkRecLog: getBufferSize: ERROR '+err.message);
+ });
+console.info('Buffer size: ' + bufferSize);
audioCapturer.read(bufferSize, true).then((buffer) => {
console.info('buffer read successfully');
}).catch((err) => {
@@ -3217,12 +3350,12 @@ Obtains a reasonable minimum buffer size in bytes for capturing. This API uses a
**Example**
```
-await audioCapturer.getBufferSize().then(async function (bufferSize) {
- console.info('AudioFrameworkRecordLog: getBufferSize :SUCCESS '+ bufferSize);
- var buffer = await audioCapturer.read(bufferSize, true);
- console.info('Buffer read is ' + buffer );
- }).catch((err) => {
- console.info('AudioFrameworkRecordLog: getBufferSize :ERROR : '+err.message);
+var bufferSize;
+audioCapturer.getBufferSize().then((data) => {
+ console.info('AudioFrameworkRecLog: getBufferSize :SUCCESS '+ data);
+ bufferSize = data;
+}).catch((err) => {
+ console.info('AudioFrameworkRecLog: getBufferSize :ERROR : '+ err.message);
});
```
@@ -3247,7 +3380,7 @@ Subscribes to mark reached events. When the number of frames captured reaches th
```
audioCapturer.on('markReach', 1000, (position) => {
- if (position == "1000") {
+ if (position == 1000) {
console.log('ON Triggered successfully');
}
});
@@ -3293,7 +3426,7 @@ Subscribes to mark reached events. When the period of frame capturing reaches th
```
audioCapturer.on('periodReach', 1000, (position) => {
- if (position == "1000") {
+ if (position == 1000) {
console.log('ON Triggered successfully');
}
});
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md
index 5eacfc8a69610d57abec3afdd0fba6f7addaa30b..32dc8d6c6ebea54129c103a2323dacdc34a442c1 100644
--- a/en/application-dev/reference/apis/js-apis-bluetooth.md
+++ b/en/application-dev/reference/apis/js-apis-bluetooth.md
@@ -1011,7 +1011,7 @@ bluetooth.off('sppRead', clientNumber);
```
-## bluetooth.getProfile8+
+## bluetooth.getProfile8+
getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile
@@ -1037,9 +1037,9 @@ Obtains a profile object.
let a2dpSrc = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_A2DP_SOURCE);
```
-## bluetooth.getProfile9+
+## bluetooth.getProfileInst9+
-getProfile(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile
+getProfileInst(profileId: ProfileId): A2dpSourceProfile | HandsFreeAudioGatewayProfile | HidHostProfile | PanProfile
Obtains a profile instance. API version 9 is added with **HidHostProfile** and **PanProfile**.
@@ -1060,7 +1060,7 @@ Obtains a profile instance. API version 9 is added with **HidHostProfile** and *
**Example**
```js
-let hidHost = bluetooth.getProfile(bluetooth.ProfileId.PROFILE_HID_HOST);
+let hidHost = bluetooth.getProfileInst(bluetooth.ProfileId.PROFILE_HID_HOST);
```
@@ -1451,14 +1451,12 @@ a2dpSrc.off('connectionStateChange', onReceiveEvent);
```
-### getPlayingState9+
+### getPlayingState8+
getPlayingState(device: string): PlayingState
Obtains the playing state of a device.
-**Required permissions**: ohos.permission.USE_BLUETOOTH
-
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Parameters**
@@ -1559,7 +1557,7 @@ Subscribes to the HFP connection state change events.
| Name | Type | Mandatory | Description |
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| type | string | Yes | Event type. The value **connectionStateChange** indicates an HFP connection state change event.|
-| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback invoked to return the HFP connection state change event. |
+| callback | Callback<[StateChangeParam](#StateChangeParam)> | Yes | Callback used to return the HFP connection state change event. |
**Return value**
@@ -1612,7 +1610,7 @@ hfpAg.off('connectionStateChange', onReceiveEvent);
Before using a method of **HidHostProfile**, you need to create an instance of this class by using the **getProfile()** method.
-### connect9+
+### connect9+
connect(device: string): boolean
@@ -1644,7 +1642,7 @@ let ret = hidHostProfile.connect('XX:XX:XX:XX:XX:XX');
```
-### disconnect9+
+### disconnect9+
disconnect(device: string): boolean
@@ -1742,7 +1740,7 @@ hidHost.off('connectionStateChange', onReceiveEvent);
Before using a method of **PanProfile**, you need to create an instance of this class by using the **getProfile()** method.
-### disconnect9+
+### disconnect9+
disconnect(device: string): boolean
@@ -1837,7 +1835,7 @@ panProfile.off('connectionStateChange', onReceiveEvent);
### setTethering9+
-setTethering(value: boolean): boolean
+setTethering(enable: boolean): void
Sets tethering.
@@ -1871,12 +1869,10 @@ let ret = panProfile.setTethering(true);
isTetheringOn(): boolean
-Obtains the tethering status.
+Obtains the tethering state.
This is a system API.
-**Required permissions**: ohos.permission.DISCOVER_BLUETOOTH
-
**System capability**: SystemCapability.Communication.Bluetooth.Core
**Return value**
@@ -2019,7 +2015,7 @@ let descV = new Uint8Array(arrayBuffer);
descV[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
- descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
+ descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
descriptors[0] = descriptor;
// Create characteristics.
@@ -2129,7 +2125,7 @@ let descV = new Uint8Array(arrayBuffer);
descV[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
- descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
+ descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
descriptors[0] = descriptor;
let arrayBufferC = new ArrayBuffer(8);
let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
@@ -2502,7 +2498,6 @@ let gattServer = bluetooth.BLE.createGattServer();
gattServer.off("descriptorWrite");
```
-
### on('connectStateChange')
on(type: "connectStateChange", callback: Callback<BLEConnectChangedState>): void
@@ -2709,8 +2704,10 @@ Obtains all services of the remote BLE device. This API uses a promise to return
```js
// Promise
-gattClientDevice.getServices().then(result => {
- console.info("Got services successfully:" + JSON.stringify(result));
+let device = bluetooth.BLE.createGattClientDevice('XX:XX:XX:XX:XX:XX');
+device.connect();
+device.getServices().then(result => {
+ console.info("getServices successfully:" + JSON.stringify(result));
});
```
@@ -3051,7 +3048,7 @@ let descV = new Uint8Array(arrayBuffer);
descV[0] = 11;
let descriptor = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
characteristicUuid: '00001820-0000-1000-8000-00805F9B34FB',
- descriptorUuid: '00001830-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
+ descriptorUuid: '00002902-0000-1000-8000-00805F9B34FB', descriptorValue: arrayBuffer};
descriptors[0] = descriptor;
let arrayBufferC = new ArrayBuffer(8);
let characteristic = {serviceUuid: '00001810-0000-1000-8000-00805F9B34FB',
@@ -3311,7 +3308,7 @@ Enumerates the scan modes.
**System capability**: SystemCapability.Communication.Bluetooth.Core
-| Name | Default Value | Description |
+| Name | Default Value | Description |
| ---------------------------------------- | ---- | --------------- |
| SCAN_MODE_NONE | 0 | No scan mode. |
| SCAN_MODE_CONNECTABLE | 1 | Connectable mode. |
@@ -3326,7 +3323,7 @@ Enumerates the pairing states.
**System capability**: SystemCapability.Communication.Bluetooth.Core
-| Name | Default Value | Description |
+| Name | Default Value | Description |
| ------------------ | ---- | ------ |
| BOND_STATE_INVALID | 0 | Invalid pairing.|
| BOND_STATE_BONDING | 1 | Pairing. |
@@ -3352,7 +3349,7 @@ Enumerates the SPP link types.
**System capability**: SystemCapability.Communication.Bluetooth.Core
-| Name | Default Value | Description |
+| Name | Default Value | Description |
| ---------- | ---- | ------------- |
| SPP_RFCOMM | 0 | Radio frequency communication (RFCOMM) link type.|
@@ -3536,7 +3533,7 @@ Defines the scan filter parameters.
| serviceSolicitationUuidMask9+ | string | Yes | Yes | Service solicitation UUID mask of the device to filter, for example, **FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF**.|
| serviceData9+ | ArrayBuffer | Yes | Yes | Service data of the device to filter, for example, **[0x90, 0x00, 0xF1, 0xF2]**.|
| serviceDataMask9+ | ArrayBuffer | Yes | Yes | Service data mask of the device to filter, for example, **[0xFF,0xFF,0xFF,0xFF]**.|
-| manufacturerId9+ | number | Yes | Yes | Manufacturer ID of the device to filter, for example, **0x0006**. |
+| manufactureId9+ | number | Yes | Yes | Manufacturer ID of the device to filter, for example, **0x0006**. |
| manufactureData9+ | ArrayBuffer | Yes | Yes | Manufacturer data of the device to filter, for example, **[0x1F,0x2F,0x3F]**.|
| manufactureDataMask9+ | ArrayBuffer | Yes | Yes | Manufacturer data mask of the device to filter, for example, **[0xFF, 0xFF, 0xFF]**.|
@@ -3617,7 +3614,7 @@ Defines the BLE advertising parameters.
| Name | Type | Readable | Writable | Description |
| ----------- | ------- | ---- | ---- | ---------------------------------------- |
-| interval | number | Yes | Yes | Interval for BLE advertising. The minimum value is **32** slots (20 ms). The maximum value is **16777215** slots. The default value is **1600** slots (1s).|
+| interval | number | Yes | Yes | Interval for BLE advertising. The minimum value is **32** slots (20 ms). The maximum value is **16384** slots. The default value is **1600** slots (1s).|
| txPower | number | Yes | Yes | Transmit power, in dBm. The value range is -127 to 1. The default value is **-7**. |
| connectable | boolean | Yes | Yes | Whether the advertisement is connectable. The default value is **true**. |
@@ -3828,7 +3825,7 @@ Enumerates the A2DP playing states.
## ProfileId8+
-Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST**.
+Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOST** and **PROFILE_PAN_NETWORK**.
**System capability**: SystemCapability.Communication.Bluetooth.Core
@@ -3837,3 +3834,4 @@ Enumerates the Bluetooth profiles. API version 9 is added with **PROFILE_HID_HOS
| PROFILE_A2DP_SOURCE | 0x0001 | A2DP profile.|
| PROFILE_HANDS_FREE_AUDIO_GATEWAY | 0x0004 | HFP profile. |
| PROFILE_HID_HOST9+ | 0x0006 | Human Interface Device (HID) profile. |
+| PROFILE_PAN_NETWORK9+ | 0x0007 | PAN profile. |
diff --git a/en/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md b/en/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md
index 185338803c92789aea72fa0fca2ab7791ab89ea1..94182ce2915f60bd6998f512d17288920549d3f8 100644
--- a/en/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md
+++ b/en/application-dev/reference/apis/js-apis-bundle-ApplicationInfo.md
@@ -1,17 +1,15 @@
# ApplicationInfo
+The **ApplicationInfo** module provides application information. Unless otherwise specified, all attributes are obtained through **GET_BUNDLE_DEFAULT**.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-Provides the application information.
-
## ApplicationInfo
**System capability**: SystemCapability.BundleManager.BundleFramework
-
-
| Name | Type | Readable| Writable| Description |
| -------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
| name | string | Yes | No | Application name. |
@@ -26,16 +24,19 @@ Provides the application information.
| process | string | Yes | No | Process in which the application runs. If this parameter is not set, the bundle name is used. |
| supportedModes | number | Yes | No | Running modes supported by the application. |
| moduleSourceDirs | Array\ | Yes | No | Relative paths for storing application resources. |
-| permissions | Array\ | Yes | No | Permissions required for accessing the application. |
+| permissions | Array\ | Yes | No | Permissions required for accessing the application.
The value is obtained by passing **GET_APPLICATION_INFO_WITH_PERMISSION**.|
| moduleInfos | Array\<[ModuleInfo](js-apis-bundle-ModuleInfo.md)> | Yes | No | Application module information. |
| entryDir | string | Yes | No | Path for storing application files. |
| codePath8+ | string | Yes | No | Installation directory of the application. |
-| metaData8+ | Map\> | Yes | No | Custom metadata of the application. |
-| metadata9+ | Map\> | Yes | No | Metadata of the application. |
+| metaData8+ | Map\> | Yes | No | Custom metadata of the application.
The value is obtained by passing **GET_APPLICATION_INFO_WITH_METADATA**.|
+| metadata9+ | Map\> | Yes | No | Metadata of the application.
The value is obtained by passing **GET_APPLICATION_INFO_WITH_METADATA**.|
| removable8+ | boolean | Yes | No | Whether the application is removable. |
| accessTokenId8+ | number | Yes | No | Access token ID of the application. |
| uid8+ | number | Yes | No | UID of the application. |
| entityType8+ | string | Yes | No | Entity type of the application. |
-| fingerprint9+ | string | Yes | No | Signing certificate fingerprint of the application, that is, the SHA-256 checksum of the signing certificate that you request for the application.|
+| fingerprint9+ | string | Yes | No | Signing certificate fingerprint of the application, that is, the SHA-256 checksum of the signing certificate that you request for the application.
The value is obtained by passing **GET_APPLICATION_INFO_WITH_CERTIFICATE_FINGERPRINT**.|
+| iconResource9+ | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Icon resource of the application.|
+| labelResource9+ | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Label resource of the application.|
+| descriptionResource9+ | [Resource](js-apis-resource-manager.md#resource9) | Yes| No| Description resource of the application.|
| appDistributionType9+ | string | Yes | No | Distribution type of the application signing certificate. The options are **app_gallery**, **enterprise**, **os_integration**, and **crowdtesting**. |
| appProvisionType9+ | string | Yes | No | Type of the application signing certificate file. The options are **debug** and **release**.|
diff --git a/en/application-dev/reference/apis/js-apis-bundle-BundleInfo.md b/en/application-dev/reference/apis/js-apis-bundle-BundleInfo.md
index f9e8ea3be2d7ccfff71426848d2dbc2f0e349201..eb85e5d52d50068b8147c1a4789389b2cf5506e1 100644
--- a/en/application-dev/reference/apis/js-apis-bundle-BundleInfo.md
+++ b/en/application-dev/reference/apis/js-apis-bundle-BundleInfo.md
@@ -1,45 +1,41 @@
# BundleInfo
-
-
> **NOTE**
>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-
-
-Provides the application bundle information.
+The **BundleInfo** module provides bundle information. Unless otherwise specified, all attributes are obtained through **GET_BUNDLE_DEFAULT**.
## BundleInfo
**System capability**: SystemCapability.BundleManager.BundleFramework
-| Name | Type | Readable| Writable| Description |
-| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------ |
-| name | string | Yes | No | Bundle name. |
-| type | string | Yes | No | Bundle type. |
-| appId | string | Yes | No | ID of the application to which the bundle belongs. |
-| uid | number | Yes | No | UID of the application to which the bundle belongs. |
-| installTime | number | Yes | No | Time when the HAP file was installed. |
-| updateTime | number | Yes | No | Time when the HAP file was updated. |
-| appInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application configuration information. |
-| abilityInfos | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | No | Ability configuration information. |
-| reqPermissions | Array\ | Yes | No | Permissions to request from the system for running the application. |
-| reqPermissionDetails | Array\<[ReqPermissionDetail](#ReqPermissionDetail)> | Yes | No | Detailed information of the permissions to request from the system.|
-| vendor | string | Yes | No | Vendor of the bundle. |
-| versionCode | number | Yes | No | Version number of the bundle. |
-| versionName | string | Yes | No | Version description of the bundle. |
-| compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. |
-| targetVersion | number | Yes | No | Latest SDK version required for running the bundle. |
-| isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. |
-| hapModuleInfos | Array\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Yes | No | Module configuration information. |
-| entryModuleName | string | Yes | No | Name of the entry module. |
-| cpuAbi | string | Yes | No | cpuAbi information of the bundle. |
-| isSilentInstallation | string | Yes | No | Whether the application can be installed in silent mode. |
-| minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. |
-| entryInstallationFree | boolean | Yes | No | Whether installation-free is supported for the entry module. |
-| reqPermissionStates8+ | Array\ | Yes | No | Permission grant state. |
-| extensionAbilityInfo9+ | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | Yes | No | Extension ability information. |
+| Name | Type | Readable| Writable| Description |
+| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | ------------------------------------------------------------ |
+| name | string | Yes | No | Bundle name. |
+| type | string | Yes | No | Bundle type. |
+| appId | string | Yes | No | ID of the application to which the bundle belongs. |
+| uid | number | Yes | No | UID of the application to which the bundle belongs. |
+| installTime | number | Yes | No | Time when the HAP file was installed. |
+| updateTime | number | Yes | No | Time when the HAP file was updated. |
+| appInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application configuration information. |
+| abilityInfos | Array\<[AbilityInfo](js-apis-bundle-AbilityInfo.md)> | Yes | No | Ability configuration information.
The value is obtained by passing **GET_BUNDLE_WITH_ABILITIES**.|
+| reqPermissions | Array\ | Yes | No | Permissions to request from the system for running the application.
The value is obtained by passing **GET_BUNDLE_WITH_REQUESTED_PERMISSION**.|
+| reqPermissionDetails | Array\<[ReqPermissionDetail](#reqpermissiondetail)> | Yes | No | Detailed information of the permissions to request from the system.
The value is obtained by passing **GET_BUNDLE_WITH_REQUESTED_PERMISSION**.|
+| vendor | string | Yes | No | Vendor of the bundle. |
+| versionCode | number | Yes | No | Version number of the bundle. |
+| versionName | string | Yes | No | Version description of the bundle. |
+| compatibleVersion | number | Yes | No | Earliest SDK version required for running the bundle. |
+| targetVersion | number | Yes | No | Latest SDK version required for running the bundle. |
+| isCompressNativeLibs | boolean | Yes | No | Whether to compress the native library of the bundle. The default value is **true**. |
+| hapModuleInfos | Array\<[HapModuleInfo](js-apis-bundle-HapModuleInfo.md)> | Yes | No | Module configuration information. |
+| entryModuleName | string | Yes | No | Name of the entry module. |
+| cpuAbi | string | Yes | No | CPU and ABI information of the bundle. |
+| isSilentInstallation | string | Yes | No | Whether the application can be installed in silent mode. |
+| minCompatibleVersionCode | number | Yes | No | Earliest version compatible with the bundle in the distributed scenario. |
+| entryInstallationFree | boolean | Yes | No | Whether installation-free is supported for the entry module. |
+| reqPermissionStates8+ | Array\ | Yes | No | Permission grant state. |
+| extensionAbilityInfo9+ | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | Yes | No | Extension ability information.
The value is obtained by passing **GET_BUNDLE_WITH_EXTENSION_ABILITY**.|
diff --git a/en/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md b/en/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md
index 3c98a25b721a8f3cce41f927d7a35456761db366..9b11bb2f18da535af770b96cda13981cef95c62a 100644
--- a/en/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md
+++ b/en/application-dev/reference/apis/js-apis-bundle-ExtensionAbilityInfo.md
@@ -6,9 +6,7 @@
>
> 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.
-
-
-Provides the Extension ability information.
+The **ExtensionAbilityInfo** module provides Extension ability information. Unless otherwise specified, all attributes are obtained through **GET_BUNDLE_DEFAULT**.
## ExtensionAbilityInfo
@@ -28,5 +26,5 @@ Provides the Extension ability information.
| applicationInfo | [ApplicationInfo](js-apis-bundle-ApplicationInfo.md) | Yes | No | Application information of the Extension ability. |
| metadata | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the Extension ability. |
| enabled | boolean | Yes | No | Whether the Extension ability is enabled. |
-| readPermission | string | Yes | No | Permission required for reading the Extension ability data. |
+| readPermission | string | Yes | No | Permission required for reading data from the Extension ability. |
| writePermission | string | Yes | No | Permission required for writing data to the Extension ability. |
diff --git a/en/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md b/en/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md
index 2f6dbbef26e41ec1f78fe5768c2389d1a8ee0578..5a11609281eebb7464b1e627ec432b4ffad72700 100644
--- a/en/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md
+++ b/en/application-dev/reference/apis/js-apis-bundle-HapModuleInfo.md
@@ -6,16 +6,12 @@
>
> 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.
-
-
-Provides the HAP module information.
+The **HapModuleInfo** module provides module information. Unless otherwise specified, all attributes are obtained through **GET_BUNDLE_DEFAULT**.
## HapModuleInfo
**System capability**: SystemCapability.BundleManager.BundleFramework
-
-
| Name | Type | Readable| Writable| Description |
| --------------------------------- | ------------------------------------------------------------ | ---- | ---- | -------------------- |
| name | string | Yes | No | Module name. |
@@ -36,4 +32,4 @@ Provides the HAP module information.
| mainElementName9+ | string | Yes | No | Information about the main ability. |
| extensionAbilityInfo9+ | Array\<[ExtensionAbilityInfo](js-apis-bundle-ExtensionAbilityInfo.md)> | Yes | No | Information about the Extension ability.|
| metadata9+ | Array\<[Metadata](js-apis-bundle-Metadata.md)> | Yes | No | Metadata of the ability. |
-| hashValue9+ | string | Yes | No | Hash value of the module. |
+| hashValue9+ | string | Yes | No | Hash value of the module.
The value is obtained by passing **GET_BUNDLE_WITH_HASH_VALUE**.|
diff --git a/en/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md b/en/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md
new file mode 100644
index 0000000000000000000000000000000000000000..e80cf7f78b02192642a29794feaf794052bd4dc4
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-bundle-defaultAppManager.md
@@ -0,0 +1,474 @@
+# DefaultAppManager
+
+The **DefaultAppManager** module provides APIs to query whether the current application is the default application of a specific type.
+
+> **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
+
+```
+import defaultAppMgr from '@ohos.bundle.defaultAppManager'
+```
+## defaultAppMgr.ApplicationType
+
+Enumerates the application types.
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+| Name | Type | Description |
+| -------- | -------- | -------------------------------------- |
+| BROWSER | string | Default browser. |
+| IMAGE | string | Default image viewer. |
+| AUDIO | string | Default audio player. |
+| VIDEO | string | Default video player. |
+| PDF | string | Default PDF reader. |
+| WORD | string | Default Word viewer. |
+| EXCEL | string | Default Excel viewer. |
+| PPT | string | Default PowerPoint viewer. |
+
+## defaultAppMgr.isDefaultApplication
+
+isDefaultApplication(type: string): Promise\
+
+Checks whether this application is the default application of a system-defined application type. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype). |
+
+**Return value**
+
+| Type | Description |
+| ------------------------- | ------------------ |
+| Promise\ | Promise used to return the result. If the application is the default application, `true` is returned; otherwise, `false` is returned.|
+
+**Example**
+
+```js
+defaultAppMgr.isDefaultApplication(defaultAppMgr.ApplicationType.BROWSER)
+.then((data) => {
+ console.info('Operation successful. IsDefaultApplication ? ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+});
+```
+
+## defaultAppMgr.isDefaultApplication
+
+isDefaultApplication(type: string, callback: AsyncCallback\): void
+
+Checks whether this application is the default application of a system-defined application type. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------------------------------- | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype). |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. If the application is the default application, `true` is returned; otherwise, `false` is returned.|
+
+**Example**
+
+```js
+defaultAppMgr.isDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. IsDefaultApplication ? ' + JSON.stringify(data));
+ });
+```
+
+## defaultAppMgr.getDefaultApplication
+
+getDefaultApplication(type: string, userId?: number): Promise\
+
+Obtains the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.GET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| userId | number | No | User ID. The default value is the user ID of the caller. |
+
+**Return value**
+
+| Type | Description |
+| ------------------------- | ------------------ |
+| Promise\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Promise used to return the default application.|
+
+**Example**
+
+```js
+defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER)
+.then((data) => {
+ console.info('Operation successful. bundleInfo: ' + JSON.stringify(data));
+})
+.catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+});
+
+defaultAppMgr.getDefaultApplication("image/png")
+.then((data) => {
+ console.info('Operation successful. bundleInfo: ' + JSON.stringify(data));
+})
+.catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+});
+```
+
+## defaultAppMgr.getDefaultApplication
+
+getDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void
+
+Obtains the default application of a user based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.GET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| userId | number | Yes | User ID. |
+| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the default application. |
+
+**Example**
+
+```js
+defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, 100, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. bundleInfo:' + JSON.stringify(data));
+});
+
+defaultAppMgr.getDefaultApplication("image/png", 100, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. bundleInfo:' + JSON.stringify(data));
+});
+```
+
+## defaultAppMgr.getDefaultApplication
+
+getDefaultApplication(type: string, callback: AsyncCallback\) : void
+
+Obtains the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.GET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| callback | AsyncCallback\<[BundleInfo](js-apis-bundle-BundleInfo.md)> | Yes | Callback used to return the default application. |
+
+**Example**
+
+```js
+defaultAppMgr.getDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. bundleInfo:' + JSON.stringify(data));
+});
+
+defaultAppMgr.getDefaultApplication("image/png", (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. bundleInfo:' + JSON.stringify(data));
+});
+```
+
+## defaultAppMgr.setDefaultApplication
+
+setDefaultApplication(type: string, elementName: ElementName, userId?: number): Promise\
+
+Sets the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | Information about the element to be set as the default application. |
+| userId | number | No | User ID. The default value is the user ID of the caller. |
+
+**Example**
+
+```js
+defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
+ bundleName: "com.test.app",
+ moduleName: "module01",
+ abilityName: "MainAbility"
+})
+.then((data) => {
+ console.info('Operation successful.');
+})
+.catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+});
+
+defaultAppMgr.setDefaultApplication("image/png", {
+ bundleName: "com.test.app",
+ moduleName: "module01",
+ abilityName: "MainAbility"
+})
+.then((data) => {
+ console.info('Operation successful.');
+})
+.catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+});
+```
+
+## defaultAppMgr.setDefaultApplication
+
+setDefaultApplication(type: string, elementName: ElementName, userId: number, callback: AsyncCallback\) : void;
+
+Sets the default application for a user based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | Information about the element to be set as the default application. |
+| userId | number | Yes | User ID. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
+ bundleName: "com.test.app",
+ moduleName: "module01",
+ abilityName: "MainAbility"
+}, 100, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful.');
+ });
+
+defaultAppMgr.setDefaultApplication("image/png", {
+ bundleName: "com.test.app",
+ moduleName: "module01",
+ abilityName: "MainAbility"
+}, 100, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful.');
+ });
+```
+
+## defaultAppMgr.setDefaultApplication
+
+setDefaultApplication(type: string, elementName: ElementName, callback: AsyncCallback\) : void;
+
+Sets the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| elementName | [ElementName](js-apis-bundle-ElementName.md) | Yes | Information about the element to be set as the default application. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+defaultAppMgr.setDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, {
+ bundleName: "com.test.app",
+ moduleName: "module01",
+ abilityName: "MainAbility"
+}, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful.');
+ });
+
+defaultAppMgr.setDefaultApplication("image/png", {
+ bundleName: "com.test.app",
+ moduleName: "module01",
+ abilityName: "MainAbility"
+}, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful.');
+ });
+```
+
+## defaultAppMgr.resetDefaultApplication
+
+resetDefaultApplication(type: string, userId?: number): Promise\
+
+Resets the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses a promise to return the result.
+
+**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| userId | number | No | User ID. The default value is the user ID of the caller. |
+
+**Example**
+
+```js
+defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER)
+.then((data) => {
+ console.info('Operation successful.');
+})
+.catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+});
+
+defaultAppMgr.resetDefaultApplication("image/png")
+.then((data) => {
+ console.info('Operation successful.');
+})
+.catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+});
+```
+
+## defaultAppMgr.resetDefaultApplication
+
+resetDefaultApplication(type: string, userId: number, callback: AsyncCallback\) : void;
+
+Resets the default application for a user based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| userId | number | Yes | User ID. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, 100, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful.');
+});
+
+defaultAppMgr.resetDefaultApplication("image/png", 100, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful.');
+});
+```
+
+## defaultAppMgr.resetDefaultApplication
+
+resetDefaultApplication(type: string, callback: AsyncCallback\) : void;
+
+Resets the default application based on a system-defined application type or a file type that complies with the media type format (either specified by **type** or **subtype**). This API uses an asynchronous callback to return the result.
+
+**Required permissions**: ohos.permission.SET_DEFAULT_APPLICATION
+
+**System capability**: SystemCapability.BundleManager.BundleFramework
+
+**System API**: This is a system API and cannot be called by third-party applications.
+
+**Parameters**
+
+| Name | Type | Mandatory | Description |
+| ----------- | ------ | ---- | --------------------------------------- |
+| type | string | Yes | Type of the target application. It must be set to a value defined by [ApplicationType](#defaultappmgrapplicationtype) or a file type that complies with the media type format. |
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+
+**Example**
+
+```js
+defaultAppMgr.resetDefaultApplication(defaultAppMgr.ApplicationType.BROWSER, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful.');
+});
+
+defaultAppMgr.resetDefaultApplication("image/png", (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful.');
+});
+```
diff --git a/en/application-dev/reference/apis/js-apis-bytrace.md b/en/application-dev/reference/apis/js-apis-bytrace.md
index 3d532293b18ca1b262feabe80615dc1807ac30dc..72fcfaca8fb39e4345c2392e761b19b364922499 100644
--- a/en/application-dev/reference/apis/js-apis-bytrace.md
+++ b/en/application-dev/reference/apis/js-apis-bytrace.md
@@ -7,7 +7,7 @@
## Modules to Import
-```
+ ```js
import bytrace from '@ohos.bytrace';
```
@@ -35,7 +35,7 @@ Marks the start of a timeslice trace task.
**Example**
-```
+ ```js
bytrace.startTrace("myTestFunc", 1);
bytrace.startTrace("myTestFunc", 1, 5); // The expected duration of the trace is 5 ms.
```
@@ -62,7 +62,7 @@ Marks the end of a timeslice trace task.
**Example**
-```
+ ```js
bytrace.finishTrace("myTestFunc", 1);
```
@@ -105,7 +105,7 @@ Defines the variable that indicates the number of timeslice trace tasks.
**Example**
-```
+ ```js
let traceCount = 3;
bytrace.traceByValue("myTestCount", traceCount);
traceCount = 4;
diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md
index 43f15f6c7b3666fc53f69deadb0043e6adacca46..1298f29856048924fd2a7e8397724aa9fc0df8ee 100644
--- a/en/application-dev/reference/apis/js-apis-camera.md
+++ b/en/application-dev/reference/apis/js-apis-camera.md
@@ -347,7 +347,7 @@ After **[camera.getCameraManager](#cameragetcameramanager)** is called, a camera
```js
async function getCameraInfo("cameraId") {
- var cameraManager = await camera.getCameraManager();
+ var cameraManager = await camera.getCameraManager(context);
var cameras = await cameraManager.getCameras();
var cameraObj = cameras[0];
var cameraId = cameraObj.cameraId;
@@ -2231,6 +2231,10 @@ Captures a photo with the specified capture settings. This API uses an asynchron
**Example**
```js
+let settings:PhotoCaptureSetting = {
+ quality = 1,
+ rotation = 0
+}
photoOutput.capture(settings, (err) => {
if (err) {
console.error('Failed to capture the photo ${err.message}');
@@ -2359,7 +2363,7 @@ Listens for frame shutter events. This API uses an asynchronous callback to retu
**Example**
```js
-photoOutput.on('frameShutter', (frameShutterInfo) => {
+photoOutput.on('frameShutter', (err, frameShutterInfo) => {
console.log('photo capture end, captureId : ' + frameShutterInfo.captureId);
console.log('Timestamp for frame : ' + frameShutterInfo.timestamp);
})
@@ -2383,7 +2387,7 @@ Listens for photo capture end events. This API uses an asynchronous callback to
**Example**
```js
-photoOutput.on('captureEnd', (captureEndInfo) => {
+photoOutput.on('captureEnd', (err, captureEndInfo) => {
console.log('photo capture end, captureId : ' + captureEndInfo.captureId);
console.log('frameCount : ' + captureEndInfo.frameCount);
})
@@ -2407,7 +2411,7 @@ Listens for **PhotoOutput** errors. This API uses a callback to return the error
**Example**
```js
-photoOutput.on('error', (photoOutputError) => {
+photoOutput.on('error', (err, photoOutputError) => {
console.log('Photo output error code: ' + photoOutputError.code);
})
```
diff --git a/en/application-dev/reference/apis/js-apis-configuration.md b/en/application-dev/reference/apis/js-apis-configuration.md
index 507b8a42448dd4ae892424feaae061c47d814138..14abee7e2d9cca63278e11b16486643d89e56bd0 100644
--- a/en/application-dev/reference/apis/js-apis-configuration.md
+++ b/en/application-dev/reference/apis/js-apis-configuration.md
@@ -1,11 +1,11 @@
# Configuration
+The **Configuration** module provides environment configuration information.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-Provides the configuration for the environment where the ability is running.
-
## Modules to Import
```js
@@ -23,3 +23,4 @@ import Configuration from '@ohos.application.Configuration';
| direction9+ | Direction | Yes| No| Screen orientation, which can be **DIRECTION_HORIZONTAL** or **DIRECTION_VERTICAL**.|
| screenDensity9+ | ScreenDensity | Yes| No| Screen resolution, which can be **SCREEN_DENSITY_SDPI** (120), **SCREEN_DENSITY_MDPI** (160), **SCREEN_DENSITY_LDPI** (240), **SCREEN_DENSITY_XLDPI** (320), **SCREEN_DENSITY_XXLDPI** (480), or **SCREEN_DENSITY_XXXLDPI** (640).|
| displayId9+ | number | Yes| No| ID of the display where the application is located.|
+| hasPointerDevice9+ | boolean | Yes| No| Whether the pointer device is connected.|
diff --git a/en/application-dev/reference/apis/js-apis-configurationconstant.md b/en/application-dev/reference/apis/js-apis-configurationconstant.md
index ebb78bc00e5ece7a6e04e64db6135f9d2f7ed7fd..70d527483a15d7f676402ad406964740a5686a6b 100644
--- a/en/application-dev/reference/apis/js-apis-configurationconstant.md
+++ b/en/application-dev/reference/apis/js-apis-configurationconstant.md
@@ -1,13 +1,11 @@
# ConfigurationConstant
+The **ConfigurationConstant** module provides the enumerated values of the environment configuration information.
+
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-
-Defines enumerated values of the configuration for the environment where the ability is running.
-
-
## Modules to Import
@@ -15,7 +13,6 @@ Defines enumerated values of the configuration for the environment where the abi
import ConfigurationConstant from '@ohos.application.ConfigurationConstant';
```
-
## ConfigurationConstant.ColorMode
You can obtain the value of this constant by calling the **ConfigurationConstant.ColorMode** API.
diff --git a/en/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md b/en/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md
new file mode 100644
index 0000000000000000000000000000000000000000..755557fba6455122d78e1bc4c8f09c12e305521a
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md
@@ -0,0 +1,22 @@
+# ContinuationExtraParams
+
+The **ContinuationExtraParams** module provides the extra parameters required by the device manager in the continuation management entry.
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## ContinuationExtraParams
+
+Describes the extra parameters required by the device selection module in the continuation management entry.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| deviceType | Array\ | Yes| Yes| Device type.|
+| targetBundle | string | Yes| Yes| Target bundle name.|
+| description | string | Yes| Yes| Device filtering description.|
+| filter | any | Yes| Yes| Device filtering parameter.|
+| continuationMode | [ContinuationMode](js-apis-continuation-continuationManager.md#continuationmode) | Yes| Yes| Continuation mode.|
+| authInfo | { [key: string]: any } | Yes| Yes| Authentication information.|
diff --git a/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md b/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md
new file mode 100644
index 0000000000000000000000000000000000000000..007d35d1408e2381aca841dd64cb9ce6a078b16a
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-continuation-continuationManager.md
@@ -0,0 +1,496 @@
+# continuationManager
+
+The **continuationManager** module provides the continuation management entry. You can use the APIs of this module to connect to and cancel the continuation management service, subscribe to and unsubscribe from device connection events, start the device selection module, and update the device connection state.
+
+Currently, this module provides incomplete functions, and its APIs are mainly used to start the device selection module. **The continuation capability is not available for application development.**
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## Modules to Import
+
+```js
+import continuationManager from '@ohos.continuation.continuationManager'
+```
+
+## continuationManager.register
+
+register(callback: AsyncCallback\): void;
+
+Registers the continuation management service and obtains a token. This API does not involve any filter parameters and uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | callback | AsyncCallback\ | Yes| Callback used to return the token generated after the continuation management service is connected.|
+
+**Example**
+
+ ```js
+ let token = -1;
+ continuationManager.register((err, data) => {
+ if (err.code != 0) {
+ console.error('register failed, cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('register finished, ' + JSON.stringify(data));
+ token = data;
+ });
+ ```
+
+## continuationManager.register
+
+register(options: ContinuationExtraParams, callback: AsyncCallback\): void;
+
+Registers the continuation management service and obtains a token. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | Yes| Extra parameters used to filter the list of available devices.|
+ | callback | AsyncCallback\ | Yes| Callback used to return the token generated after the continuation management service is connected.|
+
+**Example**
+
+ ```js
+ let token = -1;
+ let continuationExtraParams = {
+ deviceType: ["00E"]
+ };
+ continuationManager.register(continuationExtraParams, (err, data) => {
+ if (err.code != 0) {
+ console.error('register failed, cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('register finished, ' + JSON.stringify(data));
+ token = data;
+ });
+ ```
+
+## continuationManager.register
+
+register(options?: ContinuationExtraParams): Promise\;
+
+Registers the continuation management service and obtains a token. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | No| Extra parameters used to filter the list of available devices. This parameter can be null.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------- | ------------------ |
+| Promise\ | Promise used to return the token generated after the continuation management service is connected.|
+
+**Example**
+
+ ```js
+ let token = -1;
+ let continuationExtraParams = {
+ deviceType: ["00E"]
+ };
+ continuationManager.register(continuationExtraParams)
+ .then((data) => {
+ console.info('register finished, ' + JSON.stringify(data));
+ token = data;
+ })
+ .catch((err) => {
+ console.error('register failed, cause: ' + JSON.stringify(err));
+ });
+ ```
+
+## continuationManager.on("deviceConnect")(deprecated)
+> This API is deprecated since API version 9. You are advised to use [on](#continuationmanagerondeviceconnect) instead.
+
+on(type: "deviceConnect", callback: Callback\): void;
+
+Subscribes to device connection events. This API uses an asynchronous callback to return the result.
+
+## continuationManager.on("deviceDisconnect")(deprecated)
+> This API is deprecated since API version 9. You are advised to use [on](#continuationmanagerondevicedisconnect) instead.
+
+on(type: "deviceDisconnect", callback: Callback\): void;
+
+Subscribes to device disconnection events. This API uses an asynchronous callback to return the result.
+
+## continuationManager.off("deviceConnect")(deprecated)
+> This API is deprecated since API version 9. You are advised to use [off](#continuationmanageroffdeviceconnect) instead.
+
+off(type: "deviceConnect", callback?: Callback\): void;
+
+Unsubscribes from device connection events. This API uses an asynchronous callback to return the result.
+
+## continuationManager.off("deviceDisconnect")(deprecated)
+> This API is deprecated since API version 9. You are advised to use [off](#continuationmanageroffdevicedisconnect) instead.
+
+off(type: "deviceDisconnect", callback?: Callback\): void;
+
+Unsubscribes from device disconnection events. This API uses an asynchronous callback to return the result.
+
+## continuationManager.on("deviceConnect")9+
+
+on(type: "deviceConnect", token: number, callback: Callback\>): void;
+
+Subscribes to device connection events. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type. The value is fixed at **deviceConnect**.|
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+ | callback | Callback\> | Yes| Callback invoked when a device is selected from the device list provided by the device selection module. This callback returns the device ID, type, and name.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ continuationManager.on("deviceConnect", token, (data) => {
+ console.info('onDeviceConnect len: ' + data.length);
+ for (let i = 0; i < data.length; i++) {
+ console.info('onDeviceConnect deviceId: ' + JSON.stringify(data[i].id));
+ console.info('onDeviceConnect deviceType: ' + JSON.stringify(data[i].type));
+ console.info('onDeviceConnect deviceName: ' + JSON.stringify(data[i].name));
+ }
+ });
+ ```
+
+## continuationManager.on("deviceDisconnect")9+
+
+on(type: "deviceDisconnect", token: number, callback: Callback\>): void;
+
+Subscribes to device disconnection events. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type. The value is fixed at **deviceDisconnect**.|
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+ | callback | Callback\> | Yes| Callback invoked when a device is disconnected in the device selection module. This callback returns the device ID.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ continuationManager.on("deviceDisconnect", token, (data) => {
+ console.info('onDeviceDisconnect len: ' + data.length);
+ for (let i = 0; i < data.length; i++) {
+ console.info('onDeviceDisconnect deviceId: ' + JSON.stringify(data[i]));
+ }
+ console.info('onDeviceDisconnect finished.');
+ });
+ ```
+
+## continuationManager.off("deviceConnect")9+
+
+off(type: "deviceConnect", token: number): void;
+
+Unsubscribes from device connection events.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type. The value is fixed at **deviceConnect**.|
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ continuationManager.off("deviceConnect", token);
+ ```
+
+## continuationManager.off("deviceDisconnect")9+
+
+off(type: "deviceDisconnect", token: number): void;
+
+Unsubscribes from device disconnection events.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type. The value is fixed at **deviceDisconnect**.|
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ continuationManager.off("deviceDisconnect", token);
+ ```
+
+## continuationManager.startDeviceManager
+
+startDeviceManager(token: number, callback: AsyncCallback\): void;
+
+Starts the device selection module to show the list of available devices on the network. This API does not involve any filter parameters and uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+ | callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ continuationManager.startDeviceManager(token, (err, data) => {
+ if (err.code != 0) {
+ console.error('startDeviceManager failed, cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('startDeviceManager finished, ' + JSON.stringify(data));
+ });
+ ```
+
+## continuationManager.startDeviceManager
+
+startDeviceManager(token: number, options: ContinuationExtraParams, callback: AsyncCallback\): void;
+
+Starts the device selection module to show the list of available devices on the network. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+ | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | Yes| Extra parameters used to filter the list of available devices.|
+ | callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ let continuationExtraParams = {
+ deviceType: ["00E"]
+ };
+ continuationManager.startDeviceManager(token, continuationExtraParams, (err, data) => {
+ if (err.code != 0) {
+ console.error('startDeviceManager failed, cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('startDeviceManager finished, ' + JSON.stringify(data));
+ });
+ ```
+
+## continuationManager.startDeviceManager
+
+startDeviceManager(token: number, options?: ContinuationExtraParams): Promise\;
+
+Starts the device selection module to show the list of available devices on the network. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+ | options | [ContinuationExtraParams](js-apis-continuation-continuationExtraParams.md) | No| Extra parameters used to filter the list of available devices. This parameter can be null.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------- | ------------------ |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ let continuationExtraParams = {
+ deviceType: ["00E"]
+ };
+ continuationManager.startDeviceManager(token, continuationExtraParams)
+ .then((data) => {
+ console.info('startDeviceManager finished, ' + JSON.stringify(data));
+ })
+ .catch((err) => {
+ console.error('startDeviceManager failed, cause: ' + JSON.stringify(err));
+ });
+ ```
+
+## continuationManager.updateConnectStatus
+
+updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState, callback: AsyncCallback\): void;
+
+Instructs the device selection module to update the device connection state. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+ | deviceId | string | Yes| Device ID.|
+ | status | [DeviceConnectState](#deviceconnectstate) | Yes| Device connection state.|
+ | callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ let deviceId: string = "test deviceId";
+ continuationManager.updateConnectStatus(token, deviceId, continuationManager.DeviceConnectState.CONNECTED, (err, data) => {
+ if (err.code != 0) {
+ console.error('updateConnectStatus failed, cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('updateConnectStatus finished, ' + JSON.stringify(data));
+ });
+ ```
+
+## continuationManager.updateConnectStatus
+
+updateConnectStatus(token: number, deviceId: string, status: DeviceConnectState): Promise\;
+
+Instructs the device selection module to update the device connection state. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+ | deviceId | string | Yes| Device ID.|
+ | status | [DeviceConnectState](#deviceconnectstate) | Yes| Device connection state.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------- | ------------------ |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ let deviceId: string = "test deviceId";
+ continuationManager.updateConnectStatus(token, deviceId, continuationManager.DeviceConnectState.CONNECTED)
+ .then((data) => {
+ console.info('updateConnectStatus finished, ' + JSON.stringify(data));
+ })
+ .catch((err) => {
+ console.error('updateConnectStatus failed, cause: ' + JSON.stringify(err));
+ });
+ ```
+
+## continuationManager.unregister
+
+unregister(token: number, callback: AsyncCallback\): void;
+
+Deregisters the continuation management service. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+ | callback | AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ continuationManager.unregister(token, (err, data) => {
+ if (err.code != 0) {
+ console.error('unregister failed, cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('unregister finished, ' + JSON.stringify(data));
+ });
+ ```
+
+## continuationManager.unregister
+
+unregister(token: number): Promise\;
+
+Deregisters the continuation management service. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | token | number | Yes| Token obtained after the registration of the continuation management service.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------- | ------------------ |
+| Promise\ | Promise used to return the result.|
+
+**Example**
+
+ ```js
+ let token = 1;
+ continuationManager.unregister(token)
+ .then((data) => {
+ console.info('unregister finished, ' + JSON.stringify(data));
+ })
+ .catch((err) => {
+ console.error('unregister failed, cause: ' + JSON.stringify(err));
+ });
+ ```
+
+## DeviceConnectState
+
+Enumerates the device connection states.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Value| Description|
+ | -------- | -------- | -------- | -------- |
+ | IDLE | number | 0 | The device is in the initial state.|
+ | CONNECTING | number | 1 | The device is being connected.|
+ | CONNECTED | number | 2 | The device is connected.|
+ | DISCONNECTING | number | 3 | The device is being disconnected.|
+
+## ContinuationMode
+
+Enumerates the continuation modes provided by the device selection module.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+**Parameters**
+
+ | Name| Type| Value| Description|
+ | -------- | -------- | -------- | -------- |
+ | COLLABORATION_SINGLE | number | 0 | Single-choice mode.|
+ | COLLABORATION_MULTIPLE | number | 1 | Multi-choice mode.|
diff --git a/en/application-dev/reference/apis/js-apis-continuation-continuationResult.md b/en/application-dev/reference/apis/js-apis-continuation-continuationResult.md
new file mode 100644
index 0000000000000000000000000000000000000000..bdebb727ff7b5c6b41868f37bf5ecdb0ea333d10
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-continuation-continuationResult.md
@@ -0,0 +1,17 @@
+# ContinuationResult
+
+> **NOTE**
+>
+> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+
+## ContinuationResult
+
+Describes the device information returned by the continuation management entry.
+
+**System capability**: SystemCapability.Ability.DistributedAbilityManager
+
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| id | string | Yes| Yes| Device ID.|
+| type | string | Yes| Yes| Device type.|
+| name | string | Yes| Yes| Device name.|
diff --git a/en/application-dev/reference/apis/js-apis-convertxml.md b/en/application-dev/reference/apis/js-apis-convertxml.md
index 3fd4e4e52ca7a82b33dd6a13aa7f425ab2aea9be..43e096b951e7ea4d97ed9e0d40dc0481f34a0290 100644
--- a/en/application-dev/reference/apis/js-apis-convertxml.md
+++ b/en/application-dev/reference/apis/js-apis-convertxml.md
@@ -1,6 +1,9 @@
# XML-to-JavaScript Conversion
-> **NOTE**
+The **convertxml** module provides APIs for converting XML text into JavaScript objects.
+
+> **NOTE**
+>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -47,10 +50,10 @@ let xml =
'';
let conv = new convertxml.ConvertXML();
let options = {trim : false, declarationKey:"_declaration",
- instructionKey : "_instruction", attributesKey : "_attributes",
- textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
- commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
- nameKey : "_name", elementsKey : "_elements"}
+ instructionKey : "_instruction", attributesKey : "_attributes",
+ textKey : "_text", cdataKey:"_cdata", doctypeKey : "_doctype",
+ commentKey : "_comment", parentKey : "_parent", typeKey : "_type",
+ nameKey : "_name", elementsKey : "_elements"}
let result = JSON.stringify(conv.convert(xml, options));
console.log(result)
```
diff --git a/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md b/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md
new file mode 100644
index 0000000000000000000000000000000000000000..6adaa00f48cfb7f2e685841e013e3d719bc58548
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-data-DataShareResultSet.md
@@ -0,0 +1,424 @@
+# Data Share Result Set
+
+The **DataShareResultSet** module provides methods for accessing the result set obtained from the database. You can access the values in the specified rows or the value of the specified data type.
+
+>**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
+
+```ts
+import DataShareResultSet from '@ohos.data.DataShareResultSet';
+```
+
+## How to Use
+
+You can call [query()](js-apis-data-dataShare.md#query) to obtain the **DataShareResultSet** object.
+
+```ts
+import dataShare from '@ohos.data.dataShare';
+import dataSharePredicates from '@ohos.data.dataSharePredicates'
+
+let dataShareHelper;
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+await dataShare.createDataShareHelper(this.context, uri, (err, data) => {
+ if (err != undefined) {
+ console.info("createDataShareHelper fail, error message : " + err);
+ } else {
+ console.info("createDataShareHelper end, data : " + data);
+ dataShareHelper = data;
+ }
+});
+
+let columns = ["*"];
+let da = new dataSharePredicates.DataSharePredicates();
+let resultSet;
+da.equalTo("name", "ZhangSan");
+dataShareHelper.query(uri, da, columns).then((data) => {
+ console.log("query end, data : " + data);
+ resultSet = data;
+}).catch((err) => {
+ console.log("query fail, error message : " + err);
+});
+```
+
+## Attributes
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+| Name | Type | Mandatory| Description |
+| ----------- | ------------- | ---- | ------------------------ |
+| columnNames | Array<string> | Yes | Names of all columns in the result set. |
+| columnCount | number | Yes | Number of columns in the result set. |
+| rowCount | number | Yes | Number of rows in the result set. |
+| isClosed | boolean | Yes | Whether the result set is closed.|
+
+## goToFirstRow
+
+goToFirstRow(): boolean
+
+Moves to the first row of the result set.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type | Description |
+| :------ | --------------------------------------------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+
+**Example**
+
+```ts
+let isGoTOFirstRow = resultSet.goToFirstRow();
+console.info('resultSet.goToFirstRow: ' + isGoTOFirstRow);
+```
+
+## goToLastRow
+
+goToLastRow(): boolean
+
+Moves to the last row of the result set.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+
+**Example**
+
+```ts
+let isGoToLastRow = resultSet.goToLastRow();
+console.info('resultSet.goToLastRow: ' + isGoToLastRow);
+```
+
+## goToNextRow
+
+goToNextRow(): boolean
+
+Moves to the next row in the result set.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type | Description |
+| ------- | --------------------------------------------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+
+**Example**
+
+```ts
+let isGoToNextRow = resultSet.goToNextRow();
+console.info('resultSet.goToNextRow: ' + isGoToNextRow);
+```
+
+## goToPreviousRow
+
+goToPreviousRow(): boolean
+
+Moves to the previous row in the result set.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type | Description |
+| ------- | --------------------------------------------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+
+**Example**
+
+```ts
+let isGoToPreviousRow = resultSet.goToPreviousRow();
+console.info('resultSet.goToPreviousRow: ' + isGoToPreviousRow);
+```
+
+## goTo
+
+goTo(offset:number): boolean
+
+Moves based on the specified offset.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name**| **Type**| **Mandatory**| Description |
+| ---------- | -------- | -------- | ------------------------------------------------------------ |
+| offset | number | Yes | Offset relative to the current position. A negative value means to move backward, and a positive value means to move forward.|
+
+**Return value**
+
+| Type | Description |
+| ------- | --------------------------------------------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+
+**Example**
+
+```ts
+let goToNum = 1;
+let isGoTo = resultSet.goTo(goToNum);
+console.info('resultSet.goTo: ' + isGoTo);
+```
+
+## goToRow
+
+goToRow(position: number): boolean
+
+Moves to the specified row in the result set.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name**| **Type**| **Mandatory**| Description |
+| ---------- | -------- | -------- | ------------------------ |
+| position | number | Yes | Destination position to move.|
+
+**Return value**
+
+| Type | Description |
+| ------- | --------------------------------------------- |
+| boolean | Returns **true** if the operation is successful; returns **false** otherwise.|
+
+**Example**
+
+```ts
+let goToRowNum = 2
+let isGoToRow = resultSet.goToRow(goToRowNum);
+console.info('resultSet.goToRow: ' + isGoToRow);
+```
+
+## getBlob
+
+getBlob(columnIndex: number): Uint8Array
+
+Obtains the value in the specified column in the current row as a byte array.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name** | **Type**| **Mandatory**| Description |
+| ----------- | -------- | -------- | ----------------------- |
+| columnIndex | number | Yes | Index of the target column, starting from 0.|
+
+**Return value**
+
+| Type | Description |
+| ---------- | -------------------------------- |
+| Uint8Array | Value obtained.|
+
+**Example**
+
+```ts
+let columnIndex = 1
+let goToFirstRow = resultSet.goToFirstRow();
+let getBlob = resultSet.getBlob(columnIndex);
+console.info('resultSet.getBlob: ' + getBlob);
+```
+
+## getString
+
+getString(columnIndex: number): *string*
+
+Obtains the value in the specified column in the current row as a string.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name** | **Type**| **Mandatory**| Description |
+| ----------- | -------- | -------- | ----------------------- |
+| columnIndex | number | Yes | Index of the target column, starting from 0.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ---------------------------- |
+| string | Value obtained.|
+
+**Example**
+
+```ts
+let columnIndex = 1
+let goToFirstRow = resultSet.goToFirstRow();
+let getString = resultSet.getString(columnIndex);
+console.info('resultSet.getString: ' + getString);
+```
+
+## getLong
+
+getLong(columnIndex: number): number
+
+Obtains the value in the specified column in the current row as a long integer.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name** | **Type**| **Mandatory**| Description |
+| ----------- | -------- | -------- | ----------------------- |
+| columnIndex | number | Yes | Index of the target column, starting from 0.|
+
+**Return value**
+
+| Type | Description |
+| ------ | -------------------------- |
+| number | Value obtained.|
+
+**Example**
+
+```ts
+let columnIndex = 1
+let goToFirstRow = resultSet.goToFirstRow();
+let getLong = resultSet.getLong(columnIndex);
+console.info('resultSet.getLong: ' + getLong);
+```
+
+## getDouble
+
+getDouble(columnIndex: number): number
+
+Obtains the value in the specified column in the current row as a double-precision floating-point number.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name** | **Type**| **Mandatory**| Description |
+| ----------- | -------- | -------- | ----------------------- |
+| columnIndex | number | Yes | Index of the target column, starting from 0.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ---------------------------- |
+| number | Value obtained.|
+
+**Example**
+
+```ts
+let columnIndex = 1
+let goToFirstRow = resultSet.goToFirstRow();
+let getDouble = resultSet.getDouble(columnIndex);
+console.info('resultSet.getDouble: ' + getDouble);
+```
+
+## close
+
+close(): void
+
+Closes this result set.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Example**
+
+```ts
+resultSet.close();
+```
+
+## getColumnIndex
+
+getColumnIndex(columnName: string): number
+
+Obtains the column index based on the column name.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name**| **Type**| **Mandatory**| Description |
+| ---------- | -------- | -------- | -------------------------- |
+| columnName | string | Yes | Column name.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ------------------ |
+| number | Column index obtained.|
+
+**Example**
+
+```ts
+let ColumnName = "name"
+let getColumnIndex = resultSet.getColumnIndex(ColumnName)
+console.info('resultSet.getColumnIndex: ' + getColumnIndex);
+```
+
+## getColumnName
+
+getColumnName(columnIndex: number): *string*
+
+Obtains the column name based on the column index.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name** | **Type**| **Mandatory**| Description |
+| ----------- | -------- | -------- | -------------------------- |
+| columnIndex | number | Yes | Column index.|
+
+**Return value**
+
+| Type | Description |
+| ------ | ------------------ |
+| string | Column name obtained.|
+
+**Example**
+
+```ts
+let columnIndex = 1
+let getColumnName = resultSet.getColumnName(columnIndex)
+console.info('resultSet.getColumnName: ' + getColumnName);
+```
+
+## getDataType
+
+getDataType(columnIndex: number): DataType
+
+Obtains the data type based on the specified column index.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| **Name** | **Type**| **Mandatory**| Description |
+| ----------- | -------- | -------- | -------------------------- |
+| columnIndex | number | Yes | Column index.|
+
+**Return value**
+
+| Type | Description |
+| --------------------- | ------------------ |
+| [DataType](#datatype) | Data type obtained.|
+
+**Example**
+
+```ts
+let columnIndex = 1;
+let getDataType = resultSet.getDataType(columnIndex);
+console.info('resultSet.getDataType: ' + getDataType);
+```
+
+## DataType
+
+Enumerates the data types.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+| Name | Value| Description |
+| ----------- | ------ | -------------------- |
+| TYPE_NULL | 0 | Null. |
+| TYPE_LONG | 1 | Long integer. |
+| TYPE_DOUBLE | 2 | Double-precision floating-point number.|
+| TYPE_STRING | 3 | String.|
+| TYPE_BLOB | 4 | Byte array.|
diff --git a/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md b/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md
new file mode 100644
index 0000000000000000000000000000000000000000..dc239c35cbe017f7c5edc0a9fd8ff1bd74b3c366
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-data-ValuesBucket.md
@@ -0,0 +1,37 @@
+# Value Bucket
+
+The **ValueBucket** module holds data in key-value (KV) pairs. You can use it to insert data into a database.
+
+>**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
+
+```ts
+import { ValueType } from '@ohos.data.ValuesBucket';
+import { ValuesBucket } from '@ohos.data.ValuesBucket';
+```
+
+## ValueType
+
+Enumerates the value types allowed by the database.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+| Type | Description |
+| ------- | -------------------- |
+| number | The value is a number. |
+| string | The value is a string.|
+| boolean | The value is of Boolean type.|
+
+## ValuesBucket
+
+Defines the types of the key and value in a KV pair.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+| Key Type | Value Type |
+| ------------- | --------------------------------------------- |
+| string | [ValueType](#valuetype)\| Uint8Array \| null |
diff --git a/en/application-dev/reference/apis/js-apis-data-ability.md b/en/application-dev/reference/apis/js-apis-data-ability.md
index a1c0aba0f59aa5831cfa2e54cbad92302b8724c8..3860be1f4cd4fae2b432c7286ae5aca1c2b44868 100644
--- a/en/application-dev/reference/apis/js-apis-data-ability.md
+++ b/en/application-dev/reference/apis/js-apis-data-ability.md
@@ -789,7 +789,7 @@ Enumerates the value types.
**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
-| Name | Description |
+| Type | Description |
| ------- | -------------------- |
| number | The value is a number. |
| string | The value is a string. |
diff --git a/en/application-dev/reference/apis/js-apis-data-dataShare.md b/en/application-dev/reference/apis/js-apis-data-dataShare.md
new file mode 100644
index 0000000000000000000000000000000000000000..c3b59a85ab9e2945a8375a61b44c7e45c5d1c385
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-data-dataShare.md
@@ -0,0 +1,932 @@
+# Data Sharing
+
+The **DataShare** module allows an application to manage its own data and share data with other applications on the same device.
+
+>**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
+
+```ts
+import dataShare from '@ohos.data.dataShare'
+```
+
+
+## dataShare.createDataShareHelper
+
+createDataShareHelper(context: Context, uri: string, callback: AsyncCallback<DataShareHelper>): void
+
+Creates a **DataShareHelper** instance. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------------------------------------------- | ---- | ------------------------------------------------------------ |
+| context | [Context](js-apis-application-context.md#context) | Yes | Context of an application. |
+| uri | string | Yes | Uniform Resource Identifier (URI) of the server application to connect. |
+| callback | AsyncCallback<[DataShareHelper](#datasharehelper)> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the **DataShareHelper** instance created. Otherwise, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let dataShareHelper;
+dataShare.createDataShareHelper(this.context, uri, (err, data) => {
+ if (err != undefined) {
+ console.info("createDataShareHelper failed, error message : " + err);
+ } else {
+ console.info("createDataShareHelper succeed, data : " + data);
+ dataShareHelper = data;
+ }
+});
+```
+
+## dataShare.createDataShareHelper
+
+createDataShareHelper(context: Context, uri: string): Promise<DataShareHelper>
+
+Creates a **DataShareHelper** instance. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ------------------------------------------------- | ---- | ------------------------------ |
+| context | [Context](js-apis-application-context.md#context) | Yes | Context of an application. |
+| uri | string | Yes | URI of the server application to connect.|
+
+**Return value**
+
+| Type | Description |
+| -------------------------------------------------- | -------------------------------------- |
+| Promise<[DataShareHelper](#datasharehelper)> | Promise used to return the **DataShareHelper** instance created.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let dataShareHelper;
+dataShare.createDataShareHelper(this.context, uri).then((data) => {
+ console.info("createDataShareHelper succeed, data : " + data);
+ dataShareHelper = data;
+}).catch((err) => {
+ console.info("createDataShareHelper failed, error message : " + err);
+})
+```
+
+## DataShareHelper
+
+Provides a **DataShareHelper** instance to access or manage data on the server. Before calling an API provided by **DataShareHelper**, you must create a **DataShareHelper** instance using [createDataShareHelper](#datasharecreatedatasharehelper).
+
+This API can be used only in the stage model.
+
+### openFile
+
+openFile(uri: string, mode: string, callback: AsyncCallback<number>): void
+
+Opens a file. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | --------------------- | ---- | ---------------------------------- |
+| uri | string | Yes | URI of the file to open. |
+| mode | string | Yes | File open mode.
**r** means to open a file for reading; **w** means to open a file for writing (erasing any data in the file); **wa** means to open a file in append mode for writing at the end of the file; **rw** means to open a file for both reading and writing.|
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the file descriptor. Otherwise, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.openFile(uri, "rwt", (err, data) => {
+ if (err != undefined) {
+ console.info("openFile failed, error message : " + err);
+ }else {
+ console.info("openFile succeed, data : " + data);
+ let fd = data;
+ }
+});
+```
+
+### openFile
+
+openFile(uri: string, mode: string): Promise<number>
+
+Opens a file. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the file to open. |
+| mode | string | Yes | File open mode.
**r** means to open a file for reading; **w** means to open a file for writing (erasing any data in the file); **wa** means to open a file in append mode for writing at the end of the file; **rw** means to open a file for both reading and writing.|
+
+**Return value**
+
+| Type | Description |
+| --------------- | ---------------- |
+| Promise<number> | Promise used to return the file descriptor.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.openFile(uri, "rwt").then((data) => {
+ console.info("openFile succeed, data : " + data);
+ let fd = data;
+}).catch((err) => {
+ console.info("openFile failed, error message : " + err);
+})
+```
+
+### on('dataChange')
+
+on(type: 'dataChange', uri: string, callback: AsyncCallback<void>): void
+
+Subscribes to changes of the specified data. After an observer is registered, the subscriber will receive a notification when the change notification is triggered (the **notifyChange()** method is called). This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| type | string | Yes | Event type to subscribe to. The value is **dataChange**, which indicates data change events.|
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback<void> | Yes | Called when the change notification is triggered. In this case, **err** is **undefined**. Otherwise, it is not called or **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+function onCallback() {
+ console.info("**** Observer on callback ****");
+}
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.on("dataChange", uri, onCallback);
+```
+
+### off('dataChange')
+
+off(type: 'dataChange', uri: string, callback?: AsyncCallback<void>): void
+
+Unsubscribes from the changes of the specified data. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| type | string | Yes | Event type to unsubscribe from. The value is **dataChange**, which indicates data change events.|
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback<void> | No | Callback used to return the result. If the operation is successful, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+function offCallback() {
+ console.info("**** Observer off callback ****");
+}
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.off("dataChange", uri, offCallback);
+```
+
+### insert
+
+insert(uri: string, value: ValuesBucket, callback: AsyncCallback<number>): void
+
+Inserts a single data record into the database. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | --------------------------------------------------------- | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the data to insert. |
+| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | Data to insert. If this parameter is empty, a blank row will be inserted. |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the index of the inserted data record. Otherwise, **err** is an error object.
The data index is not returned if the APIs of the database in use, for example, the key-value database (KVDB), do not support the return of indexes.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+const valueBucket = {
+ "name": "rose",
+ "age": 22,
+ "salary": 200.5,
+}
+dataShareHelper.insert(uri, valueBucket, (err, data) => {
+ if (err != undefined) {
+ console.log("insert failed, error message : " + err);
+ }else{
+ console.log("insert succeed, data : " + data);
+ }
+});
+```
+
+### insert
+
+insert(uri: string, value: ValuesBucket): Promise<number>
+
+Inserts a single data record into the database. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----- | --------------------------------------------------------- | ---- | -------------------------------------------------- |
+| uri | string | Yes | URI of the data to insert. |
+| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | Data to insert. If this parameter is empty, a blank row will be inserted.|
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ------------------------------------------------------------ |
+| Promise<number> | Promise used to return the index of the inserted data record.
The data index is not returned if the APIs of the database in use (for example, KVDB) do not support the return of indexes.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+const valueBucket = {
+ "name": "rose1",
+ "age": 221,
+ "salary": 20.5,
+}
+dataShareHelper.insert(uri, valueBucket).then((data) => {
+ console.log("insert succeed, data : " + data);
+}).catch((err) => {
+ console.log("insert failed, error message : " + err);
+});
+```
+
+### delete
+
+delete(uri: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>): void
+
+Deletes one or more data records from the database. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the data to delete. |
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **delete()** vary depending on the database in use. For example, the KVDB supports only **inKeys**.|
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of deleted data records. Otherwise, **err** is an error object.
The number of deleted data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+import dataSharePredicates from '@ohos.data.dataSharePredicates'
+
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let da = new dataSharePredicates.DataSharePredicates();
+da.equalTo("name", "ZhangSan");
+dataShareHelper.delete(uri, da, (err, data) => {
+ if (err != undefined) {
+ console.log("delete failed, error message : " + err);
+ }else{
+ console.log("delete succeed, data : " + data);
+ }
+});
+```
+
+### delete
+
+delete(uri: string, predicates: dataSharePredicates.DataSharePredicates): Promise<number>
+
+Deletes one or more data records from the database. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the data to delete. |
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **delete()** vary depending on the database in use. For example, the KVDB supports only **inKeys**.|
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ------------------------------------------------------------ |
+| Promise<number> | Promise used to return the number of deleted data records.
The number of deleted data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+import dataSharePredicates from '@ohos.data.dataSharePredicates'
+
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let da = new dataSharePredicates.DataSharePredicates();
+da.equalTo("name", "ZhangSan");
+dataShareHelper.delete(uri, da).then((data) => {
+ console.log("delete succeed, data : " + data);
+}).catch((err) => {
+ console.log("delete failed, error message : " + err);
+});
+```
+
+### query
+
+query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<DataShareResultSet>): void
+
+Queries data in the database. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the data to query. |
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **query()** vary depending on the database used. For example, the KVDB supports only **inKeys** and **prefixKey**.|
+| columns | Array<string> | Yes | Columns to query. If this parameter is empty, all columns will be queried. |
+| callback | AsyncCallback<[DataShareResultSet](js-apis-data-DataShareResultSet.md#datashareresultset)> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the result set obtained. Otherwise, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+import dataSharePredicates from '@ohos.data.dataSharePredicates'
+
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let columns = ["*"];
+let da = new dataSharePredicates.DataSharePredicates();
+da.equalTo("name", "ZhangSan");
+dataShareHelper.query(uri, da, columns, (err, data) => {
+ if (err != undefined) {
+ console.log("query failed, error message : " + err);
+ }else{
+ console.log("query succeed, rowCount : " + data.rowCount);
+ }
+});
+```
+
+### query
+
+query(uri: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>): Promise<DataShareResultSet>
+
+Queries data in the database. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the data to query. |
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **query()** vary depending on the database used. For example, the KVDB supports only **inKeys** and **prefixKey**.|
+| columns | Array<string> | Yes | Columns to query. If this parameter is empty, all columns will be queried. |
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------------------------ | --------------------------------- |
+| Promise<[DataShareResultSet](js-apis-data-DataShareResultSet.md#datashareresultset)> | Promise used to return the result set obtained.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+import dataSharePredicates from '@ohos.data.dataSharePredicates'
+
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let columns = ["*"];
+let da = new dataSharePredicates.DataSharePredicates();
+da.equalTo("name", "ZhangSan");
+dataShareHelper.query(uri, da, columns).then((data) => {
+ console.log("query succeed, rowCount : " + data.rowCount);
+}).catch((err) => {
+ console.log("query failed, error message : " + err);
+});
+```
+
+### update
+
+update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket, callback: AsyncCallback<number>): void
+
+Updates data in the database. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the data to update. |
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **update()** vary depending on the database in use. For example, only the relational database (RDB) supports predicates.|
+| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | New data. |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of updated data records. Otherwise, **err** is an error object.
The number of updated data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+import dataSharePredicates from '@ohos.data.dataSharePredicates'
+
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let da = new dataSharePredicates.DataSharePredicates();
+da.equalTo("name", "ZhangSan");
+const va = {
+ "name": "roe1",
+ "age": 21,
+ "salary": 20.5,
+
+}
+dataShareHelper.update(uri, da, va, (err, data) => {
+ if (err != undefined) {
+ console.log("update failed, error message : " + err);
+ }else{
+ console.log("update succeed, data : " + data);
+ }
+});
+```
+
+### update
+
+update(uri: string, predicates: dataSharePredicates.DataSharePredicates, value: ValuesBucket): Promise<number>
+
+Updates data in the database. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the data to update. |
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes | Filter criteria.
The predicate methods supported by **update()** vary depending on the database in use. For example, only the relational database (RDB) supports predicates.|
+| value | [ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket) | Yes | New data. |
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ------------------------------------------------------------ |
+| Promise<number> | Promise used to return the number of data records updated.
The number of updated data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+import dataSharePredicates from '@ohos.data.dataSharePredicates'
+
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let da = new dataSharePredicates.DataSharePredicates();
+da.equalTo("name", "ZhangSan");
+const va = {
+ "name": "roe1",
+ "age": 21,
+ "salary": 20.5,
+
+}
+dataShareHelper.update(uri, da, va).then((data) => {
+ console.log("update succeed, data : " + data);
+}).catch((err) => {
+ console.log("update failed, error message : " + err);
+});
+```
+
+### batchInsert
+
+batchInsert(uri: string, values: Array<ValuesBucket>, callback: AsyncCallback<number>): void
+
+Batch inserts data into the database. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the data to insert. |
+| values | Array<[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket)> | Yes | Data to insert. |
+| callback | AsyncCallback<number> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the number of data records inserted. Otherwise, **err** is an error object.
The number of inserted data records is not returned if the APIs of the database in use (for example, KVDB) do not support this return.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,},
+ {"name": "roe12", "age": 21, "salary": 20.5,},
+ {"name": "roe13", "age": 21, "salary": 20.5,})
+dataShareHelper.batchInsert(uri, vbs, (err, data) => {
+ if (err != undefined) {
+ console.log("batchInsert failed, error message : " + err);
+ }else{
+ console.log("batchInsert succeed, data : " + data);
+ }
+});
+```
+
+### batchInsert
+
+batchInsert(uri: string, values: Array<ValuesBucket>): Promise<number>
+
+Batch inserts data into the database. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------ | ------------------------------------------------------------ | ---- | ------------------------ |
+| uri | string | Yes | URI of the data to insert.|
+| values | Array<[ValuesBucket](js-apis-data-ValuesBucket.md#valuesbucket)> | Yes | Data to insert. |
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ------------------------------------------------------------ |
+| Promise<number> | Promise used to return the number of data records inserted.
The number of inserted data records is not returned if the APIs of the database (for example, KVDB) in use do not the return of the number of data records.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let vbs = new Array({"name": "roe11", "age": 21, "salary": 20.5,},
+ {"name": "roe12", "age": 21, "salary": 20.5,},
+ {"name": "roe13", "age": 21, "salary": 20.5,})
+dataShareHelper.batchInsert(uri, vbs).then((data) => {
+ console.log("batchInsert succeed, data : " + data);
+}).catch((err) => {
+ console.log("batchInsert failed, error message : " + err);
+});
+```
+
+### getType
+
+getType(uri: string, callback: AsyncCallback<string>): void
+
+Obtains the Multipurpose Internet Mail Extensions (MIME) type of the specified data. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | --------------------------------------------- |
+| uri | string | Yes | URI of the data. |
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the MIME type obtained. Otherwise, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.getType(uri, (err, data)=>{
+ if (err != undefined) {
+ console.log("getType failed, error message : " + err);
+ }else{
+ console.log("getType succeed, data : " + data);
+ let result = data;
+ }
+});
+```
+
+### getType
+
+getType(uri: string): Promise<string>
+
+Obtains the MIME type of the specified data. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | -------------------- |
+| uri | string | Yes | URI of the data.|
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ----------------------------------- |
+| Promise<string> | Promise used to return the MIME type obtained.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.getType(uri).then((data) => {
+ console.log("getType succeed, data : " + data);
+}).catch((err) => {
+ console.log("getType failed, error message : " + err);
+});
+```
+
+### getFileTypes
+
+getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback<Array<string>>): void
+
+Obtains the supported MIME types. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the file. |
+| mimeTypeFilter | string | Yes | MIME types to match. Example:
**\*/\***: Obtain all supported types.
**image/\***: Obtain the MIMEs with the main type of **image**.
**\*/jpg**: Obtain the MIMEs with the subtype of **jpg**.|
+| callback | AsyncCallback> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the MIME types obtained. Otherwise, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let mimeTypeFilter = "image/*";
+dataShareHelper.getFileTypes(uri, mimeTypeFilter, (err,data) => {
+ if (err != undefined) {
+ console.log("getFileTypes failed, error message : " + err);
+ }else{
+ console.log("getFileTypes succeed, data : " + data);
+ }
+});
+```
+
+### getFileTypes
+
+getFileTypes(uri: string, mimeTypeFilter: string): Promise<Array<string>>
+
+Obtains the supported MIME types. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------------- | ------ | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI of the file. |
+| mimeTypeFilter | string | Yes | MIME types to match. Example:
**\*/\***: Obtain all supported types.
**image/\***: Obtain the MIMEs with the main type of **image**.
**\*/jpg**: Obtain the MIMEs with the subtype of **jpg**.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------ | ------------------------ |
+| Promise<Array<string>> | Promise used to return the MIME types obtained.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+let mimeTypeFilter = "image/*";
+dataShareHelper.getFileTypes(uri, mimeTypeFilter).then((data) => {
+ console.log("getFileTypes succeed, data : " + data);
+}).catch((err) => {
+ console.log("getFileTypes failed, error message : " + err);
+});
+```
+
+### normalizeUri
+
+normalizeUri(uri: string, callback: AsyncCallback<string>): void
+
+Normalizes a **DataShare** URI. The **DataShare** URI can be used only by the local device, but the normalized URI can be used across devices. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | -------------------------------------------------------- |
+| uri | string | Yes | [URI](js-apis-uri.md#uri) to normalize. |
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the normalized URI (if **null** is returned, URI normalization is not supported). Otherwise, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.normalizeUri(uri, (err, data) => {
+ if (err != undefined) {
+ console.log("normalizeUri failed, error message : " + err);
+ }else{
+ console.log("normalizeUri = " + data);
+ }
+});
+```
+
+### normalizeUri
+
+normalizeUri(uri: string): Promise<string>
+
+Normalizes a **DataShare** URI. The **DataShare** URI can be used only by the local device, but the normalized URI can be used across devices. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ----------------------------------------- |
+| uri | string | Yes | [URI](js-apis-uri.md#uri) to normalize.|
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ---------------------------------------------- |
+| Promise<string> | Promise used to return the result. If URI normalization is supported, the normalized URI is returned. Otherwise, **null** is returned.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.normalizeUri(uri).then((data) => {
+ console.log("normalizeUri = " + data);
+}).catch((err) => {
+ console.log("normalizeUri failed, error message : " + err);
+});
+```
+
+### denormalizeUri
+
+denormalizeUri(uri: string, callback: AsyncCallback<string>): void
+
+Denormalizes a URI. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | --------------------------------------------------- |
+| uri | string | Yes | [URI](js-apis-uri.md#uri) to denormalize.|
+| callback | AsyncCallback<string> | Yes | Callback invoked to return the result. If the operation is successful, **err** is **undefined** and **data** is the URI obtained. If the original URI is returned, denormalization is not required. If **null** is returned, denormalization is not supported. If the operation fails, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.denormalizeUri(uri, (err, data) => {
+ if (err != undefined) {
+ console.log("denormalizeUri failed, error message : " + err);
+ }else{
+ console.log("denormalizeUri = " + data);
+ }
+});
+```
+
+### denormalizeUri
+
+denormalizeUri(uri: string): Promise<string>
+
+Denormalizes a URI. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ------------------------------------------- |
+| uri | string | Yes | [URI](js-apis-uri.md#uri) to denormalize.|
+
+**Return value**
+
+| Type | Description |
+| ---------------- | ----------------------------------------- |
+| Promise<string> | Promise used to return the result. If the denormalization is successful, the URI obtained is returned. If no operation is required, the original URI is returned. If denormalization is not supported, **null** is returned.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.denormalizeUri(uri).then((data) => {
+ console.log("denormalizeUri = " + data);
+}).catch((err) => {
+ console.log("denormalizeUri failed, error message : " + err);
+});
+```
+
+### notifyChange
+
+notifyChange(uri: string, callback: AsyncCallback<void>): void
+
+Notifies the registered observer of data changes. This API uses an asynchronous callback to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback<void> | Yes | Callback invoked to return the result. If the observer is notified of the data changes, **err** is **undefined**. Otherwise, **err** is an error object.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.notifyChange(uri, () => {
+ console.log("***** notifyChange *****");
+});
+```
+
+### notifyChange
+
+notifyChange(uri: string): Promise<void>
+
+Notifies the registered observer of data changes. This API uses a promise to return the result.
+
+This API can be used only in the stage model.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Consumer
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | -------------------- |
+| uri | string | Yes | URI of the data.|
+
+**Return value**
+
+| Type | Description |
+| -------------- | --------------------- |
+| Promise<void> | Promise that returns no value.|
+
+**Example**
+
+```ts
+import Ability from '@ohos.application.Ability'
+let uri = ("datashare:///com.samples.datasharetest.DataShare");
+dataShareHelper.notifyChange(uri);
+```
diff --git a/en/application-dev/reference/apis/js-apis-data-dataSharePredicates.md b/en/application-dev/reference/apis/js-apis-data-dataSharePredicates.md
new file mode 100644
index 0000000000000000000000000000000000000000..16c1c1c7b622782a577719bae992d10b1f4634a0
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-data-dataSharePredicates.md
@@ -0,0 +1,861 @@
+# Data Share Predicates
+
+You can use **DataSharePredicates** to specify conditions for [updating](js-apis-data-dataShare.md#update), [deleting](js-apis-data-dataShare.md#delete), and [querying](js-apis-data-dataShare.md#query) data with **DataShare**.
+
+>**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
+
+```ts
+import dataSharePredicates from '@ohos.data.dataSharePredicates';
+```
+
+## equalTo
+
+equalTo(field: string, value: ValueType): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value equal to the specified value.
+
+Currently, only the relational database (RDB) and key-value database (KVDB, schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | --------------------------------------------------- | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.equalTo("NAME", "Rose")
+```
+
+## notEqualTo
+
+notEqualTo(field: string, value: ValueType): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value not equal to the specified value.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | --------------------------------------------------- | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.notEqualTo("NAME", "Rose")
+```
+
+## beginWrap
+
+beginWrap(): DataSharePredicates
+
+Adds a left parenthesis to this **DataSharePredicates**. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | ---------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object with a left parenthesis.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.equalTo("NAME", "lisi")
+ .beginWrap()
+ .equalTo("AGE", 18)
+ .or()
+ .equalTo("SALARY", 200.5)
+ .endWrap()
+```
+
+## endWrap
+
+endWrap(): DataSharePredicates
+
+Adds a right parenthesis to this **DataSharePredicates** object. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | ---------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object with a right parenthesis.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.equalTo("NAME", "lisi")
+ .beginWrap()
+ .equalTo("AGE", 18)
+ .or()
+ .equalTo("SALARY", 200.5)
+ .endWrap()
+```
+
+## or
+
+or(): DataSharePredicates
+
+Adds the OR condition to this **DataSharePredicates** object.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | ---------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object with the OR condition.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.equalTo("NAME", "lisi")
+ .or()
+ .equalTo("NAME", "Rose")
+```
+
+## and
+
+and(): DataSharePredicates
+
+Adds the AND condition to this **DataSharePredicates** object.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | ---------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object with the AND condition.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.equalTo("NAME", "lisi")
+ .and()
+ .equalTo("SALARY", 200.5)
+```
+
+## contains
+
+contains(field: string, value: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the string that contains the specified value. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | string | Yes | Value contained in the string.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.contains("NAME", "os")
+```
+
+## beginsWith
+
+beginsWith(field: string, value: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match a string that starts with the specified value. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | string | Yes | Start value of the string.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.beginsWith("NAME", "os")
+```
+
+## endsWith
+
+endsWith(field: string, value: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match a string that ends with the specified value. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | string | Yes | End value of the string.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.endsWith("NAME", "os")
+```
+
+## isNull
+
+isNull(field: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field whose value is null.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------ |
+| field | string | Yes | Column name in the database table.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.isNull("NAME")
+```
+
+## isNotNull
+
+isNotNull(field: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field whose value is not null.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------ |
+| field | string | Yes | Column name in the database table.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.isNotNull("NAME")
+```
+
+## like
+
+like(field: string, value: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match a string that is similar to the specified value.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | string | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.like("NAME", "%os%")
+```
+
+## unlike
+
+unlike(field: string, value: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match a string that is not similar to the specified value.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | string | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.unlike("NAME", "%os%")
+```
+
+## glob
+
+glob(field: string, value: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the specified string. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | string | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified string.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.glob("NAME", "?h*g")
+```
+
+## between
+
+between(field: string, low: ValueType, high: ValueType): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value within the specified range. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | --------------------------------------------------- | ---- | ------------------------ |
+| field | string | Yes | Column name in the database table. |
+| low | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | The lowest value of the range.|
+| high | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | The highest value of the range.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.between("AGE", 10, 50)
+```
+
+## notBetween
+
+notBetween(field: string, low: ValueType, high: ValueType): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value out of the specified range. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | --------------------------------------------------- | ---- | ------------------------ |
+| field | string | Yes | Column name in the database table. |
+| low | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | The lowest value of the range.|
+| high | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | The highest value of the range.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.notBetween("AGE", 10, 50)
+```
+
+## greaterThan
+
+greaterThan(field: string, value: ValueType): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value greater than the specified value.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | --------- | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.greaterThan("AGE", 10)
+```
+
+## lessThan
+
+lessThan(field: string, value: ValueType): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value less than the specified value.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | --------------------------------------------------- | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.lessThan("AGE", 50)
+```
+
+## greaterThanOrEqualTo
+
+greaterThanOrEqualTo(field: string, value: ValueType): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value greater than or equal to the specified value.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | --------- | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.greaterThanOrEqualTo("AGE", 10)
+```
+
+## lessThanOrEqualTo
+
+lessThanOrEqualTo(field: string, value: ValueType): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **ValueType** and value less than or equal to the specified value.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | --------- | ---- | ---------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | [ValueType](js-apis-data-ValuesBucket.md#valuetype) | Yes | Value to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.lessThanOrEqualTo("AGE", 50)
+```
+
+## orderByAsc
+
+orderByAsc(field: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object that sorts the values in a column in ascending order.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------ |
+| field | string | Yes | Column name in the database table.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.orderByAsc("AGE")
+```
+
+## orderByDesc
+
+orderByDesc(field: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object that sorts the values in a column in descending order.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | ------------------ |
+| field | string | Yes | Column name in the database table.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.orderByDesc("AGE")
+```
+
+## distinct
+
+distinct(): DataSharePredicates
+
+Sets a **DataSharePredicates** object to filter out duplicate records. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.equalTo("NAME", "Rose").distinct()
+```
+
+## limit
+
+limit(total: number, offset: number): DataSharePredicates
+
+Sets a **DataSharePredicates** object to specify the number of results and the start position.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| -------- | ------ | ---- | -------------- |
+| total | number | Yes | Number of results. |
+| offset | number | Yes | Start position.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.equalTo("NAME", "Rose").limit(10, 3)
+```
+
+## groupBy
+
+groupBy(fields: Array<string>): DataSharePredicates
+
+Sets a **DataSharePredicates** object to group the records according to the specified parameters. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------------- | ---- | -------------------- |
+| fields | Array<string> | Yes | Names of the columns to group.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.groupBy(["AGE", "NAME"])
+```
+
+## indexedBy
+
+indexedBy(field: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to specify the index column. Currently, only the RDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------- |
+| field | string | Yes | Name of the index column.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.indexedBy("SALARY_INDEX")
+```
+
+## in
+
+in(field: string, value: Array<ValueType>): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **Array** and value within the specified range.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ---------------- | ---- | --------------------------------------- |
+| field | string | Yes| Column name in the database table. |
+| value | Array<[ValueType](js-apis-data-ValuesBucket.md#valuetype)> | Yes | Array of **ValueType**s to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.in("AGE", [18, 20])
+```
+
+## notIn
+
+notIn(field: string, value: Array<ValueType>): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the field with data type **Array** and value out of the specified range.
+
+Currently, only the RDB and KVDB (schema) support this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ------- | ---------------- | ---- | --------------------------------------- |
+| field | string | Yes | Column name in the database table. |
+| value | Array<[ValueType](js-apis-data-ValuesBucket.md#valuetype)> | Yes | Array of **ValueType**s to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.notIn("NAME", ["Lisa", "Rose"])
+```
+
+## prefixKey
+
+prefixKey(prefix: string): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match a field with the specified key prefix. Currently, only the KVDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------ | ---- | -------------- |
+| prefix | string | Yes | Key prefix to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.prefixKey("NAME")
+```
+
+## inKeys
+
+inKeys(keys: Array<string>): DataSharePredicates
+
+Sets a **DataSharePredicates** object to match the fields whose keys are within the given range. Currently, only the KVDB supports this **DataSharePredicates** object.
+
+**System capability**: SystemCapability.DistributedDataManager.DataShare.Core
+
+**Parameters**
+
+| Name| Type | Mandatory| Description |
+| ------ | ------------- | ---- | ------------------ |
+| inKeys | Array<string> | Yes | Array of the keys to match.|
+
+**Return value**
+
+| Type | Description |
+| ------------------------------------------- | -------------------------- |
+| [DataSharePredicates](#datasharepredicates) | **DataSharePredicates** object that matches the specified field.|
+
+**Example**
+
+```ts
+let predicates = new dataSharePredicates.DataSharePredicates()
+predicates.inKeys(["Lisa", "Rose"])
+```
diff --git a/en/application-dev/reference/apis/js-apis-data-distributedobject.md b/en/application-dev/reference/apis/js-apis-data-distributedobject.md
index a58a4583a1db69548342f0c63b8a13aec0dfb623..83875a6edb8aa2395b8750e70fb86b7fa596b03d 100644
--- a/en/application-dev/reference/apis/js-apis-data-distributedobject.md
+++ b/en/application-dev/reference/apis/js-apis-data-distributedobject.md
@@ -1,6 +1,6 @@
# Distributed Data Object
-Provides basic data object management, including creating, querying, deleting, modifying, and subscribing to data objects, and distributed data object collaboration for the same application among multiple devices.
+The distributedDataObject module provides basic data object management, including creating, querying, deleting, modifying, and subscribing to data objects, and distributed data object collaboration for the same application among multiple devices.
> **NOTE**
>
@@ -23,9 +23,9 @@ Creates a distributed data object.
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| source | object | Yes| Attribute of the distributed data object to create.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | source | object | Yes| Attribute of the distributed data object to create.|
**Return value**
| Type| Description|
@@ -33,12 +33,11 @@ Creates a distributed data object.
| [DistributedObject](#distributedobject) | Distributed data object created.|
**Example**
- ```js
- import distributedObject from '@ohos.data.distributedDataObject';
- // Create a distributed data object, which contains attributes of four types, namely, string, number, boolean, and object.
- var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,
- parent:{mother:"jack mom",father:"jack Dad"}});
- ```
+```js
+import distributedObject from '@ohos.data.distributedDataObject';
+// Create a distributed data object, which contains attributes of four types, namely, string, number, boolean, and object.
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});
+```
## distributedObject.genSessionId
@@ -50,15 +49,15 @@ Creates a random session ID.
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Return value**
-| Type| Description|
-| -------- | -------- |
-| string | Session ID created.|
+ | Type| Description|
+ | -------- | -------- |
+ | string | Session ID created.|
**Example**
- ```js
- import distributedObject from '@ohos.data.distributedDataObject';
- var sessionId = distributedObject.genSessionId();
- ```
+```js
+import distributedObject from '@ohos.data.distributedDataObject';
+var sessionId = distributedObject.genSessionId();
+```
## SaveSuccessResponse9+
@@ -98,27 +97,26 @@ Sets a session ID for synchronization. Automatic synchronization is performed fo
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| sessionId | string | No| ID of a distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | sessionId | string | No| ID of a distributed data object on a trusted network. To remove a distributed data object from the network, set this parameter to "" or leave it empty.|
**Return value**
-| Type| Description|
-| -------- | -------- |
-| boolean | Returns **true** if the session ID is set successfully;
returns **false** otherwise. |
+ | Type| Description|
+ | -------- | -------- |
+ | boolean | Returns **true** if the session ID is set successfully;
returns **false** otherwise. |
**Example**
- ```js
- import distributedObject from '@ohos.data.distributedDataObject';
- var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,
- parent:{mother:"jack mom",father:"jack Dad"}});
- // Add g_object to the distributed network.
- g_object.setSessionId(distributedObject.genSessionId());
- // Remove g_object from the distributed network.
- g_object.setSessionId("");
- ```
+```js
+import distributedObject from '@ohos.data.distributedDataObject';
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});;
+// Add g_object to the distributed network.
+g_object.setSessionId(distributedObject.genSessionId());
+// Remove g_object from the distributed network.
+g_object.setSessionId("");
+```
### on('change')
@@ -130,15 +128,15 @@ Subscribes to the changes of this distributed data object.
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data changes.|
-| callback | Callback<{ sessionId: string, fields: Array<string> }> | Yes| Callback used to return the changes of the distributed data object.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type to subscribe to. The value is **change**, which indicates data changes.|
+ | callback | Callback<{ sessionId: string, fields: Array<string> }> | Yes| Callback used to return the changes of the distributed data object.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.|
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject';
-var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}});
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});
globalThis.changeCallback = (sessionId, changeData) => {
console.info("change" + sessionId);
if (changeData != null && changeData != undefined) {
@@ -159,16 +157,16 @@ Unsubscribes from the changes of this distributed data object.
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.|
-| callback | Callback<{ sessionId: string, fields: Array<string> }> | No| Callback to be unregistered. If this parameter is not set, all data change callbacks of the object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type to unsubscribe from. The value is **change**, which indicates data changes.|
+ | callback | Callback<{ sessionId: string, fields: Array<string> }> | No| Callback to be unregistered. If this parameter is not set, all data change callbacks of the object will be unregistered.
**sessionId** indicates the session ID of the distributed data object.
**fields** indicates the changed attributes of the distributed data object.|
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject';
-var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}});
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});
// Unregister the specified data change callback.
g_object.off("change", globalThis.changeCallback);
// Unregister all data change callbacks.
@@ -184,10 +182,10 @@ Subscribes to the status change (online or offline) of this distributed data obj
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| type | string | Yes| Event type to subscribe to. The value is **status**, which indicates the status change (online or offline) of the distributed data object.|
-| callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | Yes| Callback used to return the status change.
**sessionId**: session ID of the distributed data object.
**networkId**: object device ID, that is, **deviceId**.
**status** indicates the object status, which can be online or offline. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type to subscribe to. The value is **status**, which indicates the status change (online or offline) of the distributed data object.|
+ | callback | Callback<{ sessionId: string, networkId: string, status: 'online' \| 'offline' }> | Yes| Callback used to return the status change.
**sessionId**: session ID of the distributed data object.
**networkId**: object device ID, that is, **deviceId**.
**status** indicates the object status, which can be online or offline.|
**Example**
```js
@@ -195,7 +193,7 @@ import distributedObject from '@ohos.data.distributedDataObject';
globalThis.statusCallback = (sessionId, networkId, status) => {
globalThis.response += "status changed " + sessionId + " " + status + " " + networkId;
}
-var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}});
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});
g_object.on("status", globalThis.statusCallback);
```
@@ -209,16 +207,16 @@ Unsubscribes from the status change (online or offline) of this distributed data
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object.|
-| callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback used to return the status change. If this parameter is not specified, this API unsubscribes from all callbacks of this distributed data object.
**sessionId**: session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the status, which can be online or offline.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | type | string | Yes| Event type to unsubscribe from. The value is **status**, which indicates the status change (online or offline) of the distributed data object.|
+ | callback | Callback<{ sessionId: string, deviceId: string, status: 'online' \| 'offline' }> | No| Callback used to return the status change. If this parameter is not specified, this API unsubscribes from all callbacks of this distributed data object.
**sessionId**: session ID of the distributed data object.
**deviceId** indicates the device ID of the distributed data object.
**status** indicates the status, which can be online or offline.|
**Example**
```js
import distributedObject from '@ohos.data.distributedDataObject';
-var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false,parent:{mother:"jack mom",father:"jack Dad"}});
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false, parent:{mother:"jack mom",father:"jack Dad"}});
globalThis.statusCallback = (sessionId, networkId, status) => {
globalThis.response += "status changed " + sessionId + " " + status + " " + networkId;
}
@@ -245,24 +243,24 @@ The saved data will be released in the following cases:
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| deviceId | string | Yes| ID of the device where data is stored. The value **local** indicates the local device.|
-| callback | AsyncCallback<[SaveSuccessResponse](#savesuccessresponse)> | Yes| Callback used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | deviceId | string | Yes| ID of the device where data is stored. The value **local** indicates the local device.|
+ | callback | AsyncCallback<[SaveSuccessResponse](#savesuccessresponse9)> | Yes| Callback used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.|
**Example**
-
- ```ts
- import distributedObject from '@ohos.data.distributedDataObject';
- var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false});
- g_object.setSessionId("123456");
- g_object.save("local", (result)=>{
- console.log("save callback");
- console.info("save sessionId " + result.sessionId);
- console.info("save version " + result.version);
- console.info("save deviceId " + result.deviceId);
- });
- ```
+```js
+import distributedObject from '@ohos.data.distributedDataObject';
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false});
+g_object.setSessionId("123456");
+g_object.save("local", (status, result)=>{
+ console.log("save status = " + status);
+ console.log("save callback");
+ console.info("save sessionId: " + result.sessionId);
+ console.info("save version: " + result.version);
+ console.info("save deviceId: " + result.deviceId);
+});
+```
### save9+
@@ -281,31 +279,31 @@ The saved data will be released in the following cases:
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| deviceId | string | Yes| ID of the device where the data is saved. The default value is **local**, which indicates the local device. |
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | deviceId | string | Yes| ID of the device where the data is saved. The default value is **local**, which indicates the local device. |
- **Return value**
+**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<[SaveSuccessResponse](#savesuccessresponse)> | Promise used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.|
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<[SaveSuccessResponse](#savesuccessresponse9)> | Promise used to return **SaveSuccessResponse**, which contains information such as session ID, version, and device ID.|
**Example**
- ```ts
- import distributedObject from '@ohos.data.distributedDataObject';
- var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false});
- g_object.setSessionId("123456");
- g_object.save("local").then((result)=>{
- console.log("save callback");
- console.info("save sessionId " + result.sessionId);
- console.info("save version " + result.version);
- console.info("save deviceId " + result.deviceId);
- }, ()=>{
- console.error("save failed");
- });
- ```
+```js
+import distributedObject from '@ohos.data.distributedDataObject';
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false});
+g_object.setSessionId("123456");
+g_object.save("local").then((result)=>{
+ console.log("save callback");
+ console.info("save sessionId " + result.sessionId);
+ console.info("save version " + result.version);
+ console.info("save deviceId " + result.deviceId);
+}, ()=>{
+ console.error("save failed");
+});
+```
### revokeSave9+
@@ -319,20 +317,20 @@ If the object is stored on another device, the data on the local device will be
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
**Parameters**
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| callback | AsyncCallback<[RevokeSaveSuccessResponse](#revokesavesuccessresponse)> | No| Callback used to return **RevokeSaveSuccessResponse**, which contains the session ID.|
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | callback | AsyncCallback<[RevokeSaveSuccessResponse](#revokesavesuccessresponse9)> | No| Callback used to return **RevokeSaveSuccessResponse**, which contains the session ID.|
**Example**
- ```ts
- import distributedObject from '@ohos.data.distributedDataObject';
- var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false});
- g_object.setSessionId("123456");
- g_object.revokeSave((result, data) =>{
- console.log("revokeSave callback");
- });
- ```
+```js
+import distributedObject from '@ohos.data.distributedDataObject';
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false});
+g_object.setSessionId("123456");
+g_object.revokeSave((result, data) =>{
+ console.log("revokeSave callback");
+});
+```
### revokeSave9+
@@ -345,22 +343,22 @@ If the object is stored on another device, the data on the local device will be
**System capability**: SystemCapability.DistributedDataManager.DataObject.DistributedObject
- **Return value**
+**Return value**
-| Type| Description|
-| -------- | -------- |
-| Promise<[RevokeSaveSuccessResponse](#revokesavesuccessresponse)> | Promise used to return **RevokeSaveSuccessResponse**, which contains the session ID.|
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<[RevokeSaveSuccessResponse](#revokesavesuccessresponse9)> | Promise used to return **RevokeSaveSuccessResponse**, which contains the session ID.|
**Example**
- ```ts
- import distributedObject from '@ohos.data.distributedDataObject';
- var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false});
- g_object.setSessionId("123456");
- g_object.revokeSave("local").then((result)=>{
- console.log("revokeSave callback");
- console.log("sessionId" + result.sessionId);
- }, ()=>{
- console.error("revokeSave failed");
- });
- ```
+```js
+import distributedObject from '@ohos.data.distributedDataObject';
+var g_object = distributedObject.createDistributedObject({name:"Amy", age:18, isVis:false});
+g_object.setSessionId("123456");
+g_object.revokeSave().then((result)=>{
+ console.log("revokeSave callback");
+ console.log("sessionId" + result.sessionId);
+}, ()=>{
+ console.error("revokeSave failed");
+});
+```
diff --git a/en/application-dev/reference/apis/js-apis-data-preferences.md b/en/application-dev/reference/apis/js-apis-data-preferences.md
index 63371ed42b8eb940caa8072ffda6aa17d78658c5..560696c1ca48cb404aa0a29e95f8c3c1a1841198 100644
--- a/en/application-dev/reference/apis/js-apis-data-preferences.md
+++ b/en/application-dev/reference/apis/js-apis-data-preferences.md
@@ -681,7 +681,7 @@ Enumerates the value types.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
-| Name | Description |
+| Type | Description |
| -------------- | ------------------------------ |
| number | The value is a number. |
| string | The value is a string. |
diff --git a/en/application-dev/reference/apis/js-apis-data-rdb.md b/en/application-dev/reference/apis/js-apis-data-rdb.md
index 71b5d2bec230d88f378b1fa122319e8ba983c6e7..38c07d6247487e037e9158a00e5c2f752621b44e 100644
--- a/en/application-dev/reference/apis/js-apis-data-rdb.md
+++ b/en/application-dev/reference/apis/js-apis-data-rdb.md
@@ -781,13 +781,6 @@ Sets the **RdbPredicates** to filter out duplicate records.
```js
let predicates = new data_rdb.RdbPredicates("EMPLOYEE")
predicates.equalTo("NAME", "Rose").distinct("NAME")
-let promise = rdbStore.query(predicates, ["NAME"])
-promise.then((resultSet) => {
- console.log("ResultSet column names: " + resultSet.columnNames)
- console.log("ResultSet column count: " + resultSet.columnCount)
-}).catch((err) => {
- console.log("Query err.")
-})
```
@@ -1109,7 +1102,7 @@ Updates data in the RDB store based on the specified **DataSharePredicates** obj
| -------- | -------- | -------- | -------- |
| table | string | Yes| Name of the target table.|
| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
-| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates)| Yes| Update conditions specified by the **DataSharePredicates** object.|
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates)| Yes| Update conditions specified by the **DataSharePredicates** object.|
| callback | AsyncCallback<number> | Yes| Callback invoked to return the number of rows updated.|
**Example**
@@ -1133,7 +1126,7 @@ rdbStore.update("EMPLOYEE", valueBucket, predicates, function (err, ret) {
```
### update9+
-update(table: string, values: ValuesBucket, predicates: DataSharePredicates):Promise<number>
+update(table: string, values: ValuesBucket, predicates: dataSharePredicates.DataSharePredicates):Promise<number>
Updates data in the RDB store based on the specified **DataSharePredicates** object. This API uses a promise to return the result.
@@ -1144,7 +1137,7 @@ Updates data in the RDB store based on the specified **DataSharePredicates** obj
| -------- | -------- | -------- | -------- |
| table | string | Yes| Name of the target table.|
| values | [ValuesBucket](#valuesbucket) | Yes| Rows of data to update in the RDB store. The key-value pair is associated with the column name in the target table.|
-| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes| Update conditions specified by the **DataSharePredicates** object.|
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Update conditions specified by the **DataSharePredicates** object.|
**Return value**
| Type| Description|
@@ -1215,7 +1208,7 @@ Deletes data from the RDB store based on the specified **RdbPredicates** object.
**Return value**
| Type| Description|
| -------- | -------- |
-| Promise<number> | Promise used to return the number of rows updated.|
+| Promise<number> | Promise used to return the number of rows updated.|
**Example**
```js
@@ -1231,7 +1224,7 @@ promise.then((rows) => {
### delete9+
-delete(table: string, predicates: DataSharePredicates, callback: AsyncCallback<number>):void
+delete(table: string, predicates: dataSharePredicates.DataSharePredicates, callback: AsyncCallback<number>):void
Deletes data from the RDB store based on the specified **DataSharePredicates** object. This API uses an asynchronous callback to return the result.
@@ -1242,7 +1235,7 @@ Deletes data from the RDB store based on the specified **DataSharePredicates** o
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| table | string | Yes| Name of the target table.|
-| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes| Conditions specified by the **DataSharePredicates** object for deleting data.|
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Conditions specified by the **DataSharePredicates** object for deleting data.|
| callback | AsyncCallback<number> | Yes| Callback invoked to return the number of rows updated.|
**Example**
@@ -1270,12 +1263,12 @@ Deletes data from the RDB store based on the specified **DataSharePredicates** o
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| table | string | Yes| Name of the target table.|
-| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes| Conditions specified by the **DataSharePredicates** object for deleting data.|
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Conditions specified by the **DataSharePredicates** object for deleting data.|
**Return value**
| Type| Description|
| -------- | -------- |
-| Promise<number> | Promise used to return the number of rows updated.|
+| Promise<number> | Promise used to return the number of rows updated.|
**Example**
```js
@@ -1354,7 +1347,7 @@ Queries data in the RDB store based on specified conditions. This API uses a pro
### query9+
-query(predicates: DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void
+query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns: Array<string>, callback: AsyncCallback<ResultSet>):void
Queries data in the RDB store based on specified conditions. This API uses an asynchronous callback to return the result.
@@ -1363,7 +1356,8 @@ Queries data in the RDB store based on specified conditions. This API uses an as
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes| Query conditions specified by the **DataSharePredicates** object.|
+| table | string | Yes| Name of the target table.|
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Query conditions specified by the **DataSharePredicates** object.|
| columns | Array<string> | Yes| Columns to query. If this parameter is not specified, the query applies to all columns.|
| callback | AsyncCallback<[ResultSet](js-apis-data-resultset.md)> | Yes| Callback invoked to return the result. If the operation is successful, a **ResultSet** object will be returned.|
@@ -1384,7 +1378,7 @@ rdbStore.query("EMPLOYEE", predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"],
### query9+
-query(predicates: DataSharePredicates, columns?: Array<string>):Promise<ResultSet>
+query(table: string, predicates: dataSharePredicates.DataSharePredicates, columns?: Array<string>):Promise<ResultSet>
Queries data in the RDB store based on specified conditions. This API uses a promise to return the result.
@@ -1393,7 +1387,8 @@ Queries data in the RDB store based on specified conditions. This API uses a pro
**Parameters**
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
-| predicates | [DataSharePredicates](js-apis-data-DataSharePredicates.md#datasharepredicates) | Yes| Query conditions specified by the **DataSharePredicates** object.|
+| table | string | Yes| Name of the target table.|
+| predicates | [DataSharePredicates](js-apis-data-dataSharePredicates.md#datasharepredicates) | Yes| Query conditions specified by the **DataSharePredicates** object.|
| columns | Array<string> | No| Columns to query. If this parameter is not specified, the query applies to all columns.|
**Return value**
@@ -1591,7 +1586,7 @@ rdbStore.commit()
### rollBack8+
-rollBack():void;
+rollBack():void
Rolls back the SQL statements that have been executed.
@@ -1997,7 +1992,7 @@ Defines the data types allowed.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-| Name| Description|
+| Type| Description|
| -------- | -------- |
| number | Number.|
| string | String.|
@@ -2006,14 +2001,13 @@ Defines the data types allowed.
## ValuesBucket
-Defines a bucket to store key-value pairs.
+Defines the types of the key and value in a KV pair.
**System capability**: SystemCapability.DistributedDataManager.RelationalStore.Core
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| [key: string] | [ValueType](#valuetype)\| Uint8Array \| null | Yes| Defines a bucket to store key-value pairs.|
-
+| Key Type| Value Type|
+| -------- | -------- |
+| string | [ValueType](#valuetype)\| Uint8Array \| null |
## SyncMode8+
diff --git a/en/application-dev/reference/apis/js-apis-data-storage.md b/en/application-dev/reference/apis/js-apis-data-storage.md
index 47a961f7cceb3c20de583387d9ed54d5494e5ac4..45465710a587c51fea60e7c59f2b804c80888043 100644
--- a/en/application-dev/reference/apis/js-apis-data-storage.md
+++ b/en/application-dev/reference/apis/js-apis-data-storage.md
@@ -793,7 +793,7 @@ Enumerates the value types.
**System capability**: SystemCapability.DistributedDataManager.Preferences.Core
-| Name | Description |
+| Type | Description |
| ------- | -------------------- |
| number | The value is a number. |
| string | The value is a string. |
diff --git a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
index df69b38be754f255ce637249c18a9d2fca5e13fd..52af89ae7faa9fd20a28a62f959f4a3f39340ced 100644
--- a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
+++ b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
@@ -5,12 +5,6 @@
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the FA model.
-## Modules to Import
-
-```js
-import featureAbility from "@ohos.ability.featureAbility";
-```
-
## Usage
Import the following modules based on the actual situation before using the current module:
@@ -573,7 +567,7 @@ Inserts multiple data records into the database. This API uses an asynchronous c
| Name | Type | Mandatory| Description |
| ------------ | ----------------------- | ---- | -------------------------------- |
| uri | string | Yes | URI of the data to insert. |
-| valuesBucket | Array\ | Yes | Data records to insert. |
+| valuesBucket | Array | Yes | Data records to insert. |
| callback | AsyncCallback\ | Yes | Callback used to return the number of inserted data records.|
**Example**
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 93ab553ef10e531fea0b2d0871b65183d22bf6fa..8c27495f208ad620ed6e104fb19c958350805c1e 100644
--- a/en/application-dev/reference/apis/js-apis-device-manager.md
+++ b/en/application-dev/reference/apis/js-apis-device-manager.md
@@ -1,11 +1,22 @@
# Device Management
->  **NOTE**
+The **DeviceManager** module provides APIs for distributed device management.
+
+System applications can call the APIs to do the following:
+
+- Subscribe to or unsubscribe from device state changes.
+- Discover peripheral untrusted devices.
+- Authenticate or deauthenticate a device.
+- Query the trusted device list.
+- Query local device information, including the device name, type, and ID.
+
+> **NOTE**
+>
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> - The APIs of this module are system APIs and cannot be called by third-party applications.
-## Modules to import:
+## Modules to Import
```
import deviceManager from '@ohos.distributedHardware.deviceManager';
@@ -21,10 +32,10 @@ Creates a **DeviceManager** instance.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
- **Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | bundleName | string | Yes| Bundle name of the application.|
- | callback | AsyncCallback<[DeviceManager](#devicemanager)> | Yes| Callback invoked to return the **DeviceManager** instance created.|
+ | Name | Type | Mandatory | Description |
+ | ---------- | ---------------------------------------- | ---- | ------------------------------------ |
+ | bundleName | string | Yes | Bundle name of an application. |
+ | callback | AsyncCallback<[DeviceManager](#devicemanager)> | Yes | Callback used to return the **DeviceManager** instance created.|
- Example
```
@@ -34,10 +45,40 @@ Creates a **DeviceManager** instance.
return;
}
console.info("createDeviceManager success");
- this.dmInstance = data;
+ let dmInstance = data;
});
```
+## DeviceInfo
+
+Defines device information.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+| Name | Type | Mandatory | Description |
+| ---------------------- | ------------------------- | ---- | -------- |
+| deviceId | string | Yes | Unique identifier of a device.|
+| deviceName | string | Yes | Device name. |
+| deviceType | [DeviceType](#devicetype) | Yes | Device type. |
+| networkId8+ | string | Yes | Network ID of the device. |
+
+
+## DeviceType
+
+Enumerates the device types.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+| Name | Default Value | Description |
+| ------------ | ---- | ---- |
+| SPEAKER | 0x0A | Smart speaker.|
+| PHONE | 0x0E | Phone. |
+| TABLET | 0x11 | Tablet. |
+| WEARABLE | 0x6D | Wearable.|
+| TV | 0x9C | Smart TV. |
+| CAR | 0x83 | Car. |
+| UNKNOWN_TYPE | 0 | Unknown device type.|
+
## DeviceStateChangeAction
@@ -45,42 +86,103 @@ Enumerates the device states.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
-| Name| Default Value| Description|
-| -------- | -------- | -------- |
-| ONLINE | 0 | The device is online.|
-| READY | 1 | The device is ready, and the device information has been synchronized.|
-| OFFLINE | 2 | The device is offline.|
-| CHANGE | 3 | The device information is changed.|
+| Name | Default Value | Description |
+| ------- | ---- | --------------- |
+| ONLINE | 0 | The device is online. |
+| READY | 1 | The device is ready, and the device information has been synchronized.|
+| OFFLINE | 2 | The device is offline. |
+| CHANGE | 3 | The device information is changed. |
+## SubscribeInfo
-## DeviceType
+Defines subscription information.
-Enumerates the device types.
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+| Name | Type | Mandatory | Description |
+| ------------- | --------------------------------- | ---- | ----------------- |
+| subscribeId | number | Yes | Subscription ID, used to identify a device discovery period.|
+| mode | [DiscoverMode ](#discovermode) | No | Device discovery mode. |
+| medium | [ExchangeMedium](#exchangemedium) | No | Medium used for device discovery. |
+| freq | [ExchangeFreq](#exchangefreq) | No | Frequency of device discovery. |
+| isSameAccount | boolean | No | Whether the same account is used on the discovered device. |
+| isWakeRemote | boolean | No | Whether to wake up the discovered device. |
+| capability | [SubscribeCap](#subscribecap) | No | Discovery capability. |
+
+
+## DiscoverMode
+
+Enumerates the device discovery modes.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
-| Name| Default Value| Description|
-| -------- | -------- | -------- |
-| SPEAKER | 0x0A | Smart speaker.|
-| PHONE | 0x0E | Phone.|
-| TABLET | 0x11 | Tablet.|
-| WEARABLE | 0x6D | Wearable.|
-| TV | 0x9C | Smart TV.|
-| CAR | 0x83 | Car.|
-| UNKNOWN_TYPE | 0 | Unknown device type.|
+| Name | Default Value | Description |
+| --------------------- | ---- | ----- |
+| DISCOVER_MODE_PASSIVE | 0x55 | Passive discovery.|
+| DISCOVER_MODE_ACTIVE | 0xAA | Active discovery.|
-## DeviceInfo
+## ExchangeMedium
-Defines device information.
+Enumerates the media used for device discovery.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
-| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| deviceId | number | Yes| Unique device identifier.|
-| deviceName | string | Yes| Device name.|
-| deviceType | number | Yes| Device type.|
+| Name | Default Value | Description |
+| ---- | ---- | --------- |
+| AUTO | 0 | Automatic. |
+| BLE | 1 | Bluetooth. |
+| COAP | 2 | Wi-Fi.|
+| USB | 3 | USB. |
+
+## ExchangeFreq
+
+Enumerates the device discovery frequencies.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+| Name | Default Value | Description |
+| ---------- | ---- | ----- |
+| LOW | 0 | Low frequency. |
+| MID | 1 | Medium frequency. |
+| HIGH | 2 | High frequency. |
+| SUPER_HIGH | 3 | Ultra-high frequency.|
+
+
+## SubscribeCap
+
+Enumerates the discovery capabilities.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+| Name | Default Value | Description |
+| ------------------------- | ---- | -------------- |
+| SUBSCRIBE_CAPABILITY_DDMP | 0 | DDMP capability. This will be deprecated later.|
+| SUBSCRIBE_CAPABILITY_OSD | 1 | OSD capability. |
+
+
+## AuthParam
+
+Defines the authentication parameters.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+| Name | Type | Mandatory | Description |
+| --------- | -------------------- | ---- | ---------- |
+| authType | number | Yes | Authentication type. |
+| extraInfo | {[key:string] : any} | No | Extended field.|
+
+## AuthInfo
+
+Defines authentication information.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+| Name | Type | Mandatory | Description |
+| --------- | -------------------- | ---- | ---------- |
+| authType | number | Yes | Authentication type. |
+| token | number | Yes | Authentication token. |
+| extraInfo | {[key:string] : any} | No | Extended field.|
## DeviceManager
@@ -92,12 +194,12 @@ Provides APIs to obtain information about trusted devices and local devices. Bef
release(): void
-Releases the **DeviceManager** instance that is no longer used.
+Releases this **DeviceManager** instance when it is no longer used.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
- Example
- ```
+ ```js
dmInstance.release();
```
@@ -111,16 +213,258 @@ Obtains all trusted devices synchronously.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
- Return value
- | Name| Description|
- | -------- | -------- |
+ | Name | Description |
+ | -------------------------------------- | --------- |
| Array<[DeviceInfo](#deviceinfo)> | List of trusted devices obtained.|
- Example
- ```
+ ```js
var deviceInfoList = dmInstance.getTrustedDeviceListSync();
```
+### getTrustedDeviceList8+
+
+getTrustedDeviceList(callback:AsyncCallback<Array<DeviceInfo>>): void
+
+Obtains all trusted devices. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | --------------------- |
+ | callback | AsyncCallback<Array<[DeviceInfo](#deviceinfo)>> | Yes | Callback used to return the list of trusted devices.|
+
+- Example
+ ```js
+ dmInstance.getTrustedDeviceList((err, data) => {
+ console.log("getTrustedDeviceList err: " + JSON.stringify(err));
+ console.log('get trusted device info: ' + JSON.stringify(data));
+ }
+ );
+ ```
+
+### getTrustedDeviceList8+
+
+getTrustedDeviceList(): Promise<Array<DeviceInfo>>
+
+Obtains all trusted devices. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- Return value
+ | Type | Description |
+ | ---------------------------------------- | --------------------- |
+ | Promise<Array<[DeviceInfo](#deviceinfo)>> | Promise used to return the list of trusted devices.|
+
+- Example
+ ```js
+ dmInstance.getTrustedDeviceList().then((data) => {
+ console.log('get trusted device info: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("getTrustedDeviceList err: " + JSON.stringify(err));
+ });
+ ```
+
+### getLocalDeviceInfoSync8+
+
+getLocalDeviceInfoSync(): [DeviceInfo](#deviceinfo)
+
+Obtains local device information synchronously.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- Return value
+ | Name | Description |
+ | -------------------------------------- | --------- |
+ | Array<[DeviceInfo](#deviceinfo)> | List of local devices obtained.|
+
+- Example
+ ```js
+ var deviceInfo = dmInstance.getLocalDeviceInfoSync();
+ ```
+
+
+### getLocalDeviceInfo8+
+
+getLocalDeviceInfo(callback:AsyncCallback<DeviceInfo>): void
+
+Obtains local device information. This API uses an asynchronous callback to return the result.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | --------- |
+ | callback | AsyncCallback<[DeviceInfo](#deviceinfo)> | Yes | Callback used to return the local device information.|
+
+- Example
+ ```js
+ dmInstance.getLocalDeviceInfo((err, data) => {
+ console.log("getLocalDeviceInfo err: " + JSON.stringify(err));
+ console.log('get local device info: ' + JSON.stringify(data));
+ }
+ );
+ ```
+
+### getLocalDeviceInfo8+
+
+getLocalDeviceInfo(): Promise<DeviceInfo>
+
+Obtains local device information. This API uses a promise to return the result.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- Return value
+ | Type | Description |
+ | ---------------------------------------- | --------------------- |
+ | Promise<[DeviceInfo](#deviceinfo)> | Promise used to return the local device information.|
+
+- Example
+ ```js
+ dmInstance.getLocalDeviceInfo().then((data) => {
+ console.log('get local device info: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("getLocalDeviceInfo err: " + JSON.stringify(err));
+ });
+ ```
+
+### startDeviceDiscovery
+
+startDeviceDiscovery(subscribeInfo: SubscribeInfo): void
+
+Starts to discover peripheral devices.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | ------------- | ------------------------------- | ---- | ----- |
+ | subscribeInfo | [SubscribeInfo](#subscribeinfo) | Yes | Subscription information.|
+
+- Example
+ ```js
+ // Automatically generate a unique subscription ID.
+ var subscribeId = Math.floor(Math.random() * 10000 + 1000);
+ var subscribeInfo = {
+ "subscribeId": subscribeId,
+ "mode": 0xAA, // Active discovery
+ "medium": 0, // Automatic. Multiple media can be used for device discovery.
+ "freq": 2, // High frequency
+ "isSameAccount": false,
+ "isWakeRemote": false,
+ "capability": 1
+ };
+ dmInstance.startDeviceDiscovery(subscribeInfo); // The deviceFound callback is invoked to notify the application when a device is discovered.
+ ```
+
+### stopDeviceDiscovery
+
+stopDeviceDiscovery(subscribeId: number): void
+
+Stops device discovery.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | ----------- | ------ | ---- | ----- |
+ | subscribeId | number | Yes | Subscription ID.|
+
+- Example
+ ```js
+ // The subscribeId input must be the same as that automatically generated in startDeviceDiscovery.
+ dmInstance.stopDeviceDiscovery(subscribeId);
+ ```
+
+### authenticateDevice
+
+authenticateDevice(deviceInfo: DeviceInfo, authParam: AuthParam, callback: AsyncCallback<{deviceId: string, pinToken ?: number}>): void
+
+Authenticates a device.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | ---------- | ---------------------------------------- | ---- | ------- |
+ | deviceInfo | [DeviceInfo](#deviceinfo) | Yes | Device information. |
+ | authParam | [AuthParam](#authparam) | Yes | Authentication parameter. |
+ | callback | AsyncCallback<{ deviceId: string, pinToken ?: number }> | Yes | Callback used to return the authentication result.|
+
+- Example
+ ```js
+ // Information about the device to authenticate. The information can be obtained from the device discovery result.
+ var deviceInfo ={
+ "deviceId": "XXXXXXXX",
+ "deviceName": "",
+ deviceType: 0x0E
+ };
+ let authParam = {
+ "authType": 1, // Authentication type. The value 1 means no account PIN authentication.
+ "extraInfo": {}
+ }
+ dmInstance.authenticateDevice(deviceInfo, authParam, (err, data) => {
+ if (err) {
+ console.info(TAG + "authenticateDevice err:" + JSON.stringify(err));
+ return;
+ }
+ console.info(TAG + "authenticateDevice result:" + JSON.stringify(data));
+ token = data.pinToken;
+ });
+ ```
+
+### unAuthenticateDevice8+
+
+unAuthenticateDevice(deviceInfo: DeviceInfo): void
+
+Deauthenticates a device.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | ---------- | ------------------------- | ---- | ----- |
+ | deviceInfo | [DeviceInfo](#deviceinfo) | Yes | Device information.|
+
+- Example
+ ```js
+ dmInstance.unAuthenticateDevice(deviceInfo);
+ ```
+
+
+### verifyAuthInfo
+
+verifyAuthInfo(authInfo: AuthInfo, callback: AsyncCallback<{deviceId: string, level: number}>): void
+
+Verifies authentication information.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | ------- |
+ | authInfo | [AuthInfo](#authinfo) | Yes | Authentication information. |
+ | authInfo | AsyncCallback<{ deviceId: string, level: number }> | Yes | Callback used to return the verification result.|
+
+- Example
+ ```js
+ let authInfo = {
+ "authType": 1,
+ "token": xxxxxx,
+ "extraInfo": {}
+ }
+ dmInstance.verifyAuthInfo(authInfo, (err, data) => {
+ if (err) {
+ console.info(TAG + "verifyAuthInfo err:" + JSON.stringify(err));
+ return;
+ }
+ console.info(TAG + "verifyAuthInfo result:" + JSON.stringify(data));
+ });
+ ```
+
+
### on('deviceStateChange')
on(type: 'deviceStateChange', callback: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void
@@ -130,13 +474,13 @@ Subscribes to changes in the device state.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
- **Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value is **deviceStateChange**, which indicates a device state change event.|
- | callback | Callback<{ action: [DeviceStateChangeAction](#devicestatechangeaction), device: [DeviceInfo](#deviceinfo) }> | Yes| Callback invoked to return the device information and state.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | ------------------------------ |
+ | type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event.|
+ | callback | Callback<{ action: [DeviceStateChangeAction](#devicestatechangeaction), device: [DeviceInfo](#deviceinfo) }> | Yes | Callback invoked to return the device information and state. |
- Example
- ```
+ ```js
dmInstance.on('deviceStateChange', (data) => {
console.info("deviceStateChange on:" + JSON.stringify(data));
}
@@ -146,20 +490,20 @@ Subscribes to changes in the device state.
### off('deviceStateChange')
-off(type: 'deviceStateChange', callback?: Call back<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void
+off(type: 'deviceStateChange', callback?: Callback<{ action: DeviceStateChangeAction, device: DeviceInfo }>): void
Unsubscribes from changes in the device state.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
- **Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **deviceStateChange** indicates an event of device state change.|
- | callback | Callback<{ action: [DeviceStateChangeAction](#devicestatechangeaction), device: [DeviceInfo](#deviceinfo) }> | Yes| Callback invoked to return the device information and state.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | --------------------------- |
+ | type | string | Yes | Event type. The value **'deviceStateChange'** indicates a device state change event. |
+ | callback | Callback<{ action: [DeviceStateChangeAction](#devicestatechangeaction), device: [DeviceInfo](#deviceinfo) }> | Yes | Callback invoked to return the device information and state.|
- Example
- ```
+ ```js
dmInstance.off('deviceStateChange', (data) => {
console.info('deviceStateChange' + JSON.stringify(data));
}
@@ -167,6 +511,95 @@ Unsubscribes from changes in the device state.
```
+### on('deviceFound')
+
+on(type: 'deviceFound', callback: Callback<{ subscribeId: number, device: DeviceInfo }>): void
+
+Subscribes to device discovery events.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | -------------------------- |
+ | type | string | Yes | Event type. The value **'deviceFound'** indicates an event reported when a device is discovered.|
+ | callback | Callback<{ subscribeId: number, device: DeviceInfo }> | Yes | Callback used for device discovery. |
+
+- Example
+ ```js
+ dmInstance.on('deviceFound', (data) => {
+ console.info("deviceFound:" + JSON.stringify(data));
+ }
+ );
+ ```
+
+### off('deviceFound')
+
+off(type: 'deviceFound', callback?: Callback<{ subscribeId: number, device: DeviceInfo }>): void
+
+Unsubscribes from device discovery events.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | --------------------------- |
+ | type | string | Yes | Event type. The value **'deviceFound'** indicates an event reported when a device is discovered. |
+ | callback | Callback<{ subscribeId: number, device: [DeviceInfo](#deviceinfo) }> | Yes | Callback used for device discovery, which is invoked to return the device information and state.|
+
+- Example
+ ```js
+ dmInstance.off('deviceFound', (data) => {
+ console.info('deviceFound' + JSON.stringify(data));
+ }
+ );
+ ```
+
+### on('discoverFail')
+
+on(type: 'discoverFail', callback: Callback<{ subscribeId: number, reason: number }>): void
+
+Subscribes to device discovery failures.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | ------------------------------ |
+ | type | string | Yes | Event type. The event **'discoverFail'** indicates an event reported when device discovery fails.|
+ | callback | Callback<{ subscribeId: number, reason: number }> | Yes | Callback used for the device discovery failure. |
+
+- Example
+ ```js
+ dmInstance.on('discoverFail', (data) => {
+ this.log("discoverFail on:" + JSON.stringify(data));
+ }
+ );
+ ```
+
+### off('discoverFail')
+
+off(type: 'discoverFail', callback?: Callback<{ subscribeId: number, reason: number }>): void
+
+Unsubscribes from device discovery failures.
+
+**System capability**: SystemCapability.DistributedHardware.DeviceManager
+
+- **Parameters**
+ | Name | Type | Mandatory | Description |
+ | -------- | ---------------------------------------- | ---- | ----------------- |
+ | type | string | Yes | Event type. The event **'discoverFail'** indicates an event reported when device discovery fails. |
+ | callback | Callback<{ subscribeId: number, reason: number }> | Yes | Callback used for the device discovery failure.|
+
+- Example
+ ```js
+ dmInstance.off('deviceFound', (data) => {
+ console.info('deviceFound' + JSON.stringify(data));
+ }
+ );
+ ```
+
+
### on('serviceDie')
on(type: 'serviceDie', callback: () => void): void
@@ -176,13 +609,13 @@ Subscribes to dead events of the **DeviceManager** service.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
- **Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **serviceDie** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
- | callback | () => void | Yes| Callback invoked when a dead event of the **DeviceManager** service occurs.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ----------------------- | ---- | ---------------------------------------- |
+ | type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
+ | callback | () => void | Yes | Callback invoked when a dead event of the **DeviceManager** service occurs. |
- Example
- ```
+ ```js
dmInstance.on("serviceDie", () => {
console.info("serviceDie on");
}
@@ -199,13 +632,13 @@ Unsubscribes from dead events of the **DeviceManager** service.
**System capability**: SystemCapability.DistributedHardware.DeviceManager
- **Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | type | string | Yes| Event type. The value **serviceDie** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
- | callback | () => void | No| Callback used to return the dead event of the **DeviceManager** service.|
+ | Name | Type | Mandatory | Description |
+ | -------- | ----------------------- | ---- | ---------------------------------------- |
+ | type | string | Yes | Event type. The value **'serviceDie'** indicates an event reported when the **DeviceManager** service is terminated unexpectedly.|
+ | callback | () => void | No | Callback used to return the dead event of the **DeviceManager** service. |
- Example
- ```
+ ```js
dmInstance.off("serviceDie", () => {
console.info("serviceDie off");
}
diff --git a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md
index 2ae6d7b5a18696850e13d8d088f9a1300561742c..8d18622ce2eb432210858545308e2a607891b1f0 100644
--- a/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md
+++ b/en/application-dev/reference/apis/js-apis-deviceUsageStatistics.md
@@ -1,6 +1,24 @@
# Device Usage Statistics
-> **NOTE**
+This module provides APIs for collecting statistics on device usage.
+
+System applications can call these APIs to implement the following features:
+
+- Query the usage duration in different time segments, events (foreground, background, start and end of continuous tasks), and the number of notifications, on a per application basis.
+- Query statistics about system events (sleep, wakeup, unlock, and screen lock).
+- Query the bundle group information of applications, including the invoking application itself.
+- Query the idle status of applications, including the invoking application itself.
+- Set the bundle group for other applications.
+- Register and deregister the callback for application group changes.
+
+Third-party applications can call these APIs to implement the following features:
+
+- Query the idle status of the invoking application itself.
+- Query the bundle group information of the invoking application itself.
+- Query the events of the invoking application itself.
+
+> **NOTE**
+>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -23,7 +41,7 @@ Checks whether the application specified by **bundleName** is in the idle state.
| Name | Type | Mandatory | Description |
| ---------- | ---------------------------- | ---- | ---------------------------------------- |
| bundleName | string | Yes | Bundle name of an application. |
-| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the value of **bundleName** is valid, **null** will be returned.|
+| callback | AsyncCallback<boolean> | Yes | Callback used to return the result. If the value of bundleName is valid, null will be returned.|
**Example**
@@ -69,7 +87,7 @@ Checks whether the application specified by **bundleName** is in the idle state.
## bundleState.queryAppUsagePriorityGroup
-queryAppUsagePriorityGroup(): Promise\
+queryAppUsagePriorityGroup(): Promise<number>
Queries the priority group of this application. This API uses a promise to return the result.
@@ -79,7 +97,7 @@ Queries the priority group of this application. This API uses a promise to retur
| Type | Description |
| --------------- | --------------------------- |
-| Promise\ | Promise used to return the result.|
+| Promise<number> | Promise used to return the result.|
**Example**
@@ -93,7 +111,7 @@ bundleState.queryAppUsagePriorityGroup().then( res => {
## bundleState.queryAppUsagePriorityGroup
-queryAppUsagePriorityGroup(callback: AsyncCallback\): void
+queryAppUsagePriorityGroup(callback: AsyncCallback<number>): void
Queries the priority group of this application. This API uses an asynchronous callback to return the result.
@@ -103,20 +121,11 @@ Queries the priority group of this application. This API uses an asynchronous ca
| Name | Type | Mandatory | Description |
| -------- | --------------------- | ---- | -------------------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+| callback | AsyncCallback<number> | Yes | Callback used to return the result.|
**Example**
```javascript
-// Callback with bundleName
-bundleState.queryAppUsagePriorityGroup(this.bundleName, (err, res) => {
- if(err) {
- console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
- } else {
- console.log('BUNDLE_ACTIVE QueryPackageGroup callback succeeded. result: ' + JSON.stringify(res));
- }
-});
-// Callback without bundleName
bundleState.queryAppUsagePriorityGroup((err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
@@ -523,7 +532,7 @@ Obtains the number of FA usage records specified by **maxNum**. This API uses an
## bundleState.queryAppUsagePriorityGroup9+
-queryAppUsagePriorityGroup(bundleName? : string): Promise
+queryAppUsagePriorityGroup(bundleName? : string): Promise<number>
Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses a promise to return the result.
@@ -543,13 +552,14 @@ Queries the priority group of the application specified by **bundleName**. If **
| Type | Description |
| --------------- | --------------------------- |
-| Promise\ | Promise used to return the result.|
+| Promise<number> | Promise used to return the result.|
**Example**
```javascript
// Promise with bundleName
-bundleState.queryAppUsagePriorityGroup(this.bundleName).then( res => {
+let bundleName = "com.ohos.camera";
+bundleState.queryAppUsagePriorityGroup(bundleName).then( res => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise succeeded. result: ' + JSON.stringify(res));
}).catch( err => {
console.log('BUNDLE_ACTIVE QueryPackageGroup promise failed. because: ' + err.code);
@@ -564,7 +574,7 @@ bundleState.queryAppUsagePriorityGroup().then( res => {
## bundleState.queryAppUsagePriorityGroup9+
-queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback\): void
+queryAppUsagePriorityGroup(bundleName? : string, callback: AsyncCallback<number>): void
Queries the priority group of the application specified by **bundleName**. If **bundleName** is not specified, the priority group of the current application is queried. This API uses an asynchronous callback to return the result.
@@ -579,13 +589,14 @@ Queries the priority group of the application specified by **bundleName**. If **
| Name | Type | Mandatory | Description |
| ---------- | --------------------- | ---- | ---------------------------------------- |
| bundleName | string | No | Bundle name of the target application. If this parameter is not specified, the priority group of the current application is queried.|
-| callback | AsyncCallback\ | Yes | Callback used to return the result. |
+| callback | AsyncCallback<number> | Yes | Callback used to return the result. |
**Example**
```javascript
// Callback with bundleName
-bundleState.queryAppUsagePriorityGroup(this.bundleName, (err, res) => {
+let bundleName = "com.ohos.camera";
+bundleState.queryAppUsagePriorityGroup(bundleName, (err, res) => {
if(err) {
console.log('BUNDLE_ACTIVE QueryPackageGroup callback failed. because: ' + err.code);
} else {
@@ -604,7 +615,7 @@ bundleState.queryAppUsagePriorityGroup((err, res) => {
## bundleState.setBundleGroup9+
-setBundleGroup(bundleName: string, newGroup: GroupType): Promise\
+setBundleGroup(bundleName: string, newGroup: GroupType): Promise<void>
Sets the group for the application specified by **bundleName**. This API uses a promise to return the result.
@@ -618,22 +629,22 @@ Sets the group for the application specified by **bundleName**. This API uses a
| Name | Type | Mandatory | Description |
| ---------- | --------- | ---- | ---- |
-| bundleName | string | Yes | Bundle name of the target application.|
-| newGroup | GroupType | Yes | Application group.|
+| bundleName | string | Yes | Bundle name of an application.|
+| newGroup | [GroupType](#grouptype) | Yes | Application group.|
**Return value**
| Type | Description |
| ------------- | ------------------------- |
-| Promise\ | Promise used to return the result.|
+| Promise<void> | Promise used to return the result.|
**Example**
```javascript
-this.bundleName = "com.example.deviceUsageStatistics";
-this.newGroup = stats.GroupType.ACTIVE_GROUP_DAILY;
+let bundleName = "com.example.deviceUsageStatistics";
+let newGroup = bundleState.GroupType.ACTIVE_GROUP_DAILY;
-bundleState.setBundleGroup(this.bundleName, this.newGroup).then( () => {
+bundleState.setBundleGroup(bundleName, newGroup).then( () => {
console.log('BUNDLE_ACTIVE SetBundleGroup promise succeeded.');
}).catch( err => {
console.log('BUNDLE_ACTIVE SetBundleGroup promise failed. because: ' + err.code);
@@ -642,7 +653,7 @@ bundleState.setBundleGroup(this.bundleName, this.newGroup).then( () => {
## bundleState.setBundleGroup9+
-setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback\): void
+setBundleGroup(bundleName: string, newGroup: GroupType, callback: AsyncCallback<void>): void
Sets the group for the application specified by **bundleName**. This API uses an asynchronous callback to return the result.
@@ -656,17 +667,17 @@ Sets the group for the application specified by **bundleName**. This API uses an
| Name | Type | Mandatory | Description |
| ---------- | ------------------- | ---- | ------------------------- |
-| bundleName | string | Yes | Bundle name of the target application. |
-| newGroup | GroupType | Yes | Application group. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+| bundleName | string | Yes | Bundle name of an application. |
+| newGroup | [GroupType](#grouptype) | Yes | Application group. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```javascript
-this.bundleName = "com.example.deviceUsageStatistics";
-this.newGroup = stats.GroupType.ACTIVE_GROUP_DAILY;
+let bundleName = "com.example.deviceUsageStatistics";
+let newGroup = bundleState.GroupType.ACTIVE_GROUP_DAILY;
-bundleState.setBundleGroup(this.bundleName, this.newGroup, (err) => {
+bundleState.setBundleGroup(bundleName, newGroup, (err) => {
if(err) {
console.log('BUNDLE_ACTIVE SetBundleGroup callback failed. because: ' + err.code);
} else {
@@ -677,9 +688,9 @@ bundleState.setBundleGroup(this.bundleName, this.newGroup, (err) => {
## bundleState.registerGroupCallBack9+
-registerGroupCallBack(callback: Callback\): Promise\
+registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>): Promise<void>
-Registers a callback for application group changes. When an application group of the user changes, **BundleActiveGroupCallbackInfo** is returned to all applications that have registered the callback. This API uses a promise to return the result.
+Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses a promise to return the result.
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
@@ -689,26 +700,26 @@ Registers a callback for application group changes. When an application group of
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | --------------------------------------- | ---- | ----------- |
-| callback | Callback\ | Yes | Callback for application group changes.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | ------------------------------------------ |
+| callback | Callback<[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)> | Yes | Callback used to return the application group changes.|
**Return value**
| Type | Description |
| ------------- | ----------------------- |
-| Promise\ | Promise used to return the result.|
+| Promise<void> | Promise used to return the result.|
**Example**
```javascript
let onBundleGroupChanged = (err,res) =>{
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.');
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result oldGroup is : ' + res.oldGroup);
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result newGroup is : ' + res.newGroup);
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result changeReason is : ' + res.newGroup);
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result userId is : ' + res.userId);
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result bundleName is : ' + res.bundleName);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageOldGroup is : ' + res.appUsageOldGroup);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageNewGroup is : ' + res.appUsageNewGroup);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result changeReason is : ' + res.changeReason);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result userId is : ' + res.userId);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result bundleName is : ' + res.bundleName);
};
bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => {
console.log('BUNDLE_ACTIVE RegisterGroupCallBack promise succeeded.');
@@ -719,9 +730,9 @@ bundleState.registerGroupCallBack(onBundleGroupChanged).then( () => {
## bundleState.registerGroupCallBack9+
-registerGroupCallBack(callback: Callback\, callback: AsyncCallback\): void
+registerGroupCallBack(callback: Callback<BundleActiveGroupCallbackInfo>, callback: AsyncCallback<void>): void
-Registers a callback for application group changes. When an application group of the user changes, **BundleActiveGroupCallbackInfo** is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.
+Registers a callback for application group changes. When an application group of the user changes, a **[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)** instance is returned to all applications that have registered the callback. This API uses an asynchronous callback to return the result.
**Required permissions**: ohos.permission.BUNDLE_ACTIVE_INFO
@@ -731,21 +742,21 @@ Registers a callback for application group changes. When an application group of
**Parameters**
-| Name | Type | Mandatory | Description |
-| -------- | --------------------------------------- | ---- | ------------- |
-| callback | Callback\ | Yes | Callback for application group changes. |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+| Name | Type | Mandatory| Description |
+| -------- | ------------------------------------------------------------ | ---- | -------------------------------------------- |
+| callback | Callback<[BundleActiveGroupCallbackInfo](#bundleactivegroupcallbackinfo9)> | Yes | Callback used to return the application group changes. |
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
```javascript
let onBundleGroupChanged = (err,res) =>{
console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack callback success.');
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's oldGroup is : ' + res.oldGroup);
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's newGroup is : ' + res.newGroup);
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's changeReason is : ' + res.newGroup);
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's userId is : ' + res.userId);
- console.log('BUNDLE_ACTIVE onBundleGroupChanged RegisterGroupCallBack result's bundleName is : ' + res.bundleName);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageOldGroup is : ' + res.appUsageOldGroup);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result appUsageNewGroup is : ' + res.appUsageNewGroup);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result changeReason is : ' + res.changeReason);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result userId is : ' + res.userId);
+ console.log('BUNDLE_ACTIVE RegisterGroupCallBack result bundleName is : ' + res.bundleName);
};
bundleState.registerGroupCallBack(onBundleGroupChanged, (err)=>{
if(err) {
@@ -758,7 +769,7 @@ bundleState.registerGroupCallBack(onBundleGroupChanged, (err)=>{
## bundleState.unRegisterGroupCallBack9+
-unRegisterGroupCallBack(): Promise\
+unRegisterGroupCallBack(): Promise<void>
Deregisters the callback for application group changes. This API uses a promise to return the result.
@@ -774,7 +785,7 @@ Deregisters the callback for application group changes. This API uses a promise
| Type | Description |
| ------------- | ------------------------ |
-| Promise\ | Promise used to return the result.|
+| Promise<void> | Promise used to return the result.|
**Example**
@@ -788,7 +799,7 @@ bundleState.unRegisterGroupCallBack().then( () => {
## bundleState.unRegisterGroupCallBack9+
-unRegisterGroupCallBack(callback: AsyncCallback\): void;
+unRegisterGroupCallBack(callback: AsyncCallback<void>): void;
Deregisters the callback for application group changes. This API uses an asynchronous callback to return the result.
@@ -802,7 +813,7 @@ Deregisters the callback for application group changes. This API uses an asynchr
| Name | Type | Mandatory | Description |
| -------- | ------------------- | ---- | -------------- |
-| callback | AsyncCallback\ | Yes | Callback used to return the result.|
+| callback | AsyncCallback<void> | Yes | Callback used to return the result.|
**Example**
@@ -870,7 +881,7 @@ Queries statistics about system events (hibernation, wakeup, unlocking, and scre
| -------- | ---------------------------------------- | ---- | ---------------------------------------- |
| begin | number | Yes | Start time. |
| end | number | Yes | End time. |
-| callback | AsyncCallback<Array<[BundleActiveEventState](#bundleactiveeventstate9)>> | Yes | Promise used to return the result.|
+| callback | AsyncCallback<Array<[BundleActiveEventState](#bundleactiveeventstate9)>> | Yes | Callback used to return the result.|
**Example**
@@ -982,7 +993,7 @@ Provides the FA widget usage information.
| Name | Type | Mandatory | Description |
| ---------------- | ------ | ---- | ----------- |
-| formName | number | Yes | Widget name. |
+| formName | string | Yes | Widget name. |
| formDimension | number | Yes | Widget dimensions. |
| formId | number | Yes | Widget ID. |
| formLastUsedTime | number | Yes | Last time when the widget was clicked.|
@@ -992,15 +1003,15 @@ Provides the FA widget usage information.
Provides the application group changes returned through a callback.
-**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
+**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
-| Name | Type | Mandatory | Description |
-| ---------------- | ------ | ---- | -------- |
-| appUsageOldGroup | number | Yes | Application group before the change.|
-| appUsageNewGroup | number | Yes | Application group after the change.|
-| useId | number | Yes | User ID. |
-| changeReason | number | Yes | Reason for the group change. |
-| bundleName | string | Yes | Bundle name of an application. |
+| Name | Type | Mandatory| Description |
+| ---------------- | ------ | ---- | ---------------- |
+| appUsageOldGroup | number | Yes | Application group before the change.|
+| appUsageNewGroup | number | Yes | Application group after the change.|
+| userId | number | Yes | User ID. |
+| changeReason | number | Yes | Reason for the group change. |
+| bundleName | string | Yes | Bundle name of an application. |
## BundleStateInfo
@@ -1008,11 +1019,11 @@ Provides the usage duration information of applications.
### Attributes
-**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.AppGroup
+**System capability**: SystemCapability.ResourceSchedule.UsageStatistics.App
| Name | Type | Mandatory | Description |
| ------------------------ | ------ | ---- | ---------------------------------------- |
-| bundleName | string | Yes | Bundle name of the application. |
+| bundleName | string | Yes | Bundle name of an application. |
| abilityPrevAccessTime | number | Yes | Last time when the application was used. |
| abilityInFgTotalTime | number | Yes | Total time that the application runs in the foreground. |
| id | number | No | User ID.