diff --git a/docker/CHANGELOG.md b/docker/CHANGELOG.md
old mode 100644
new mode 100755
index c293b830db2a72958e65485bffa18a06396cca15..ab06f14091985eed7a30233c18eb2df2cecaa03c
--- a/docker/CHANGELOG.md
+++ b/docker/CHANGELOG.md
@@ -1,3 +1,9 @@
+### 1.0.0 (2022/03/09)
+
+合并轻设备和富设备系统docker编译环境。
+
+
+
### 0.0.7 (2022/02/16)
增加安装doxygen工具。
diff --git a/docker/CHANGELOG_en.md b/docker/CHANGELOG_en.md
old mode 100644
new mode 100755
index 1dac4c8e523bf0c6adf63e1c93d289e5a158254e..94189f8d74234167006312d822bad65006ee40a9
--- a/docker/CHANGELOG_en.md
+++ b/docker/CHANGELOG_en.md
@@ -1,10 +1,16 @@
+### 1.0.0 (2022/03/09)
+
+Combine the docker build environment of Mini-System Devices (reference memory ≥ 128 KB), Small-System Devices (reference memory ≥ 1 MB) and Standard-System Devices (reference memory ≥ 128 MB).
+
+
+
### 0.0.7 (2022/02/16)
Added the installation of doxygen.
-### 0.0.6(2022/02/10)
+### 0.0.6 (2022/02/10)
1\. Updated hb.
diff --git a/docker/Dockerfile b/docker/Dockerfile
index 9e5371eae3bdb34a3cc2e0238bf7e47f65c36e55..70560a93c1dd890bf8b6ff1d9f03d2e778adbfe0 100755
--- a/docker/Dockerfile
+++ b/docker/Dockerfile
@@ -12,80 +12,71 @@
# limitations under the License.
-FROM ubuntu:20.04
-MAINTAINER dongjinguang@huawei.com
+FROM ubuntu:18.04
WORKDIR /home/openharmony
-RUN apt-get update -y \
- && apt-get install curl wget -y \
- && apt-get install vim -y \
- && apt-get install ssh -y \
- && apt-get install git -y \
- && apt-get install python3.8 -y \
- && apt-get install python3-pip -y \
- && apt-get install dosfstools -y \
- && apt-get install mtools -y \
- && apt-get install scons -y \
- && apt-get install make -y \
- && apt-get install libffi-dev -y \
- && apt-get install zip -y \
- && apt-get install python3-distutils -y \
- && apt-get install binutils -y \
- && apt-get install mtd-utils -y \
- && apt-get install libc6-dev-x32 -y \
- && DEBIAN_FRONTEND="noninteractive" TZ="America/New_York" apt-get -y install tzdata \
- && apt-get install default-jre -y \
- && apt-get install default-jdk -y \
- && apt-get install bison -y \
- && apt-get install flex -y \
- && apt-get install bc -y \
- && apt-get install doxygen -y \
- && apt-get install u-boot-tools -y \
- && apt-get install gcc-arm-linux-gnueabi -y \
- && apt-get install build-essential \
- && apt-get install locales \
- && apt-get install ruby -y \
+RUN sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list \
+ && sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list \
+ && apt-get update -y \
+ && apt-get install -y apt-utils binutils bison flex bc build-essential make mtd-utils gcc-arm-linux-gnueabi u-boot-tools python3.8 python3-pip git zip unzip curl wget gcc g++ ruby=1:2.5.1 dosfstools mtools default-jre default-jdk scons python3.8-distutils perl openssl libssl-dev cpio git-lfs m4 ccache zlib1g-dev tar rsync liblz4-tool genext2fs binutils-dev device-tree-compiler e2fsprogs git-core gnupg gnutls-bin gperf lib32ncurses5-dev libffi-dev zlib* libelf-dev libx11-dev libgl1-mesa-dev lib32z1-dev xsltproc x11proto-core-dev libc6-dev-i386 libxml2-dev lib32z-dev libdwarf-dev \
+ && apt-get install -y grsync xxd libglib2.0-dev libpixman-1-dev kmod jfsutils reiserfsprogs xfsprogs squashfs-tools pcmciautils quota ppp libtinfo-dev libtinfo5 libncurses5 libncurses5-dev libncursesw5 libstdc++6 python2.7 gcc-arm-none-eabi \
+ && apt-get install -y vim ssh locales \
+ && apt-get install -y doxygen \
&& locale-gen "en_US.UTF-8" \
- && rm -rf /bin/sh /usr/bin/python /usr/bin/python3 \
+ && rm -rf /bin/sh /usr/bin/python /usr/bin/python3 /usr/bin/python3m \
&& ln -s /bin/bash /bin/sh \
&& ln -s /usr/bin/python3.8 /usr/bin/python3 \
+ && ln -s /usr/bin/python3.8 /usr/bin/python3m \
&& ln -s /usr/bin/python3.8 /usr/bin/python \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple setuptools \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple kconfiglib \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple pycryptodome \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple ecdsa \
- && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple ohos-build \
+ && curl https://gitee.com/oschina/repo/raw/fork_flow/repo-py3 > /usr/bin/repo \
+ && chmod +x /usr/bin/repo \
+ && pip3 install --trusted-host https://repo.huaweicloud.com -i https://repo.huaweicloud.com/repository/pypi/simple requests setuptools pymongo kconfiglib pycryptodome ecdsa ohos-build pyyaml prompt_toolkit==1.0.14 redis json2html yagmail python-jenkins \
+ && pip3 install esdk-obs-python --trusted-host pypi.org \
+ && pip3 install six --upgrade --ignore-installed six \
&& mkdir -p /home/tools \
+ && mkdir -p /home/tools/gn \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/clang/10.0.1-62608/linux/llvm.tar.gz \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/hc-gen/0.65/linux/hc-gen-0.65-linux.tar \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/gcc_riscv32/7.3.0/linux/gcc_riscv32-linux-7.3.0.tar.gz \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/ninja/1.9.0/linux/ninja.1.9.0.tar \
&& wget -P /home/tools https://repo.huaweicloud.com/harmonyos/compiler/gn/1717/linux/gn-linux-x86-1717.tar.gz \
- && wget -P /home/tools https://mirrors.huaweicloud.com/nodejs/v12.20.0/node-v12.20.0-linux-x64.tar.gz \
- && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/develop_tools/hmos_app_packing_tool.jar \
- && wget -P /home/tools https://repo.huaweicloud.com/harmonyos/develop_tools/hapsigntoolv2.jar \
- && tar xvf /home/tools/llvm.tar.gz -C /home/tools \
- && tar xvf /home/tools/hc-gen-0.65-linux.tar -C /home/tools \
- && tar xvf /home/tools/gcc_riscv32-linux-7.3.0.tar.gz -C /home/tools \
- && tar xvf /home/tools/ninja.1.9.0.tar -C /home/tools \
- && tar xvf /home/tools/gn-linux-x86-1717.tar.gz -C /home/tools \
- && tar xvf /home/tools/node-v12.20.0-linux-x64.tar.gz -C /home/tools \
+ && wget -P /home/tools https://mirrors.huaweicloud.com/nodejs/v14.15.4/node-v14.15.4-linux-x64.tar.xz \
+ && wget -P /home/tools https://hm-verify.obs.cn-north-4.myhuaweicloud.com/qemu-5.2.0.tar.xz \
+ && tar -xvf /home/tools/llvm.tar.gz -C /home/tools \
+ && tar -xvf /home/tools/hc-gen-0.65-linux.tar -C /home/tools \
+ && tar -xvf /home/tools/gcc_riscv32-linux-7.3.0.tar.gz -C /home/tools \
+ && tar -xvf /home/tools/ninja.1.9.0.tar -C /home/tools \
+ && tar -xvf /home/tools/gn-linux-x86-1717.tar.gz -C /home/tools/gn \
+ && tar -xJf /home/tools/node-v14.15.4-linux-x64.tar.xz -C /home/tools \
+ && cp /home/tools/node-v14.15.4-linux-x64/bin/node /usr/local/bin \
+ && ln -s /home/tools/node-v14.15.4-linux-x64/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm \
+ && ln -s /home/tools/node-v14.15.4-linux-x64/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx \
+ && tar -xJf /home/tools/qemu-5.2.0.tar.xz -C /home/tools \
&& sed -i '$aexport PATH=/home/tools/llvm/bin:$PATH' /root/.bashrc \
&& sed -i '$aexport PATH=/home/tools/hc-gen:$PATH' /root/.bashrc \
&& sed -i '$aexport PATH=/home/tools/gcc_riscv32/bin:$PATH' /root/.bashrc \
&& sed -i '$aexport PATH=/home/tools/ninja:$PATH' /root/.bashrc \
- && sed -i '$aexport PATH=/home/tools/node-v12.20.0-linux-x64/bin:$PATH' /root/.bashrc \
- && sed -i '$aexport PATH=/home/tools:$PATH' /root/.bashrc \
+ && sed -i '$aexport PATH=/home/tools/node-v14.15.4-linux-x64/bin:$PATH' /root/.bashrc \
+ && sed -i '$aexport PATH=/home/tools/gn:$PATH' /root/.bashrc \
&& sed -i '$aexport PATH=/root/.local/bin:$PATH' /root/.bashrc \
&& export PATH=/home/tools/llvm/bin:$PATH \
&& export PATH=/home/tools/hc-gen:$PATH \
&& export PATH=/home/tools/gcc_riscv32/bin:$PATH \
&& export PATH=/home/tools/ninja:$PATH \
&& export PATH=/home/tools/node-v12.20.0-linux-x64/bin:$PATH \
- && export PATH=/home/tools:$PATH \
+ && export PATH=/home/tools/gn:$PATH \
&& export PATH=/root/.local/bin:$PATH \
+ && cd /home/tools/qemu-5.2.0 \
+ && mkdir build \
+ && cd build \
+ && ../configure --target-list=arm-softmmu \
+ && make -j \
+ && make install \
+ && cd /home/openharmony \
&& rm -rf /home/tools/*.tar \
&& rm -rf /home/tools/*.gz \
+ && rm -rf /home/tools/*.xz \
+ && rm -rf /home/tools/qemu-5.2.0 \
&& npm install -g @ohos/hpm-cli --registry https://mirrors.huaweicloud.com/repository/npm/
ENV LANG=en_US.UTF-8 LANGUAGE=en_US.UTF-8 LC_ALL=en_US.UTF-8
diff --git a/docker/README.md b/docker/README.md
index 6f536192dcc4a7ea2254aab53b7ea6049ce558dd..d38a6f295c20e79da128ae47d1debdc48b4004e7 100755
--- a/docker/README.md
+++ b/docker/README.md
@@ -2,30 +2,29 @@
### Docker镜像简介
-本文为小型和轻量系统类设备Docker使用指导,[点此查看](https://gitee.com/openharmony/docs/blob/master/docker/standard/Readme.md)标准系统类设备使用指导。
+本文为OpenHarmony的Docker编译环境使用指导。
OpenHarmony的Docker镜像托管在**HuaweiCloud SWR**上,开发者可以通过该镜像在很大程度上简化编译前的环境配置。 目前容器化构建选项支持情况如下:
-| Docker镜像仓库 | 标签 | 说明 |
-| :----------------------------------------------------------- | :------ | :----------------------------------------------------------- |
-| `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `0.0.7` | 已经预安装OpenHarmony版本的编译环境,支持轻量系统类设备(参考内存≥128KB)和小型系统类设备(参考内存≥1MB)的版本构建。 |
+| Docker镜像仓库 | 标签 | 说明 |
+| :----------------------------------------------------------- | :------ | :------------------------------------ |
+| `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `1.0.0` | 已经预安装OpenHarmony版本的编译环境。 |
### 使用方式及步骤
- 开发者在配置好开发环境后,可以通过以下步骤来使用我们提供的Docker环境。详情请参见[Docker编译环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/gettools-acquire.md)。
+ 开发者在下载好源码后,可以通过以下步骤来使用我们提供的Docker环境。详情请参见[Docker编译环境](https://gitee.com/openharmony/docs/blob/master/zh-cn/device-dev/get-code/gettools-acquire.md)。
1. 获取Docker镜像
```
- docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.7
+ docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
2. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境
```
- docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.7
+ docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
3. 通过如下命令启动不同平台的编译
```
- hb set #设置工作目录。
- . #输入源码所在目录,点(.)表示当前目录。
- 在显示的页面中通过键盘上下键选择需要编译的平台,通过回车确定选择。
+ hb set #在显示的页面中通过键盘上下键选择需要编译的平台,通过回车确定选择。
hb build -f #执行编译。
```
+
diff --git a/docker/README_en.md b/docker/README_en.md
old mode 100644
new mode 100755
index c41dab5a571836e7fc860fc60cef2423daa165f0..9853079a565ee82d2a752ec134b6c29acc7ab43b
--- a/docker/README_en.md
+++ b/docker/README_en.md
@@ -2,30 +2,28 @@
### Docker Image
-This document provides guidance on building the Docker image for mini- and small-system devices. For details about how to build the Docker image for standard-system devices, see [OpenHarmony Docker Image](https://gitee.com/openharmony/docs/blob/master/docker/standard/Readme-en.md)
+This document provides guidance on building the Docker image for mini- and small-system devices.
The Docker image of OpenHarmony is hosted on [HUAWEI Cloud SWR](https://auth.huaweicloud.com/authui/login.html?service=https%3A%2F%2Fconsole.huaweicloud.com%2Fswr%2F%3Fregion%3Dcn-south-1%26cloud_route_state%3D%2Fapp%2Fwarehouse%2FwarehouseMangeDetail%2Fgoldensir%2Fopenharmony-docker%2Fopenharmony-docker%3Ftype%3DownImage&locale=en-us#/login). Using the Docker image will help simplify environment configurations needed for the building. The following table lists container-based options needed for building in the standalone Docker environment.
-| Docker Image Repository | Tag | Description |
-| :----------------------------------------------------------- | :------ | :----------------------------------------------------------- |
-| `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `0.0.7` | The OpenHarmony build environment has been pre-installed. This repository applies to Mini-System Devices (reference memory ≥ 128 KB) and Small-System Devices (reference memory ≥ 1 MB). |
+| Docker Image Repository | Tag | Description |
+| :----------------------------------------------------------- | :------ | :-------------------------------------------------------- |
+| `swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker` | `1.0.0` | The OpenHarmony build environment has been pre-installed. |
### Usage
- After configuring the development environments, perform the steps below to access the Docker environment.
+ After downloading the OpenHarmony code, perform the steps below to access the Docker environment.
1. Obtain the Docker image.
```
- docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.7
+ docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
2. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
```
- docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:0.0.7
+ docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker:1.0.0
```
3. Run the following script to start building for different platforms.
```
- hb set # Set the working directory.
- . # Enter the directory where the source code is stored. If the code is stored in the current directory, enter a period (.).
- Press the Up or Down key to select the platform to build on, then press Enter.
+ hb set # Press the Up or Down key to select the platform to build on, then press Enter.
hb build -f # Start building.
```
diff --git a/docker/build.sh b/docker/build.sh
index 0c8b1fc8b366bf308a245a0e0d2de01be4986ba9..e1a7618251929cd060b0e33c4763e4bb5e5f9057 100755
--- a/docker/build.sh
+++ b/docker/build.sh
@@ -13,4 +13,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.
-docker build -t openharmony-docker:0.0.7 .
+docker build -t openharmony-docker:1.0.0 .
diff --git a/docker/standard/CHANGELOG.md b/docker/standard/CHANGELOG.md
deleted file mode 100644
index c37b6bc9eefa502a81f7a28c37063a16ca665504..0000000000000000000000000000000000000000
--- a/docker/standard/CHANGELOG.md
+++ /dev/null
@@ -1,36 +0,0 @@
- ### 0.0.8(2022/01/16)
-
-新增安装doxygen。
-
- ### 0.0.7(2022/01/11)
-
-新增安装genext2fs和liblz4-tool。
-
- ### 0.0.6(2022/01/04)
-
-新增安装hb。
-
- ### 0.0.5(2021/10/28)
-
-新增安装tar、binutils、git-lfs、gnutls-bin、python3.8、python3-pip、cpio。
-
- ### 0.0.4(2021/09/18)
-
-1、删除编译依赖的工具预装。
-
-2、增加安装ruby。
-
- ### 0.0.3(2021/08/30)
-
-1、更新llvm版本从10.0.1-62608更新到10.0.1-69957。
-
-2、增加安装gcc_aarch64。
-
- ### 0.0.2(2021/08/11)
-
-新增安装llvm-10.0.1-62608和restool工具。
-
- ### 0.0.1(2021/06/02)
-
-提供OpenHarmony 2.0版本docker编译环境,预装编译依赖工具。
-
diff --git a/docker/standard/CHANGELOG_en.md b/docker/standard/CHANGELOG_en.md
deleted file mode 100644
index ce1cceda1cc1fab4f061a0b3dd3db106a88ad27c..0000000000000000000000000000000000000000
--- a/docker/standard/CHANGELOG_en.md
+++ /dev/null
@@ -1,35 +0,0 @@
- ### 0.0.8 (2022/01/16)
-
-Added the installation of doxygen.
-
- ### 0.0.7 (2022/01/11)
-
-Added the installation of genext2fs and liblz4-tool.
-
- ### 0.0.6 (2022/01/04)
-
-Added the installation of hb.
-
- ### 0.0.5 (2021/10/28)
-
-Added the installation of tar, binutils, git-lfs, gnutls-bin, python3.8, python3-pip, and cpio.
-
- ### 0.0.4 (2021/09/18)
-
-1\. Removed pre-installed build dependency tools.
-
-2\. Added the Ruby installation.
-
- ### 0.0.3 (2021/08/30)
-
-1\. Updated LLVM from 10.0.1-62608 to 10.0.1-69957.
-
-2\. Added the installation of gcc_aarch64.
-
- ### 0.0.2 (2021/08/11)
-
-Added the installation of llvm-10.0.1-62608 and restool.
-
- ### 0.0.1 (2021/06/02)
-
-Provided a Docker build environment for OpenHarmony 2.0 and pre-installed build dependency tools.
\ No newline at end of file
diff --git a/docker/standard/Readme-en.md b/docker/standard/Readme-en.md
deleted file mode 100755
index cdfc3cc4a00bccf3d43cfbd20716d7b7979f3258..0000000000000000000000000000000000000000
--- a/docker/standard/Readme-en.md
+++ /dev/null
@@ -1,31 +0,0 @@
-## Standalone Docker Environment
-
-This document provides guidance on building the Docker image for standard-system devices. For details about how to build the Docker image for mini- and small-system devices, see [OpenHarmony Docker Image](https://gitee.com/openharmony/docs/blob/master/docker/README_en.md)
-
-The Docker image of OpenHarmony is hosted on [HUAWEI Cloud SWR](https://auth.huaweicloud.com/authui/login.html?service=https%3A%2F%2Fconsole.huaweicloud.com%2Fswr%2F%3Fregion%3Dcn-south-1%26cloud_route_state%3D%2Fapp%2Fwarehouse%2FwarehouseMangeDetail%2Fgoldensir%2Fopenharmony-docker%2Fopenharmony-docker%3Ftype%3DownImage&locale=en-us#/login). Using the Docker image will help simplify environment configurations needed for the building. After configuring the development environments, perform the steps below to access the Docker environment. The following steps use Ubuntu as an example (Windows is also supported).
-
-### Setting Up the Docker Environment for Standard-System Devices (reference memory ≥ 128 MB)
-
-1. Obtain the Docker image.
-```
-docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.8
-```
-2. Go to the root directory of OpenHarmony code and run the following command to access the Docker build environment:
-```
-docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.8
-```
-
-### Building for Standard-System Devices (reference memory ≥ 128 MB)
-Run the following script to start building for Standard-System Devices (reference memory ≥ 128 MB)
-
-```
-./build.sh --product-name {product_name} --ccache
-```
-**{product_name}** indicates the platform supported by the current distribution, for example, Hi3516DV300, rk3568.
-Files generated during compilation are stored in the **out/{device_name}/** directory, and the generated image is stored in the **out/{device_name}/packages/phone/images/** directory.
-
-
-
-**Note**
-
-You can exit Docker by simply running the **exit** command.
\ No newline at end of file
diff --git a/docker/standard/Readme.md b/docker/standard/Readme.md
deleted file mode 100755
index 5997c8b0ade534df555b6c10dda852c26470c1fe..0000000000000000000000000000000000000000
--- a/docker/standard/Readme.md
+++ /dev/null
@@ -1,31 +0,0 @@
-## 独立Docker环境
-
-本文为标准系统类设备Docker使用指导,[点此查看](https://gitee.com/openharmony/docs/blob/master/docker/README.md)小型和轻量系统类设备使用指导。
-
-OpenHarmony的Docker镜像托管在HuaweiCloud SWR上。开发者可以通过该镜像在很大程度上简化编译前的环境配置。开发者在配置好开发环境后,通过以下步骤来使用Docker环境。
-
-### 搭建Docker环境-标准系统类设备(参考内存≥128MB)
-
-1. 获取Docker镜像。
-```
-docker pull swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.8
-```
-2. 进入OpenHarmony代码根目录执行如下命令,从而进入Docker构建环境。
-```
-docker run -it -v $(pwd):/home/openharmony swr.cn-south-1.myhuaweicloud.com/openharmony-docker/openharmony-docker-standard:0.0.8
-```
-
-### 编译源码-标准系统类设备(参考内存≥128MB)
-通过如下编译脚本启动标准系统类设备(参考内存≥128MB)的编译。
-
-```
-./build.sh --product-name {product_name} --ccache
-```
-{product_name}为当前版本支持的平台。比如:Hi3516DV300、rk3568等。
-编译所生成的文件都归档在out/{device_name}/目录下,结果镜像输出在 out/{device_name}/packages/phone/images/ 目录下。
-
-
-
-**说明**
-
- 退出Docker执行exit命令即可。
\ No newline at end of file
diff --git a/docker/standard/build.sh b/docker/standard/build.sh
deleted file mode 100755
index d51927c8ef85f25177137361ea5e22fa0c3da081..0000000000000000000000000000000000000000
--- a/docker/standard/build.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash
-
-# Copyright (c) 2020 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-docker build -t openharmony-docker-standard:0.0.8 .
diff --git a/docker/standard/dockerfile b/docker/standard/dockerfile
deleted file mode 100755
index 5451542fc8a01443781d940093001760ad4bfc5b..0000000000000000000000000000000000000000
--- a/docker/standard/dockerfile
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright (c) 2020 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-FROM ubuntu:18.04
-WORKDIR /home/openharmony
-
-ARG DEBIAN_FRONTEND=noninteractive
-ARG PREBUILTS_DIR=/home/prebuilts
-ARG HOME_TOOLS=/home/tools
-
-RUN mv /etc/apt/sources.list /etc/apt/sources.list.bak
-
-COPY sources.list /etc/apt
-
-RUN apt-get update \
- && apt-get install -y \
- apt-utils \
- vim \
- tar \
- binutils \
- software-properties-common \
- openssh-server \
- iputils-ping \
- curl \
- net-tools \
- bsdmainutils \
- kmod \
- bc \
- rsync \
- gawk \
- ssh \
- ccache \
- zip \
- python-dev \
- make \
- m4 \
- gcc-multilib \
- ca-certificates-java \
- unzip \
- python3-yaml \
- perl \
- openssl \
- libssl1.1 \
- gnupg \
- xsltproc \
- x11proto-core-dev \
- tcl \
- python3-crypto \
- python-yaml \
- python-crypto \
- libxml2-utils \
- libxml2-dev \
- libx11-dev \
- libssl-dev \
- libgl1-mesa-dev \
- lib32z1-dev \
- lib32ncurses5-dev \
- g++-multilib \
- flex \
- bison \
- doxygen \
- git \
- git-lfs \
- subversion \
- tofrodos \
- pigz \
- expect \
- python3-xlrd \
- python-xlrd \
- wget \
- git-core \
- gperf \
- build-essential \
- zlib1g-dev \
- libc6-dev-i386 \
- lib32z-dev \
- openjdk-8-jdk \
- ruby \
- gnutls-bin \
- python3.8 \
- python3-pip \
- cpio \
- genext2fs \
- doxygen \
- liblz4-tool \
- && rm -rf /bin/sh /usr/bin/python /usr/bin/python3 \
- && ln -s /bin/bash /bin/sh \
- && ln -s /usr/bin/python3.8 /usr/bin/python3 \
- && ln -s /usr/bin/python3.8 /usr/bin/python \
- && python3 -m pip install --user ohos-build \
- && mkdir -p $PREBUILTS_DIR/prebuilts $HOME_TOOLS
-
-RUN wget -P $HOME_TOOLS https://mirrors.huaweicloud.com/nodejs/v12.18.4/node-v12.18.4-linux-x64.tar.gz \
- && wget -P $HOME_TOOLS https://mirrors.huaweicloud.com/nodejs/v12.18.4/node-v12.18.4-darwin-x64.tar.gz \
- && tar xvf $HOME_TOOLS/node-v12.18.4-linux-x64.tar.gz -C $PREBUILTS_DIR/prebuilts \
- && tar xvf $HOME_TOOLS/node-v12.18.4-darwin-x64.tar.gz -C $PREBUILTS_DIR/prebuilts \
- && sed -i '$aexport PATH='"$PREBUILTS_DIR"'/prebuilts/node-v12.18.4-linux-x64/bin:$PATH' /root/.bashrc \
- && sed -i '$aexport PATH='"$PREBUILTS_DIR"'/prebuilts/hc-gen:$PATH' /root/.bashrc \
- && export PATH=$PATH:$PREBUILTS_DIR/prebuilts/node-v12.18.4-linux-x64/bin \
- && export PATH=$PATH:$PREBUILTS_DIR/prebuilts/hc-gen \
- && rm -rf $HOME_TOOLS \
- && npm install -g @ohos/hpm-cli --registry https://registry.npm.taobao.org
diff --git a/docker/standard/sources.list b/docker/standard/sources.list
deleted file mode 100755
index 78030974c6f1729f8d290a59aa3c83f30cc4c472..0000000000000000000000000000000000000000
--- a/docker/standard/sources.list
+++ /dev/null
@@ -1,24 +0,0 @@
-# Copyright (c) 2020 Huawei Device Co., Ltd.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic main multiverse restricted universe
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main multiverse restricted universe
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main multiverse restricted universe
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main multiverse restricted universe
-deb http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-security main multiverse restricted universe
-deb-src http://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main multiverse restricted universe
\ No newline at end of file
diff --git a/en/application-dev/Readme-EN.md b/en/application-dev/Readme-EN.md
index 206b69d6dc613a4e9434bbbf161f2d33c99c1b1c..dd682c80aab3d6eb42c86251fab551a3e0991e10 100644
--- a/en/application-dev/Readme-EN.md
+++ b/en/application-dev/Readme-EN.md
@@ -3,7 +3,6 @@
- [Application Development Overview](application-dev-guide.md)
- [DevEco Studio \(OpenHarmony\) User Guide](quick-start/deveco-studio-user-guide-for-openharmony.md)
- [Directory Structure](quick-start/package-structure.md)
-- [Getting Started](quick-start/start.md)
- [ArkUI](ui/ui-arkui.md)
- [JavaScript-based Web-like Development Paradigm](ui/ui-arkui-js.md)
diff --git a/en/application-dev/media/audio-overview.md b/en/application-dev/media/audio-overview.md
index 5aac5895bc5d0fc7db7ae0351095b1acf265f8e0..c313e9315eb46c440efb116e318148a666d44012 100755
--- a/en/application-dev/media/audio-overview.md
+++ b/en/application-dev/media/audio-overview.md
@@ -1,8 +1,8 @@
# Audio Overview
-OpenHarmony provides the audio module for your application to implement audio-related features, including audio playback and volume management.
+You can use APIs provided by the audio module to implement audio-related features, including audio playback and volume management.
-> **NOTE:**
+> **NOTE**
>Due to permission issues, the above features are temporarily unavailable for the standard system.
## Basic Concepts
diff --git a/en/application-dev/quick-start/Readme-EN.md b/en/application-dev/quick-start/Readme-EN.md
index ae9b9c0c16f12b582364364cac781208f5e1494f..cb35fe17513b8b7111db96b57c7fa00605121b1f 100644
--- a/en/application-dev/quick-start/Readme-EN.md
+++ b/en/application-dev/quick-start/Readme-EN.md
@@ -11,7 +11,4 @@
- [Configuring the OpenHarmony App Signature](configuring-openharmony-app-signature.md)
- [Installing and Running Your OpenHarmony App](installing-openharmony-app.md)
- [Directory Structure](package-structure.md)
-- [Getting Started](start.md)
- - [Preparations](start-overview.md)
- - [Getting Started with JavaScript](start-with-js.md)
diff --git a/en/application-dev/quick-start/figures/en-us_image_0000001167850660.png b/en/application-dev/quick-start/figures/en-us_image_0000001167850660.png
deleted file mode 100644
index 469ca774dde99530329d5e7bd62a5a40fb16237b..0000000000000000000000000000000000000000
Binary files a/en/application-dev/quick-start/figures/en-us_image_0000001167850660.png and /dev/null differ
diff --git a/en/application-dev/quick-start/start-overview.md b/en/application-dev/quick-start/start-overview.md
deleted file mode 100644
index 90ba0afd82988bde9af320446b52a29c52cddfd0..0000000000000000000000000000000000000000
--- a/en/application-dev/quick-start/start-overview.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# Preparations
-
-## Task Description
-
-This document is intended for novices at developing apps. You will learn the development procedure from the following sections to build two pages and implement redirection from the first page to the second one. The following figure shows how the pages look on the [Previewer](https://developer.harmonyos.com/en/docs/documentation/doc-guides/previewer-0000001054328973#ZH-CN_TOPIC_0000001056725592__section16523172216252).
-
-For best results, use the [latest version of DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio#download) for your development.
-
-
-
-**Table 1** Comparison between ArkUI paradigms
-
-
-
Comparison Item
-
-
JavaScript-based Web-like Development Paradigm
-
-
TypeScript-based Declarative Development Paradigm
-
-
-
-
Language
-
-
JS
-
-
eTS
-
-
-
Paradigm
-
-
Web-like paradigm
-
-
Declarative paradigm
-
-
-
Execution
-
-
Handled by the framework; data-driven automatic UI update
-
-
Handled by the framework; data-driven automatic UI update
-
-
-
Advantages
-
-
Simple and easy to use
-
-
Simplified development, less memory usage, and higher running performance
-
-
-
-
-
-## Before You Start
-
-1. Install DevEco Studio and configure the development environment. For details, see [Configuring the OpenHarmony SDK](configuring-openharmony-sdk.md).
-2. Create a project as instructed in [Creating an OpenHarmony Project](create-openharmony-project.md).
- - If you are using the JavaScript language, select **Empty Ability** for **Template** and **JS** for **Language**.
-
-3. Use the [previewer](https://developer.harmonyos.com/en/docs/documentation/doc-guides/previewer-0000001054328973#EN-US_TOPIC_0000001056725592__section16523172216252) or [emulator](https://developer.harmonyos.com/en/docs/documentation/doc-guides/run_simulator-0000001053303709) to run the project.
-
-Now you have created your first OpenHarmony project. You can continue the development by following instructions in [Getting Started with JavaScript](start-with-js.md).
-
diff --git a/en/application-dev/quick-start/start-with-js.md b/en/application-dev/quick-start/start-with-js.md
deleted file mode 100644
index bee0ea9153406836a01c380e4b3b23adb0c45489..0000000000000000000000000000000000000000
--- a/en/application-dev/quick-start/start-with-js.md
+++ /dev/null
@@ -1,114 +0,0 @@
-# Getting Started with JavaScript
-
-For best results, use the [latest version of DevEco Studio](https://developer.harmonyos.com/en/develop/deveco-studio#download) for your development.
-
-## Building the First Page
-
-1. Add a **Text** and a **Button** component to the first page.
-
- In the **Project** window, choose **entry** \> **src** \> **main** \> **js** \> **default** \> **pages** \> **index**, open the **index.hml** file, and add the components.
-
- ```
-
-
-
-
- Hello World
-
-
-
-
- ```
-
-2. Open the **index.css** file and set text and button styles.
-
- ```
- /* index.css */
- .container {
- flex-direction: column; /* Arrange container items vertically. */
- justify-content: center; /* Center the items along the main axis of the container. */
- align-items: center; /* Center the items along the cross axis of the container. */
- width:100%;
- height:100%;
- }
- /* Set the style for the component of the text class. */
- .text{
- font-size: 42px;
- }
- /* Set the style for the component of the button class. */
- .button {
- width: 240px;
- height: 60px;
- background-color: #007dff;
- font-size: 30px;
- text-color: white;
- margin-top: 20px;
- }
- ```
-
-3. [Preview](https://developer.harmonyos.com/en/docs/documentation/doc-guides/previewer-0000001054328973#EN-US_TOPIC_0000001056725592__section16523172216252) or [run your app on the emulator](https://developer.harmonyos.com/en/docs/documentation/doc-guides/run_simulator-0000001053303709). The following figure shows the running effect.
-
- 
-
-
-## Creating the Second Page
-
-1. In the **Project** window, choose **entry** \> **src** \> **main** \> **js** \> **default**, right-click the **pages** folder, and then choose **New** \> **JS Page**. Name the new page **details** and press **Enter**.
-
- Below is the structure of the **pages** folder:
-
- 
-
-2. Open the **details.hml** file, add the **** component, and set its layout.
-
- ```
-
-
-
- Hi there
-
-
- ```
-
-3. Open the **details.css** file and set the text style.
-
- ```
- /* details.css */
- .container {
- flex-direction: column;
- justify-content: center;
- align-items: center;
- width:100%;
- height:100%;
- }
- .text {
- font-size: 42px;
- text-align: center;
- }
- ```
-
-
-## Implementing Page Redirection
-
-1. Open the **index.js** file and import the router module. The page router finds the target page based on its URI for the redirection. The sample code is as follows:
-
- ```
- // index.js
- import router from '@system.router';
-
- export default {
- launch() {
- router.push ({
- uri:'pages/details/details', // Specify the page to be redirected to.
- })
- }
- }
- ```
-
-2. [Preview](https://developer.harmonyos.com/en/docs/documentation/doc-guides/previewer-0000001054328973#EN-US_TOPIC_0000001056725592__section16523172216252) or [run your app on the emulator](https://developer.harmonyos.com/en/docs/documentation/doc-guides/run_simulator-0000001053303709) again. The following figure shows the running effect.
-
- 
-
-
-Congratulations! You have finished developing your app in JavaScript.
-
diff --git a/en/application-dev/quick-start/start.md b/en/application-dev/quick-start/start.md
deleted file mode 100644
index 1e4c7a3ff554ac98af6844a00a2275924a3b5305..0000000000000000000000000000000000000000
--- a/en/application-dev/quick-start/start.md
+++ /dev/null
@@ -1,7 +0,0 @@
-# Getting Started
-
-- **[Preparations](start-overview.md)**
-
-- **[Getting Started with JavaScript](start-with-js.md)**
-
-
diff --git a/en/application-dev/reference/apis/Readme-EN.md b/en/application-dev/reference/apis/Readme-EN.md
index d350833093abdc9acfbab6e5bc199c221fc14c97..e762c752f19da81ceba1c65270150c2348a4a644 100644
--- a/en/application-dev/reference/apis/Readme-EN.md
+++ b/en/application-dev/reference/apis/Readme-EN.md
@@ -5,40 +5,50 @@
- [ParticleAbility Module](js-apis-particleAbility.md)
- [DataAbilityHelper Module](js-apis-dataAbilityHelper.md)
- [DataUriUtils Module](js-apis-DataUriUtils.md)
+ - [Bundle Module](js-apis-Bundle.md)
- [Context Module](js-apis-Context.md)
- Event Notification
- [CommonEvent Module](js-apis-commonEvent.md)
- [Notification Module](js-apis-notification.md)
- [Reminder Agent](js-apis-reminderAgent.md)
-- Resource Management
+- Resource Management
- [Resource Manager](js-apis-resource-manager.md)
- [Internationalization \(intl\) ](js-apis-intl.md)
- [Internationalization \(i18n\) ](js-apis-i18n.md)
-- Media
+- Media
- [Audio Management](js-apis-audio.md)
- [Media](js-apis-media.md)
-- Security
+- Security
- [User Authentication](js-apis-useriam-userauth.md)
- - [Access Control](js-apis-abilityAccessCtrl.md)
-- Data Management
- - [File Management](js-apis-fileio.md)
- - [Lightweight Storage](js-apis-data-storage.md)
+ - [Access Control](js-apis-abilityAccessCtrl.md)
+- Data Management
+ - [Lightweight Storage (deprecated since 8)](js-apis-data-storage.md)
- [Distributed Data Management](js-apis-distributed-data.md)
- [Relational Database](js-apis-data-rdb.md)
- [Result Set](js-apis-data-resultset.md)
- [DataAbilityPredicates](js-apis-data-ability.md)
+ - [Settings](js-apis-settings.md)
+- File Management
+ - [File Management](js-apis-fileio.md)
+ - [Statfs](js-apis-statfs.md)
+ - [Environment](js-apis-environment.md)
+ - [Public File Access and Management](js-apis-filemanager.md)
+ - [App Storage Statistics](js-apis-storage-statistics.md)
+ - [Volume Management](js-apis-volumemanager.md)
- Account Management
- [Distributed Account Management](js-apis-distributed-account.md)
+ - [App Account Management](js-apis-appAccount.md)
- Telephony Service
- [Call](js-apis-call.md)
- [SMS](js-apis-sms.md)
- [SIM Management](js-apis-sim.md)
- [Radio](js-apis-radio.md)
-- Network and Connectivity
+- Network and Connectivity
- [WLAN](js-apis-wifi.md)
-- Device Management
- - [Sensors](js-apis-sensor.md)
- - [Vibration](js-apis-vibrator.md)
+ - [Bluetooth](js-apis-bluetooth.md)
+- Device Management
+ - [Sensor](js-apis-sensor.md)
+ - [Vibrator](js-apis-vibrator.md)
- [Brightness](js-apis-brightness.md)
- [Battery Info](js-apis-battery-info.md)
- [Power Management](js-apis-power.md)
@@ -50,7 +60,7 @@
- [Display](js-apis-display.md)
- [Update](js-apis-update.md)
- [USB](js-apis-usb.md)
-- Basic Features
+- Basic Features
- [Application Context](js-apis-basic-features-app-context.md)
- [Console Logs](js-apis-basic-features-logs.md)
- [Page Routing](js-apis-basic-features-routes.md)
@@ -59,12 +69,17 @@
- [Timer](js-apis-basic-features-timer.md)
- [Setting the System Time](js-apis-system-time.md)
- [Animation](js-apis-basic-features-animator.md)
+ - [WebGL](js-apis-webgl.md)
+ - [WebGL2](js-apis-webgl2.md)
+- DFX
- [HiAppEvent](js-apis-hiappevent.md)
- [Performance Tracing](js-apis-hitracemeter.md)
- [Fault Logger](js-apis-faultLogger.md)
- [Distributed Call Chain Tracing](js-apis-hitracechain.md)
- [HiLog](js-apis-hilog.md)
-- Language Base Class Library
+ - [HiChecker](js-apis-hichecker.md)
+ - [HiDebug](js-apis-hidebug.md)
+- Language Base Class Library
- [Obtaining Process Information](js-apis-process.md)
- [URL String Parsing](js-apis-url.md)
- [URI String Parsing](js-apis-uri.md)
diff --git a/en/application-dev/reference/apis/js-apis-Bundle.md b/en/application-dev/reference/apis/js-apis-Bundle.md
index c3fa3085f88b515ef084d2517807a6155787f083..8fc52e97652cd9755d7f2e3a2094913301cd5709 100644
--- a/en/application-dev/reference/apis/js-apis-Bundle.md
+++ b/en/application-dev/reference/apis/js-apis-Bundle.md
@@ -12,7 +12,11 @@ SystemCapability.BundleManager.BundleFramework
## Required Permissions
-None
+| Required Permissions| Permission Level| Description|
+|-------| --------- | ---- |
+| ohos.permission.GET_BUNDLE_INFO | normal | Permission to query information about the current 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.|
## bundle.getApplicationInfo
@@ -20,62 +24,35 @@ getApplicationInfo(bundleName: string, bundleFlags: number, userId: number): Pro
Obtains the application information of the specified user based on a given bundle name in asynchronous mode. This method uses a promise to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name of the 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.|
+| bundleName | string | Yes | Bundle name of the 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. |
**Return value**
-| Type| Description|
+| Type | Description|
| ----------- | -------- |
| Promise\ | Promise used to return the application information.|
**Example**
```js
-bundle.getApplicationInfo('com.example.myapplicationInstall', 8, 0).then((data) => {
- console.info("name: for begin");
- console.info("name:" + data.name);
- console.info("bundleName:" + data.bundleName);
- console.info("description:" + data.description);
- console.info("descriptionId:" + data.descriptionId);
- console.info("iconPath:" + data.iconPath);
- console.info("iconId:" + data.iconId);
- console.info("label:" + data.label);
- console.info("labelId:" + data.labelId);
- console.info("deviceId:" + data.deviceId);
- console.info("signatureKey:" + data.signatureKey);
- console.info("process:" + data.process);
- console.info("isSystemApp:" + data.isSystemApp);
- console.info("isLauncherApp:" + data.isLauncherApp);
- console.info("supportedModes:" + data.supportedModes);
-
- console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
- for (var j = 0; j < data.moduleSourceDirs.length; j++) {
- console.info("moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
- }
- console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
- for (var j = 0; j < data.moduleInfos.length; j++) {
- console.info("moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
- console.info("moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
- }
- console.info("entryDir:" + data.entryDir);
- console.info("codePath:" + data.codePath);
- console.info("dataDir:" + data.dataDir);
- console.info("dataBaseDir:" + data.dataBaseDir);
- console.info("cacheDir:" + data.cacheDir);
+let bundleName = "com.example.myapplication";
+let bundleFlags = 0;
+let userId = 100;
+bundle.getApplicationInfo(bundleName, bundleFlags, userId)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -87,152 +64,69 @@ getApplicationInfo(bundleName: string, bundleFlags: number, userId: number, call
Obtains the application information of the specified user based on a given bundle name in asynchronous mode. This method uses a callback to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ------------------------------- | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name of the 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.|
-| callback | AsyncCallback\ | Yes| Callback used to return the application information.|
+| bundleName | string | Yes | Bundle name of the 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\ | Yes | Callback used to return the application information. |
**Example**
```js
-bundle.getApplicationInfo('com.example.myapplicationInstall', 8, 0, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name: for begin");
- console.info("name:" + data.name);
- console.info("bundleName:" + data.bundleName);
- console.info("description:" + data.description);
- console.info("descriptionId:" + data.descriptionId);
- console.info("iconPath:" + data.iconPath);
- console.info("iconId:" + data.iconId);
- console.info("label:" + data.label);
- console.info("labelId:" + data.labelId);
- console.info("deviceId:" + data.deviceId);
- console.info("signatureKey:" + data.signatureKey);
- console.info("process:" + data.process);
- console.info("isSystemApp:" + data.isSystemApp);
- console.info("isLauncherApp:" + data.isLauncherApp);
- console.info("supportedModes:" + data.supportedModes);
-
- console.info('getApplicationInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('getApplicationInfo moduleSourceDirs length [' + data.moduleSourceDirs.length + ']');
- for (var j = 0; j < data.moduleSourceDirs.length; j++) {
- console.info("moduleSourceDirs[" + j + "]:" + data.moduleSourceDirs[j]);
- }
- console.info('getApplicationInfo moduleInfos length [' + data.moduleInfos.length + ']');
- for (var j = 0; j < data.moduleInfos.length; j++) {
- console.info("moduleInfos[" + j + "]moduleName:" + data.moduleInfos[j].moduleName);
- console.info("moduleInfos[" + j + "]moduleSourceDir:" + data.moduleInfos[j].moduleSourceDir);
- }
- console.info("entryDir:" + data.entryDir);
- console.info("codePath:" + data.codePath);
- console.info("dataDir:" + data.dataDir);
- console.info("dataBaseDir:" + data.dataBaseDir);
- console.info("cacheDir:" + data.cacheDir);
-}
+let bundleName = "com.example.myapplication";
+let bundleFlags = 0;
+let userId = 100;
+bundle.getApplicationInfo(bundleName, bundleFlags, userId, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ })
```
## bundle.getAllBundleInfo
-getAllBundleInfo(bundleFlag: BundleFlag): Promise>
+getAllBundleInfo(bundleFlag: BundleFlag, userId?: number): Promise>
Obtains the information of all available bundles in the system in asynchronous mode. This method uses a promise to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ---------- | ---- | ----------------------------------------------------------- |
-| bundleFlag | BundleFlag | Yes| Type of information that will be returned. **0**: The default bundle information will be returned. **1**: The bundle information containing the ability information will be returned.|
+| bundleFlag | BundleFlag | 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. |
**Return value**
-| Type| Description|
+| Type | Description |
| --------------------------- | ----------------------------------- |
| Promise> | Promise used to return the information of all available bundles.|
**Example**
```js
-bundle.getAllBundleInfo(0).then((data) => {
- for (var i = 0; i < data.length; i++) {
- console.info("index[" + i + "].name: for begin");
- console.info("index[" + i + "].name:" + data[i].name);
- console.info("index[" + i + "].label:" + data[i].label);
- console.info("index[" + i + "].description:" + data[i].description);
- console.info("index[" + i + "].vendor:" + data[i].vendor);
- console.info("index[" + i + "].versionCode:" + data[i].versionCode);
- console.info("index[" + i + "].versionName:" + data[i].versionName);
- console.info("index[" + i + "].jointUserId:" + data[i].jointUserId);
- console.info("index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
- console.info("index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
- console.info("index[" + i + "].mainEntry:" + data[i].mainEntry);
- console.info("index[" + i + "].cpuAbi:" + data[i].cpuAbi);
- console.info("index[" + i + "].appId:" + data[i].appId);
- console.info("index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
- console.info("index[" + i + "].targetVersion:" + data[i].targetVersion);
- console.info("index[" + i + "].releaseType:" + data[i].releaseType);
- console.info("index[" + i + "].uid:" + data[i].uid);
- console.info("index[" + i + "].gid:" + data[i].gid);
- console.info("index[" + i + "].seInfo:" + data[i].seInfo);
- console.info("index[" + i + "].entryModuleName:" + data[i].entryModuleName);
- console.info("index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
- console.info("index[" + i + "].isNativeApp:" + data[i].isNativeApp);
- console.info("index[" + i + "].installTime:" + data[i].installTime);
- console.info("index[" + i + "].updateTime:" + data[i].updateTime);
- console.info("index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
- console.info("index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
- console.info('getAllBundleInfo reqPermissions length [' + data[i].reqPermissions.length + ']');
- for (var j = 0; j < data[i].reqPermissions.length; j++) {
- console.info("index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
- }
- console.info('getAllBundleInfo defPermissions length [' + data[i].defPermissions.length + ']');
- for (var j = 0; j < data[i].defPermissions.length; j++) {
- console.info("index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
- }
-
- console.info('getAllBundleInfo hapModuleNames length [' + data[i].hapModuleNames.length + ']');
- for (var j = 0; j < data[i].hapModuleNames.length; j++) {
- console.info("index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
- }
- console.info('getAllBundleInfo moduleNames length [' + data[i].moduleNames.length + ']');
- for (var j = 0; j < data[i].moduleNames.length; j++) {
- console.info("index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
- }
- console.info('getAllBundleInfo modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
- for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
- console.info("index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
- }
- console.info('getAllBundleInfo moduleDirs length [' + data[i].moduleDirs.length + ']');
- for (var j = 0; j < data[i].moduleDirs.length; j++) {
- console.info("index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
- }
- console.info('getAllBundleInfo moduleResPaths length [' + data[i].moduleResPaths.length + ']');
- for (var j = 0; j < data[i].moduleResPaths.length; j++) {
- console.info("index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
- }
- console.info('getAllBundleInfo abilityInfo length [' + data[i].abilityInfos.length + ']');
- for (var j = 0; j < data[i].abilityInfos.length; j++) {
- console.info("index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
- console.info("index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
- }
- }
+let bundleFlag = 0;
+let userId = 100;
+bundle.getAllBundleInfo(bundleFlag, userId)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -244,177 +138,103 @@ getAllBundleInfo(bundleFlag: BundleFlag, callback: AsyncCallback**0**: The default bundle information will be returned. **1**: The bundle information containing the ability information will be returned.|
-| callback | AsyncCallback> | Yes| Callback used to return the information of all available bundles.|
+| bundleFlag | BundleFlag | 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> | Yes | Callback used to return the information of all available bundles. |
**Example**
```js
-bundle.getAllBundleInfo(0, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info('xxx getAllBundleInfo data length [' + data.length + ']');
- for (var i = 0; i < data.length; i++) {
- console.info("index[" + i + "].name: for begin");
- console.info("index[" + i + "].name:" + data[i].name);
- console.info("index[" + i + "].label:" + data[i].label);
- console.info("index[" + i + "].description:" + data[i].description);
- console.info("index[" + i + "].vendor:" + data[i].vendor);
- console.info("index[" + i + "].versionCode:" + data[i].versionCode);
- console.info("index[" + i + "].versionName:" + data[i].versionName);
- console.info("index[" + i + "].jointUserId:" + data[i].jointUserId);
- console.info("index[" + i + "].minSdkVersion:" + data[i].minSdkVersion);
- console.info("index[" + i + "].maxSdkVersion:" + data[i].maxSdkVersion);
- console.info("index[" + i + "].mainEntry:" + data[i].mainEntry);
- console.info("index[" + i + "].cpuAbi:" + data[i].cpuAbi);
- console.info("index[" + i + "].appId:" + data[i].appId);
- console.info("index[" + i + "].compatibleVersion:" + data[i].compatibleVersion);
- console.info("index[" + i + "].targetVersion:" + data[i].targetVersion);
- console.info("index[" + i + "].releaseType:" + data[i].releaseType);
- console.info("index[" + i + "].uid:" + data[i].uid);
- console.info("index[" + i + "].gid:" + data[i].gid);
- console.info("index[" + i + "].seInfo:" + data[i].seInfo);
- console.info("index[" + i + "].entryModuleName:" + data[i].entryModuleName);
- console.info("index[" + i + "].isKeepAlive:" + data[i].isKeepAlive);
- console.info("index[" + i + "].isNativeApp:" + data[i].isNativeApp);
- console.info("index[" + i + "].installTime:" + data[i].installTime);
- console.info("index[" + i + "].updateTime:" + data[i].updateTime);
- console.info("index[" + i + "].appInfo.name:" + data[i].applicationInfo.name);
- console.info("index[" + i + "].appInfo.bundleName:" + data[i].applicationInfo.bundleName);
- console.info('getAllBundleInfo reqPermissions length [' + data[i].reqPermissions.length + ']');
- for (var j = 0; j < data[i].reqPermissions.length; j++) {
- console.info("index[" + i + "]reqPermissions[" + j + "]:" + data[i].reqPermissions[j]);
- }
- console.info('getAllBundleInfo defPermissions length [' + data[i].defPermissions.length + ']');
- for (var j = 0; j < data[i].defPermissions.length; j++) {
- console.info("index[" + i + "]defPermissions[" + j + "]:" + data[i].defPermissions[j]);
- }
+let bundleFlag = 0;
+bundle.getAllBundleInfo(bundleFlag, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ })
+```
- console.info('getAllBundleInfo hapModuleNames length [' + data[i].hapModuleNames.length + ']');
- for (var j = 0; j < data[i].hapModuleNames.length; j++) {
- console.info("index[" + i + "]hapModuleNames[" + j + "]:" + data[i].hapModuleNames[j]);
- }
- console.info('getAllBundleInfo moduleNames length [' + data[i].moduleNames.length + ']');
- for (var j = 0; j < data[i].moduleNames.length; j++) {
- console.info("index[" + i + "]moduleNames[" + j + "]:" + data[i].moduleNames[j]);
- }
- console.info('getAllBundleInfo modulePublicDirs length [' + data[i].modulePublicDirs.length + ']');
- for (var j = 0; j < data[i].modulePublicDirs.length; j++) {
- console.info("index[" + i + "]modulePublicDirs[" + j + "]:" + data[i].modulePublicDirs[j]);
- }
- console.info('getAllBundleInfo moduleDirs length [' + data[i].moduleDirs.length + ']');
- for (var j = 0; j < data[i].moduleDirs.length; j++) {
- console.info("index[" + i + "]moduleDirs[" + j + "]:" + data[i].moduleDirs[j]);
- }
- console.info('getAllBundleInfo moduleResPaths length [' + data[i].moduleResPaths.length + ']');
- for (var j = 0; j < data[i].moduleResPaths.length; j++) {
- console.info("index[" + i + "]moduleResPaths[" + j + "]:" + data[i].moduleResPaths[j]);
- }
- console.info('getAllBundleInfo abilityInfo length [' + data[i].abilityInfos.length + ']');
- for (var j = 0; j < data[i].abilityInfos.length; j++) {
- console.info("index[" + i + "]abilityInfos[" + j + "]name:" + data[i].abilityInfos[j].name);
- console.info("index[" + i + "]abilityInfos[" + j + "]package:" + data[i].abilityInfos[j].package);
- }
- }
-}
+
+## bundle.getAllBundleInfo
+
+getAllBundleInfo(bundleFlag: BundleFlag, userId: number, callback: AsyncCallback>): void
+
+Obtains the information of all available bundles in the system in asynchronous mode. This method uses a callback to return the result.
+
+**Required permissions**
+
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ---------- | --------------------------------- | ---- | ------------------------------------------------------------ |
+| bundleFlag | BundleFlag | 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> | Yes | Callback used to return the information of all available bundles. |
+
+**Example**
+
+```js
+let bundleFlag = 0;
+let userId = 100;
+bundle.getAllBundleInfo(bundleFlag, userId, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ })
```
## bundle.getBundleInfo
-getBundleInfo(bundleName: string, bundleFlags: number): Promise\
+getBundleInfo(bundleName: string, bundleFlags: number, options?: BundleOptions): Promise\
Obtains the bundle information based on a given bundle name in asynchronous mode. This method uses a promise to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ------ | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name.|
-| bundleFlags | number | Yes| Type of information that will be returned. **0**: The default bundle information will be returned. **1**: The bundle information containing the ability information will be returned.|
+| bundleName | string | Yes | Bundle name. |
+| 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 | No | Includes **userId** and **networkId**. |
**Return value**
-| Type| Description|
+| Type | Description |
| -------------------- | ------------------------------------------ |
| Promise\ | Promise used to return the bundle information.|
**Example**
```js
-bundle.getBundleInfo('com.example.myapplicationInstall', 1).then((data) => {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("vendor:" + data.vendor);
- console.info("versionCode:" + data.versionCode);
- console.info("versionName:" + data.versionName);
- console.info("jointUserId:" + data.jointUserId);
- console.info("minSdkVersion:" + data.minSdkVersion);
- console.info("maxSdkVersion:" + data.maxSdkVersion);
- console.info("mainEntry:" + data.mainEntry);
- console.info("cpuAbi:" + data.cpuAbi);
- console.info("appId:" + data.appId);
- console.info("compatibleVersion:" + data.compatibleVersion);
- console.info("targetVersion:" + data.targetVersion);
- console.info("releaseType:" + data.releaseType);
- console.info("uid:" + data.uid);
- console.info("gid:" + data.gid);
- console.info("seInfo:" + data.seInfo);
- console.info("entryModuleName:" + data.entryModuleName);
- console.info("isKeepAlive:" + data.isKeepAlive);
- console.info("isNativeApp:" + data.isNativeApp);
- console.info("installTime:" + data.installTime);
- console.info("updateTime:" + data.updateTime);
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- console.info('getBundleInfo reqPermissions length [' + data.reqPermissions.length + ']');
- for (var j = 0; j < data.reqPermissions.length; j++) {
- console.info("reqPermissions[" + j + "]:" + data.reqPermissions[j]);
- }
- console.info('getBundleInfo defPermissions length [' + data.defPermissions.length + ']');
- for (var j = 0; j < data.defPermissions.length; j++) {
- console.info("defPermissions[" + j + "]:" + data.defPermissions[j]);
- }
-
- console.info('getBundleInfo hapModuleNames length [' + data.hapModuleNames.length + ']');
- for (var j = 0; j < data.hapModuleNames.length; j++) {
- console.info("hapModuleNames[" + j + "]:" + data.hapModuleNames[j]);
- }
- console.info('getBundleInfo moduleNames length [' + data.moduleNames.length + ']');
- for (var j = 0; j < data.moduleNames.length; j++) {
- console.info("moduleNames[" + j + "]:" + data.moduleNames[j]);
- }
- console.info('getBundleInfo modulePublicDirs length [' + data.modulePublicDirs.length + ']');
- for (var j = 0; j < data.modulePublicDirs.length; j++) {
- console.info("modulePublicDirs[" + j + "]:" + data.modulePublicDirs[j]);
- }
- console.info('getBundleInfo moduleDirs length [' + data.moduleDirs.length + ']');
- for (var j = 0; j < data.moduleDirs.length; j++) {
- console.info("moduleDirs[" + j + "]:" + data.moduleDirs[j]);
- }
- console.info('getBundleInfo moduleResPaths length [' + data.moduleResPaths.length + ']');
- for (var j = 0; j < data.moduleResPaths.length; j++) {
- console.info("moduleResPaths[" + j + "]:" + data.moduleResPaths[j]);
- }
- console.info('getBundleInfo abilityInfo length [' + data.abilityInfos.length + ']');
- for (var j = 0; j < data.abilityInfos.length; j++) {
- console.info("abilityInfos[" + j + "]name:" + data.abilityInfos[j].name);
- console.info("abilityInfos[" + j + "]package:" + data.abilityInfos[j].package);
- }
+let bundleName = "com.example.myapplication";
+let bundleFlags = 1;
+let options = {
+ "userId" : 100,
+ "networkId" : null
+};
+bundle.getBundleInfo(bundleName, bundleFlags, options)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -426,87 +246,70 @@ getBundleInfo(bundleName: string, bundleFlags: number, callback: AsyncCallback\<
Obtains the bundle information based on a given bundle name in asynchronous mode. This method uses a callback to return the result.
-**Permission required**
+**Required permissions**
ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name.|
-| bundleFlags | number | Yes| Type of information that will be returned. **0**: The default bundle information will be returned. **1**: The bundle information containing the ability information will be returned.|
-| callback | AsyncCallback\ | Yes| Callback used to return the bundle information.|
+| bundleName | string | Yes | Bundle name. |
+| 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\ | Yes | Callback used to return the bundle information. |
**Example**
```js
-bundle.getBundleInfo('com.example.myapplicationInstall', 1, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("vendor:" + data.vendor);
- console.info("versionCode:" + data.versionCode);
- console.info("versionName:" + data.versionName);
- console.info("jointUserId:" + data.jointUserId);
- console.info("minSdkVersion:" + data.minSdkVersion);
- console.info("maxSdkVersion:" + data.maxSdkVersion);
- console.info("mainEntry:" + data.mainEntry);
- console.info("cpuAbi:" + data.cpuAbi);
- console.info("appId:" + data.appId);
- console.info("compatibleVersion:" + data.compatibleVersion);
- console.info("targetVersion:" + data.targetVersion);
- console.info("releaseType:" + data.releaseType);
- console.info("uid:" + data.uid);
- console.info("gid:" + data.gid);
- console.info("seInfo:" + data.seInfo);
- console.info("entryModuleName:" + data.entryModuleName);
- console.info("isKeepAlive:" + data.isKeepAlive);
- console.info("isNativeApp:" + data.isNativeApp);
- console.info("installTime:" + data.installTime);
- console.info("updateTime:" + data.updateTime);
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- console.info('getBundleInfo reqPermissions length [' + data.reqPermissions.length + ']');
- for (var j = 0; j < data.reqPermissions.length; j++) {
- console.info("reqPermissions[" + j + "]:" + data.reqPermissions[j]);
- }
- console.info('getBundleInfo defPermissions length [' + data.defPermissions.length + ']');
- for (var j = 0; j < data.defPermissions.length; j++) {
- console.info("defPermissions[" + j + "]:" + data.defPermissions[j]);
- }
-
- console.info('getBundleInfo hapModuleNames length [' + data.hapModuleNames.length + ']');
- for (var j = 0; j < data.hapModuleNames.length; j++) {
- console.info("hapModuleNames[" + j + "]:" + data.hapModuleNames[j]);
- }
- console.info('getBundleInfo moduleNames length [' + data.moduleNames.length + ']');
- for (var j = 0; j < data.moduleNames.length; j++) {
- console.info("moduleNames[" + j + "]:" + data.moduleNames[j]);
- }
- console.info('getBundleInfo modulePublicDirs length [' + data.modulePublicDirs.length + ']');
- for (var j = 0; j < data.modulePublicDirs.length; j++) {
- console.info("modulePublicDirs[" + j + "]:" + data.modulePublicDirs[j]);
- }
- console.info('getBundleInfo moduleDirs length [' + data.moduleDirs.length + ']');
- for (var j = 0; j < data.moduleDirs.length; j++) {
- console.info("moduleDirs[" + j + "]:" + data.moduleDirs[j]);
- }
- console.info('getBundleInfo moduleResPaths length [' + data.moduleResPaths.length + ']');
- for (var j = 0; j < data.moduleResPaths.length; j++) {
- console.info("moduleResPaths[" + j + "]:" + data.moduleResPaths[j]);
- }
- console.info('getBundleInfo abilityInfo length [' + data.abilityInfos.length + ']');
- for (var j = 0; j < data.abilityInfos.length; j++) {
- console.info("abilityInfos[" + j + "]name:" + data.abilityInfos[j].name);
- console.info("abilityInfos[" + j + "]package:" + data.abilityInfos[j].package);
- }
-}
+let bundleName = "com.example.myapplication";
+let bundleFlags = 1;
+bundle.getBundleInfo(bundleName, bundleFlags, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
+## bundle.getBundleInfo
+
+getBundleInfo(bundleName: string, bundleFlags: number, options: BundleOptions, callback: AsyncCallback\): void
+
+Obtains the bundle information based on a given bundle name in asynchronous mode. This method uses a callback to return the result.
+
+**Required permissions**
+
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
+
+**Parameters**
+
+| Name | Type | Mandatory| Description |
+| ----------- | -------------------------- | ---- | ------------------------------------------------------------ |
+| bundleName | string | Yes | Bundle name. |
+| 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 | Yes | Includes **userId** and **networkId**. |
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle information. |
+
+**Example**
+
+```js
+let bundleName = "com.example.myapplication";
+let bundleFlags = 1;
+let options = {
+ "userId" : 100,
+ "networkId" : null
+};
+bundle.getBundleInfo(bundleName, bundleFlags, options, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
+```
+
## bundle.getAllApplicationInfo
@@ -514,64 +317,33 @@ getAllApplicationInfo(bundleFlags: number, userId: number): Promise**0**: The default application information will be returned. **8**: The application information containing the permission information will be returned.|
-| userId | number | Yes| User ID.|
+| 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. |
**Return value**
-| Type| Description|
+| Type | Description |
| -------------------------------- | ------------------------------------------------ |
| Promise> | Promise used to return the application information.|
**Example**
```js
-bundle.getAllApplicationInfo(8, 0).then((data) => {
- console.info('xxx getAllApplicationInfo data length [' + data.length + ']');
- for (var i = 0; i < data.length; i++) {
- console.info("index[" + i + "].name: for begin");
- console.info("index[" + i + "].name:" + data[i].name);
- console.info("index[" + i + "].bundleName:" + data[i].bundleName);
- console.info("index[" + i + "].description:" + data[i].description);
- console.info("index[" + i + "].descriptionId:" + data[i].descriptionId);
- console.info("index[" + i + "].iconPath:" + data[i].iconPath);
- console.info("index[" + i + "].iconId:" + data[i].iconId);
- console.info("index[" + i + "].label:" + data[i].label);
- console.info("index[" + i + "].labelId:" + data[i].labelId);
- console.info("index[" + i + "].deviceId:" + data[i].deviceId);
- console.info("index[" + i + "].signatureKey:" + data[i].signatureKey);
- console.info("index[" + i + "].process:" + data[i].process);
- console.info("index[" + i + "].isSystemApp:" + data[i].isSystemApp);
- console.info("index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
- console.info("index[" + i + "].supportedModes:" + data[i].supportedModes);
-
- console.info('getAllApplicationInfo Async permissions length [' + data[i].permissions.length + ']');
- for (var j = 0; j < data[i].permissions.length; j++) {
- console.info("index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
- }
- console.info('getAllApplicationInfo Async moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
- for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
- console.info("index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
- }
- console.info('getAllApplicationInfo Async moduleInfos length [' + data[i].moduleInfos.length + ']');
- for (var j = 0; j < data[i].moduleInfos.length; j++) {
- console.info("index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
- console.info("index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
- }
- console.info("index[" + i + "].entryDir:" + data[i].entryDir);
- console.info("index[" + i + "].codePath:" + data[i].codePath);
- console.info("index[" + i + "].dataDir:" + data[i].dataDir);
- console.info("index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
- console.info("index[" + i + "].cacheDir:" + data[i].cacheDir);
- }
+let bundleFlags = 8;
+let userId = 100;
+bundle.getAllApplicationInfo(bundleFlags, userId)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -583,62 +355,30 @@ getAllApplicationInfo(bundleFlags: number, userId: number, callback: AsyncCallba
Obtains the information about all installed applications of the specified user. This method uses a callback to return the result.
-**Permission required**
+**Required permissions**
-ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED or ohos.permission.GET\_BUNDLE\_INFO
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | -------------------------------------- | ---- | ------------------------------------------------------ |
-| bundleFlags | number | Yes| Type of information that will be returned. **0**: The default application information will be returned. **8**: The application information containing the permission information will be returned.|
-| userId | number | Yes| User ID.|
-| callback | AsyncCallback> | Yes| Callback used to return the application information.|
+| 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> | Yes | Callback used to return the application information. |
**Example**
```js
-bundle.getAllApplicationInfo(8, 0, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info('xxx getAllApplicationInfo data length [' + data.length + ']');
- for (var i = 0; i < data.length; i++) {
- console.info("index[" + i + "].name: for begin");
- console.info("index[" + i + "].name:" + data[i].name);
- console.info("index[" + i + "].bundleName:" + data[i].bundleName);
- console.info("index[" + i + "].description:" + data[i].description);
- console.info("index[" + i + "].descriptionId:" + data[i].descriptionId);
- console.info("index[" + i + "].iconPath:" + data[i].iconPath);
- console.info("index[" + i + "].iconId:" + data[i].iconId);
- console.info("index[" + i + "].label:" + data[i].label);
- console.info("index[" + i + "].labelId:" + data[i].labelId);
- console.info("index[" + i + "].deviceId:" + data[i].deviceId);
- console.info("index[" + i + "].signatureKey:" + data[i].signatureKey);
- console.info("index[" + i + "].process:" + data[i].process);
- console.info("index[" + i + "].isSystemApp:" + data[i].isSystemApp);
- console.info("index[" + i + "].isLauncherApp:" + data[i].isLauncherApp);
- console.info("index[" + i + "].supportedModes:" + data[i].supportedModes);
-
- console.info('getAllApplicationInfo Async permissions length [' + data[i].permissions.length + ']');
- for (var j = 0; j < data[i].permissions.length; j++) {
- console.info("index[" + i + "]permissions[" + j + "]:" + data[i].permissions[j]);
- }
- console.info('getAllApplicationInfo Async moduleSourceDirs length [' + data[i].moduleSourceDirs.length + ']');
- for (var j = 0; j < data[i].moduleSourceDirs.length; j++) {
- console.info("index[" + i + "]moduleSourceDirs[" + j + "]:" + data[i].moduleSourceDirs[j]);
- }
- console.info('getAllApplicationInfo Async moduleInfos length [' + data[i].moduleInfos.length + ']');
- for (var j = 0; j < data[i].moduleInfos.length; j++) {
- console.info("index[" + i + "]moduleInfos[" + j + "]moduleName:" + data[i].moduleInfos[j].moduleName);
- console.info("index[" + i + "]moduleInfos[" + j + "]moduleSourceDir:" + data[i].moduleInfos[j].moduleSourceDir);
- }
- console.info("index[" + i + "].entryDir:" + data[i].entryDir);
- console.info("index[" + i + "].codePath:" + data[i].codePath);
- console.info("index[" + i + "].dataDir:" + data[i].dataDir);
- console.info("index[" + i + "].dataBaseDir:" + data[i].dataBaseDir);
- console.info("index[" + i + "].cacheDir:" + data[i].cacheDir);
- }
-}
+let bundleFlags = 8;
+let userId = 100;
+bundle.getAllApplicationInfo(bundleFlags, userId, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
@@ -649,101 +389,38 @@ queryAbilityByWant(want: Want, bundleFlags: number, userId?: number): Promise**0**: The default ability information will be returned. **2**: The ability information containing the permission information will be returned. **4**: The ability information containing the application information will be returned.|
-| 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.|
+| want | Want | Yes | Want that contains the bundle name. |
+| bundleFlags | number | Yes | Ability information to 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. |
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------------------- | ---------------------------- |
| Promise\>| Promise used to return the ability information.|
**Example**
```js
-bundle.queryAbilityByWant({
- want: {
- action: "action.system.home",
- entities: ["entity.system.home"],
- elementName: {
- deviceId: "0",
- bundleName: "com.example.myapplicationInstall",
- abilityName: "com.example.myapplication.MainAbility",
- },
- }
-}, 1, 0,
-}).then((data) => {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("iconPath:" + data.iconPath);
- console.info("visible:" + data.visible);
- console.info("kind:" + data.kind);
- console.info("uri:" + data.uri);
- console.info("process:" + data.process);
- console.info("package:" + data.package);
- console.info("bundleName:" + data.bundleName);
- console.info("moduleName:" + data.moduleName);
- console.info("applicationName:" + data.applicationName);
- console.info("deviceId:" + data.deviceId);
- console.info("codePath:" + data.codePath);
- console.info("resourcePath:" + data.resourcePath);
- console.info("libPath:" + data.libPath);
-
- console.info('queryAbilityInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('queryAbilityInfo deviceTypes length [' + data.deviceTypes.length + ']');
- for (var j = 0; j < data.deviceTypes.length; j++) {
- console.info("deviceTypes[" + j + "]:" + data.deviceTypes[j]);
- }
- console.info('queryAbilityInfo deviceCapabilities length [' + data.deviceCapabilities.length + ']');
- for (var j = 0; j < data.deviceCapabilities.length; j++) {
- console.info("deviceCapabilities[" + j + "]:" + data.deviceCapabilities[j]);
- }
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- // ability type: 0:UNKNOWN, 1:PAGE, 2:SERVICE, 3:DATA
- console.info("type:" + data.type);
- // orientation: 0:UNSPECIFIED, 1:LANDSCAPE, 2:PORTRAIT, 3:FOLLOWRECENT,
- console.info("orientation:" + data.orientation);
- // launchMode: 0:SINGLETON, 1:SINGLETOP, 2:STANDARD
- console.info("launchMode:" + data.launchMode);
-
- // the enum of AbilityType
- console.info("AbilityType:" + bundle.AbilityType.UNKNOWN);
- console.info("AbilityType:" + bundle.AbilityType.PAGE);
- console.info("AbilityType:" + bundle.AbilityType.SERVICE);
- console.info("AbilityType:" + bundle.AbilityType.DATA);
- if (data.type == bundle.AbilityType.PAGE) {
- console.info("this AbilityType is PAGE");
- }
- // the enum of DisplayOrientation
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.UNSPECIFIED);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.LANDSCAPE);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.PORTRAIT);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.FOLLOWRECENT);
- if (data.orientation == bundle.DisplayOrientation.UNSPECIFIED) {
- console.info("this DisplayOrientation is UNSPECIFIED");
- }
- // the enum of LaunchMode
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETON);
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETOP);
- console.info("LaunchMode:" + bundle.LaunchMode.STANDARD);
- if (data.launchMode == bundle.LaunchMode.STANDARD) {
- console.info("this LaunchMode is STANDARD");
- }
-
+let bundleFlags = 0;
+let userId = 100;
+let want = {
+ bundleName : "com.example.myapplication",
+ abilityName : "com.example.myapplication.MainAbility"
+};
+bundle.queryAbilityByWant(want, bundleFlags, userId)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -757,93 +434,29 @@ Obtains the ability information of the specified user based on a given want. Thi
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| want | Want | Yes| Want that contains the bundle name.|
-| bundleFlags | number | Yes| Type of information that will be returned. **0**: The default ability information will be returned. **2**: The ability information containing the permission information will be returned. **4**: The ability information containing the application information will be returned.|
-| userId | number | Yes| User ID.|
-| callback | AsyncCallback> | Yes| Callback used to return the ability information.|
+| want | Want | Yes | Want that contains the bundle name. |
+| bundleFlags | number | Yes | Ability information to 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> | Yes | Callback used to return the ability information. |
**Example**
```js
-bundle.queryAbilityByWant(
- {
- want: {
- action: "action.system.home",
- entities: ["entity.system.home"],
- elementName: {
- deviceId: "0",
- bundleName: "com.example.myapplicationInstall",
- abilityName: "com.example.myapplication.MainAbility",
- },
- }
- }, 1, 0,
- }, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("iconPath:" + data.iconPath);
- console.info("visible:" + data.visible);
- console.info("kind:" + data.kind);
- console.info("uri:" + data.uri);
- console.info("process:" + data.process);
- console.info("package:" + data.package);
- console.info("bundleName:" + data.bundleName);
- console.info("moduleName:" + data.moduleName);
- console.info("applicationName:" + data.applicationName);
- console.info("deviceId:" + data.deviceId);
- console.info("codePath:" + data.codePath);
- console.info("resourcePath:" + data.resourcePath);
- console.info("libPath:" + data.libPath);
-
- console.info('queryAbilityInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('queryAbilityInfo deviceTypes length [' + data.deviceTypes.length + ']');
- for (var j = 0; j < data.deviceTypes.length; j++) {
- console.info("deviceTypes[" + j + "]:" + data.deviceTypes[j]);
- }
- console.info('queryAbilityInfo deviceCapabilities length [' + data.deviceCapabilities.length + ']');
- for (var j = 0; j < data.deviceCapabilities.length; j++) {
- console.info("deviceCapabilities[" + j + "]:" + data.deviceCapabilities[j]);
- }
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- // ability type: 0:UNKNOWN, 1:PAGE, 2:SERVICE, 3:DATA
- console.info("type:" + data.type);
- // orientation: 0:UNSPECIFIED, 1:LANDSCAPE, 2:PORTRAIT, 3:FOLLOWRECENT,
- console.info("orientation:" + data.orientation);
- // launchMode: 0:SINGLETON, 1:SINGLETOP, 2:STANDARD
- console.info("launchMode:" + data.launchMode);
-
- // the enum of AbilityType
- console.info("AbilityType:" + bundle.AbilityType.UNKNOWN);
- console.info("AbilityType:" + bundle.AbilityType.PAGE);
- console.info("AbilityType:" + bundle.AbilityType.SERVICE);
- console.info("AbilityType:" + bundle.AbilityType.DATA);
- if (data.type == bundle.AbilityType.PAGE) {
- console.info("this AbilityType is PAGE");
- }
- // the enum of DisplayOrientation
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.UNSPECIFIED);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.LANDSCAPE);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.PORTRAIT);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.FOLLOWRECENT);
- if (data.orientation == bundle.DisplayOrientation.UNSPECIFIED) {
- console.info("this DisplayOrientation is UNSPECIFIED");
- }
- // the enum of LaunchMode
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETON);
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETOP);
- console.info("LaunchMode:" + bundle.LaunchMode.STANDARD);
- if (data.launchMode == bundle.LaunchMode.STANDARD) {
- console.info("this LaunchMode is STANDARD");
- }
-}
+let bundleFlags = 0;
+let userId = 100;
+let want = {
+ bundleName : "com.example.myapplication",
+ abilityName : "com.example.myapplication.MainAbility"
+};
+bundle.queryAbilityByWant(want, bundleFlags, userId, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
## bundle.queryAbilityByWant
@@ -854,288 +467,65 @@ Obtains the ability information based on a given want. This method uses an async
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ----------- | ---------------------------------- | ---- | ------------------------------------------------------------ |
-| want | Want | Yes| Want that contains the bundle name.|
-| bundleFlags | number | Yes| Type of information that will be returned. **0**: The default ability information will be returned. **2**: The ability information containing the permission information will be returned. **4**: The ability information containing the application information will be returned.|
-| callback | AsyncCallback> | Yes| Callback used to return the ability information.|
-
-**Example**
-
-```js
-bundle.queryAbilityByWant(
- {
- want: {
- action: "action.system.home",
- entities: ["entity.system.home"],
- elementName: {
- deviceId: "0",
- bundleName: "com.example.myapplicationInstall",
- abilityName: "com.example.myapplication.MainAbility",
- },
- }
- }, 1,
- }, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("iconPath:" + data.iconPath);
- console.info("visible:" + data.visible);
- console.info("kind:" + data.kind);
- console.info("uri:" + data.uri);
- console.info("process:" + data.process);
- console.info("package:" + data.package);
- console.info("bundleName:" + data.bundleName);
- console.info("moduleName:" + data.moduleName);
- console.info("applicationName:" + data.applicationName);
- console.info("deviceId:" + data.deviceId);
- console.info("codePath:" + data.codePath);
- console.info("resourcePath:" + data.resourcePath);
- console.info("libPath:" + data.libPath);
-
- console.info('queryAbilityInfo permissions length [' + data.permissions.length + ']');
- for (var j = 0; j < data.permissions.length; j++) {
- console.info("permissions[" + j + "]:" + data.permissions[j]);
- }
- console.info('queryAbilityInfo deviceTypes length [' + data.deviceTypes.length + ']');
- for (var j = 0; j < data.deviceTypes.length; j++) {
- console.info("deviceTypes[" + j + "]:" + data.deviceTypes[j]);
- }
- console.info('queryAbilityInfo deviceCapabilities length [' + data.deviceCapabilities.length + ']');
- for (var j = 0; j < data.deviceCapabilities.length; j++) {
- console.info("deviceCapabilities[" + j + "]:" + data.deviceCapabilities[j]);
- }
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- // ability type: 0:UNKNOWN, 1:PAGE, 2:SERVICE, 3:DATA
- console.info("type:" + data.type);
- // orientation: 0:UNSPECIFIED, 1:LANDSCAPE, 2:PORTRAIT, 3:FOLLOWRECENT,
- console.info("orientation:" + data.orientation);
- // launchMode: 0:SINGLETON, 1:SINGLETOP, 2:STANDARD
- console.info("launchMode:" + data.launchMode);
-
- // the enum of AbilityType
- console.info("AbilityType:" + bundle.AbilityType.UNKNOWN);
- console.info("AbilityType:" + bundle.AbilityType.PAGE);
- console.info("AbilityType:" + bundle.AbilityType.SERVICE);
- console.info("AbilityType:" + bundle.AbilityType.DATA);
- if (data.type == bundle.AbilityType.PAGE) {
- console.info("this AbilityType is PAGE");
- }
- // the enum of DisplayOrientation
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.UNSPECIFIED);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.LANDSCAPE);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.PORTRAIT);
- console.info("DisplayOrientation:" + bundle.DisplayOrientation.FOLLOWRECENT);
- if (data.orientation == bundle.DisplayOrientation.UNSPECIFIED) {
- console.info("this DisplayOrientation is UNSPECIFIED");
- }
- // the enum of LaunchMode
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETON);
- console.info("LaunchMode:" + bundle.LaunchMode.SINGLETOP);
- console.info("LaunchMode:" + bundle.LaunchMode.STANDARD);
- if (data.launchMode == bundle.LaunchMode.STANDARD) {
- console.info("this LaunchMode is STANDARD");
- }
-}
-```
-
-## bundle.getBundleArchiveInfo
-
-getBundleArchiveInfo(hapFilePath: string, bundleFlags: number): Promise\
-
-Obtains the bundle information from a given HAP file in asynchronous mode. This method uses a promise to return the result.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ----------- | ------ | ---- | ------------------------------------------------------------ |
-| hapFilePath | string | Yes| Path of the HAP file.|
-| bundleFlags | number | Yes| Type of information that will be returned. **0**: The default bundle information will be returned. **1**: The bundle information containing the ability information will be returned.|
-
-**Return value**
-
-| Type| Description|
-| -------------------- | ------------------------------------------ |
-| Promise\ | Promise used to return the bundle information.|
+| want | Want | Yes | Want that contains the bundle name. |
+| bundleFlags | number | Yes | Ability information to be returned. The default value is **0**. The value must be greater than or equal to 0.|
+| callback | AsyncCallback> | Yes | Callback used to return the ability information. |
**Example**
```js
-bundle.getBundleArchiveInfo('/data/test.hap', 1).then((data) => {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("vendor:" + data.vendor);
- console.info("versionCode:" + data.versionCode);
- console.info("versionName:" + data.versionName);
- console.info("jointUserId:" + data.jointUserId);
- console.info("minSdkVersion:" + data.minSdkVersion);
- console.info("maxSdkVersion:" + data.maxSdkVersion);
- console.info("mainEntry:" + data.mainEntry);
- console.info("cpuAbi:" + data.cpuAbi);
- console.info("appId:" + data.appId);
- console.info("compatibleVersion:" + data.compatibleVersion);
- console.info("targetVersion:" + data.targetVersion);
- console.info("releaseType:" + data.releaseType);
- console.info("uid:" + data.uid);
- console.info("gid:" + data.gid);
- console.info("seInfo:" + data.seInfo);
- console.info("entryModuleName:" + data.entryModuleName);
- console.info("isKeepAlive:" + data.isKeepAlive);
- console.info("isNativeApp:" + data.isNativeApp);
- console.info("installTime:" + data.installTime);
- console.info("updateTime:" + data.updateTime);
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- console.info('getBundleArchiveInfo reqPermissions length [' + data.reqPermissions.length + ']');
- for (var j = 0; j < data.reqPermissions.length; j++) {
- console.info("reqPermissions[" + j + "]:" + data.reqPermissions[j]);
- }
- console.info('getBundleArchiveInfo defPermissions length [' + data.defPermissions.length + ']');
- for (var j = 0; j < data.defPermissions.length; j++) {
- console.info("defPermissions[" + j + "]:" + data.defPermissions[j]);
- }
- console.info('getBundleArchiveInfo hapModuleNames length [' + data.hapModuleNames.length + ']');
- for (var j = 0; j < data.hapModuleNames.length; j++) {
- console.info("hapModuleNames[" + j + "]:" + data.hapModuleNames[j]);
- }
- console.info('getBundleArchiveInfo moduleNames length [' + data.moduleNames.length + ']');
- for (var j = 0; j < data.moduleNames.length; j++) {
- console.info("moduleNames[" + j + "]:" + data.moduleNames[j]);
- }
- console.info('getBundleArchiveInfo modulePublicDirs length [' + data.modulePublicDirs.length + ']');
- for (var j = 0; j < data.modulePublicDirs.length; j++) {
- console.info("modulePublicDirs[" + j + "]:" + data.modulePublicDirs[j]);
- }
- console.info('getBundleArchiveInfo moduleDirs length [' + data.moduleDirs.length + ']');
- for (var j = 0; j < data.moduleDirs.length; j++) {
- console.info("moduleDirs[" + j + "]:" + data.moduleDirs[j]);
- }
- console.info('getBundleArchiveInfo moduleResPaths length [' + data.moduleResPaths.length + ']');
- for (var j = 0; j < data.moduleResPaths.length; j++) {
- console.info("moduleResPaths[" + j + "]:" + data.moduleResPaths[j]);
- }
- console.info('getBundleArchiveInfo abilityInfo length [' + data.abilityInfos.length + ']');
- for (var j = 0; j < data.abilityInfos.length; j++) {
- console.info("abilityInfos[" + j + "]name:" + data.abilityInfos[j].name);
- console.info("abilityInfos[" + j + "]package:" + data.abilityInfos[j].package);
- }
+let bundleFlags = 0;
+let want = {
+ bundleName : "com.example.myapplication",
+ abilityName : "com.example.myapplication.MainAbility"
+};
+bundle.queryAbilityByWant(want, bundleFlags, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
})
```
-## bundle.getBundleArchiveInfo
-
-getBundleArchiveInfo(hapFilePath: string, bundleFlags: number, callback: AsyncCallback\): void
-
-Obtains the bundle information from a given HAP file in asynchronous mode. This method uses a callback to return the result.
-
-**Parameters**
-
-| Name| Type| Mandatory| Description|
-| ----------- | ------------------------- | ---- | ------------------------------------------------------------ |
-| hapFilePath | string | Yes| Path of the HAP file.|
-| bundleFlags | number | Yes| Type of information that will be returned. **0**: The default bundle information will be returned. **1**: The bundle information containing the ability information will be returned.|
-| callback | AsyncCallback | Yes| Callback used to return the bundle information.|
-
-**Example**
-
-```js
-bundle.getBundleArchiveInfo('/data/test.hap', 1, OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.info("name:" + data.name);
- console.info("label:" + data.label);
- console.info("description:" + data.description);
- console.info("vendor:" + data.vendor);
- console.info("versionCode:" + data.versionCode);
- console.info("versionName:" + data.versionName);
- console.info("jointUserId:" + data.jointUserId);
- console.info("minSdkVersion:" + data.minSdkVersion);
- console.info("maxSdkVersion:" + data.maxSdkVersion);
- console.info("mainEntry:" + data.mainEntry);
- console.info("cpuAbi:" + data.cpuAbi);
- console.info("appId:" + data.appId);
- console.info("compatibleVersion:" + data.compatibleVersion);
- console.info("targetVersion:" + data.targetVersion);
- console.info("releaseType:" + data.releaseType);
- console.info("uid:" + data.uid);
- console.info("gid:" + data.gid);
- console.info("seInfo:" + data.seInfo);
- console.info("entryModuleName:" + data.entryModuleName);
- console.info("isKeepAlive:" + data.isKeepAlive);
- console.info("isNativeApp:" + data.isNativeApp);
- console.info("installTime:" + data.installTime);
- console.info("updateTime:" + data.updateTime);
- console.info("appInfo.name:" + data.applicationInfo.name);
- console.info("appInfo.bundleName:" + data.applicationInfo.bundleName);
- console.info('getBundleArchiveInfo reqPermissions length [' + data.reqPermissions.length + ']');
- for (var j = 0; j < data.reqPermissions.length; j++) {
- console.info("reqPermissions[" + j + "]:" + data.reqPermissions[j]);
- }
- console.info('getBundleArchiveInfo defPermissions length [' + data.defPermissions.length + ']');
- for (var j = 0; j < data.defPermissions.length; j++) {
- console.info("defPermissions[" + j + "]:" + data.defPermissions[j]);
- }
- console.info('getBundleArchiveInfo hapModuleNames length [' + data.hapModuleNames.length + ']');
- for (var j = 0; j < data.hapModuleNames.length; j++) {
- console.info("hapModuleNames[" + j + "]:" + data.hapModuleNames[j]);
- }
- console.info('getBundleArchiveInfo moduleNames length [' + data.moduleNames.length + ']');
- for (var j = 0; j < data.moduleNames.length; j++) {
- console.info("moduleNames[" + j + "]:" + data.moduleNames[j]);
- }
- console.info('getBundleArchiveInfo modulePublicDirs length [' + data.modulePublicDirs.length + ']');
- for (var j = 0; j < data.modulePublicDirs.length; j++) {
- console.info("modulePublicDirs[" + j + "]:" + data.modulePublicDirs[j]);
- }
- console.info('getBundleArchiveInfo moduleDirs length [' + data.moduleDirs.length + ']');
- for (var j = 0; j < data.moduleDirs.length; j++) {
- console.info("moduleDirs[" + j + "]:" + data.moduleDirs[j]);
- }
- console.info('getBundleArchiveInfo moduleResPaths length [' + data.moduleResPaths.length + ']');
- for (var j = 0; j < data.moduleResPaths.length; j++) {
- console.info("moduleResPaths[" + j + "]:" + data.moduleResPaths[j]);
- }
- console.info('getBundleArchiveInfo abilityInfo length [' + data.abilityInfos.length + ']');
- for (var j = 0; j < data.abilityInfos.length; j++) {
- console.info("abilityInfos[" + j + "]name:" + data.abilityInfos[j].name);
- console.info("abilityInfos[" + j + "]package:" + data.abilityInfos[j].package);
- }
-}
-```
-
## bundle.getBundleInstaller
getBundleInstaller(): Promise
Obtains the bundle installer in asynchronous mode. This method uses a promise to return the result.
+**Required permissions**
+
+ohos.permission.INSTALL_BUNDLE
+
**Return value**
-| Type| Description|
+| Type | Description |
| ------------------------ | --------------------------------------------------- |
| Promise | Promise used to return the bundle installer.|
**Example**
```js
-bundle.getBundleInstaller().then((data) => {
- data.install(['/data/test.hap'], {
- param: {
- userId: 0,
- installFlag: 1,
- isKeepData: false
- }
- }, OnReceiveinstallEvent);
-
- function OnReceiveinstallEvent(err, data) {
- console.info("name: for begin");
- console.info("install result code:" + data.status);
- console.info("install result msg:" + data.statusMessage);
- }
+let bundleFilePaths = ['/data/test.hap'];
+let param = {
+ userId : 100,
+ installFlag : 1,
+ isKeepData : false
+};
+bundle.getBundleInstaller()
+.then((installerObject) => {
+ console.info('Operation successful. ');
+ installerObject.install(bundleFilePaths, param)
+ .then((data) => {
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ }).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+ })
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
})
```
@@ -1145,141 +535,401 @@ getBundleInstaller(callback: AsyncCallback): void;
Obtains the bundle installer in asynchronous mode. This method uses a callback to return the result.
+**Required permissions**
+
+ohos.permission.INSTALL_BUNDLE
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ------------------------------ | ---- | ------------------------------------------------- |
-| callback | AsyncCallback | Yes| Callback used to return the bundle installer.|
+| callback | AsyncCallback | Yes | Callback used to return the bundle installer.|
**Example**
```js
-bundle.getBundleInstaller((err, data)=>{
- data.uninstall('com.example.myapplication', {
- userId: 0,
- installFlag: 1,
- isKeepData: false
- }, OnReceiveinstallEvent);
-
- function OnReceiveinstallEvent(err, data) {
- console.info("name: for begin");
- console.info("uninstall result code:" + data.status);
- console.info("uninstall result msg:" + data.statusMessage);
- }
+let bundleFilePaths = ['/data/test.hap'];
+let param = {
+ userId : 100,
+ installFlag : 1,
+ isKeepData : false
+};
+bundle.getBundleInstaller((err, installerObject) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(installerObject));
+ installerObject.install(bundleFilePaths, param, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+ })
})
```
-## bundle.getAllShortcutInfo
-getAllShortcutInfo(bundleName: string): Promise>
+## bundle.getLaunchWantForBundle
+
+getLaunchWantForBundle(bundleName: string): Promise\
+
+Obtains the **Want** object that launches the specified application in asynchronous mode. This method uses a promise to return the result.
-Obtains the shortcut information of the specified bundle in asynchronous mode. This method uses a promise to return the result.
+**Required permissions**
+
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
-| bundleName | string | Yes| Bundle name.|
+| bundleName | string | Yes | Bundle name of the application.|
**Return value**
-| Type| Description|
-| ----------------------------- | ---------------------------------------------------- |
-| Promise\> | Promise used to return the shortcut information.|
+| Type | Description |
+| --------------------- | ------------------------------------------------------------ |
+| Promise\ | Promise used to return the **Want** object.|
**Example**
```js
-bundle.getAllShortcutInfo('com.example.third1').then((data) => {
- console.log("getAllShortcutInfo data:" + data);
-});
+let bundleName = "com.example.myapplication";
+bundle.getLaunchWantForBundle(bundleName)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+})
```
+## bundle.getLaunchWantForBundle
+getLaunchWantForBundle(bundleName: string, callback: AsyncCallback): void;
-## bundle.getAllShortcutInfo
+Obtains the **Want** object that launches the specified application in asynchronous mode. This method uses a callback to return the result.
-getAllShortcutInfo(bundleName: string, callback: AsyncCallback>): void
+**Required permissions**
-Obtains the shortcut information of the specified bundle in asynchronous mode. This method uses a callback to return the result.
+ohos.permission.GET\_BUNDLE\_INFO\_PRIVILEGED
**Parameters**
-| Name| Type| Mandatory| Description|
-| ---------- | ------------------------------------ | ---- | -------------------------------------------------- |
-| bundleName | string | Yes| Bundle name.|
-| callback | AsyncCallback<> | Yes| Callback used to return the shortcut information.|
+| Name | Type | Mandatory| Description |
+| ---------- | ------ | ---- | -------- |
+| bundleName | string | Yes | Bundle name of the application.|
+| callback | AsyncCallback\ | Yes | Callback used to return the **Want** object.|
**Example**
```js
-bundle.getAllShortcutInfo('com.example.third1', OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.log("getAllShortcutInfo data:" + data);
-}
+let bundleName = "com.example.myapplication";
+bundle.getLaunchWantForBundle(bundleName, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
-## bundle.checkPermission
-checkPermission(bundleName: string, permission: string): Promise\
+## bundle.getNameForUid
+
+getNameForUid(uid: number): Promise\
-Checks whether a bundle has the specified permission in asynchronous mode. This method uses a promise to return the result.
+Obtains the bundle name based on a UID in asynchronous mode. This method uses a promise to return the result.
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | ------ | ---- | -------- |
-| bundleName | string | Yes| Bundle name.|
-| permission | string | Yes| Permission name.|
+| uid | number | Yes | UID based on which the bundle name is to obtain.|
**Return value**
-| Type| Description|
+| Type | Description |
| --------------------- | ------------------------------------------------------------ |
-| Promise\ | Promise used to return the verification result. **-1**: The bundle does not have the specified permission. **0**: The bundle has the specified permission.|
+| Promise\ | Promise used to return the bundle name.|
**Example**
```js
-bundle.checkPermission('com.example.actsbmscheckpermissiontest', 'com.permission.CAMERA').then((data) => {
- console.log("checkPermission data:" + data);
-});
+let uid = 20010005;
+bundle.getNameForUid(uid)
+.then((data) => {
+ console.info('Operation successful. Data: ' + JSON.stringify(data));
+}).catch((error) => {
+ console.error('Operation failed. Cause: ' + JSON.stringify(error));
+})
```
-## bundle.checkPermission
+## bundle.getNameForUid
-checkPermission(bundleName: string, permission: string, callback: AsyncCallback\): void
+getNameForUid(uid: number, callback: AsyncCallback): void;
-Checks whether a bundle has the specified permission in asynchronous mode. This method uses a callback to return the result.
+Obtains the bundle name based on a UID in asynchronous mode. This method uses a callback to return the result.
**Parameters**
-| Name| Type| Mandatory| Description|
-| ---------- | --------------------------- | ---- | ------------------------------------------------------------ |
-| bundleName | string | Yes| Bundle name.|
-| permission | string | Yes| Permission name.|
-| callback | AsyncCallback\ | Yes| Callback used to return the verification result. **-1**: The bundle does not have the specified permission. **0**: The bundle has the specified permission.|
+| Name | Type | Mandatory| Description |
+| ---------- | ------ | ---- | -------- |
+| uid | number | Yes | UID based on which the bundle name is to obtain.|
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.|
**Example**
```js
-bundle.checkPermission('com.example.actsbmscheckpermissiontest', 'com.permission.CAMERA', OnReceiveEvent);
-
-function OnReceiveEvent(err, data) {
- console.log("checkPermission data:" + data);
-}
+let uid = 20010005;
+bundle.getNameForUid(uid, (err, data) => {
+ if (err) {
+ console.error('Operation failed. Cause: ' + JSON.stringify(err));
+ return;
+ }
+ console.info('Operation successful. Data:' + JSON.stringify(data));
+})
```
+
## ElementName
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | ------ | ---- | ------------------------------------------------------------ |
-| deviceId | Read-only| string | No| ID of the device that runs the ability.|
-| bundleName | Read-only| string | Yes| Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
-| abilityName | Read-only| string | Yes| Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
+| deviceId | Read-only | string | No | ID of the device that runs the ability. |
+| bundleName | Read-only | string | Yes | Bundle name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
+| abilityName | Read-only | string | Yes | Name of the ability. If both **bundleName** and **abilityName** are specified in a **Want**, the **Want** can directly match the specified ability.|
+| uri | Read-only | string | No | Resource ID.|
+| shortName | Read-only | string | No | Short name of the **ElementName**.|
## InstallStatus
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable| Type | Mandatory| Description |
| ------------- | -------- | ---------------- | ---- | ------------------------------------------------------------ |
-| status | Read-only| InstallErrorCode | Yes| Installation result code. SUCCESS = 0 STATUS_INSTALL_FAILURE = 1 STATUS_INSTALL_FAILURE_ABORTED = 2 STATUS_INSTALL_FAILURE_INVALID = 3 STATUS_INSTALL_FAILURE_CONFLICT = 4 STATUS_INSTALL_FAILURE_STORAGE = 5 STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6 STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C STATUS_ABILITY_NOT_FOUND = 0x40 STATUS_BMS_SERVICE_ERROR = 0x41 |
-| statusMessage | Read-only| string | Yes| Message indicating the installation result.|
+| status | Read-only | InstallErrorCode | Yes | Installation result code. SUCCESS = 0 STATUS_INSTALL_FAILURE = 1 STATUS_INSTALL_FAILURE_ABORTED = 2, STATUS_INSTALL_FAILURE_INVALID = 3 STATUS_INSTALL_FAILURE_CONFLICT = 4 STATUS_INSTALL_FAILURE_STORAGE = 5 STATUS_INSTALL_FAILURE_INCOMPATIBLE = 6 STATUS_UNINSTALL_FAILURE = 7 STATUS_UNINSTALL_FAILURE_BLOCKED = 8 STATUS_UNINSTALL_FAILURE_ABORTED = 9 STATUS_UNINSTALL_FAILURE_CONFLICT = 10 STATUS_INSTALL_FAILURE_DOWNLOAD_TIMEOUT = 0x0B STATUS_INSTALL_FAILURE_DOWNLOAD_FAILED = 0x0C STATUS_RECOVER_FAILURE_INVALID = 0x0D STATUS_ABILITY_NOT_FOUND = 0x40 STATUS_BMS_SERVICE_ERROR = 0x41 STATUS_FAILED_NO_SPACE_LEFT = 0x42 STATUS_GRANT_REQUEST_PERMISSIONS_FAILED = 0x43 STATUS_INSTALL_PERMISSION_DENIED = 0x44 STATUS_UNINSTALL_PERMISSION_DENIED = 0x45 |
+
+## BundleFlag
+
+Enumerates the bundle flags.
+
+| Name | Default Value| Description |
+| ------ | ------ | ------ |
+| GET_BUNDLE_DEFAULT | 0x00000000 | Obtains the default application information.|
+| GET_BUNDLE_WITH_ABILITIES | 0x00000001 | Obtains the bundle information with the ability information.|
+| GET_ABILITY_INFO_WITH_PERMISSION | 0x00000002 | Obtains the ability information with the permission information.|
+| GET_ABILITY_INFO_WITH_APPLICATION | 0x00000004 | Obtains the ability information with the application information.|
+| GET_APPLICATION_INFO_WITH_PERMISSION | 0x00000008 | Obtains the application information with the permission information.|
+| GET_BUNDLE_WITH_REQUESTED_PERMISSION | 0x00000010 | Obtains the bundle information with the information about the required permissions.|
+| GET_ABILITY_INFO_WITH_METADATA | 0x00000020 | Obtains the ability metadata information.|
+| GET_APPLICATION_INFO_WITH_METADATA | 0x00000040 | Obtains the application metadata information.|
+| GET_ABILITY_INFO_SYSTEMAPP_ONLY | 0x00000080 | Obtains only the ability information with information about system applications.|
+| GET_ABILITY_INFO_WITH_DISABLE | 0x00000100 | Obtains information about disabled abilities.|
+| GET_APPLICATION_INFO_WITH_DISABLE | 0x00000200 | Obtains information about disabled applications.|
+| GET_ALL_APPLICATION_INFO | 0xFFFF0000 | Obtains all application information.|
+
+## BundleOptions
+
+Describes the bundle options.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| userId | number | Yes| Yes| User ID. The default value is the user ID of the caller. The value must be greater than or equal to 0.|
+| networkId | string | Yes| Yes| Network ID. The default value is **null**.|
+
+## BundleInfo
+
+Describes the application bundle 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 is installed. |
+| updateTime | number | Yes | No | Time when the HAP file is updated. |
+| appInfo | ApplicationInfo | Yes | No | Application configuration information. |
+| abilityInfo | Array | Yes | No | Ability configuration information. |
+| reqPermissions | Array | Yes | No | Array of the permissions to request from the system. |
+| reqPermissionDetails | Array | 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**. |
+| hapModuleInfo | Array | 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 to install the bundle 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.|
+| reqPermissionStates | Array | Yes| No| Permission grant state.|
+
+## ApplicationInfo
+
+Describes the application information.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| name | string | Yes | No | Application name. |
+| description | string | Yes | No | Application description. |
+| descriptionId | number | Yes | No | Application description ID. |
+| systemApp | boolean | Yes | No | Whether the application is a system application. The default value is **false**. |
+| enabled | boolean | Yes | No | Whether the application is enabled. The default value is **true**. |
+| label | string | Yes | No | Application label. |
+| labelId | string | Yes | No | Application label ID. |
+| icon | string | Yes | No | Application icon. |
+| iconId | string | Yes | No | Application icon ID. |
+| process | string | Yes | No | Process in which this application runs. If this parameter is not set, the bundle name is used by default.|
+| 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. |
+| moduleInfos | Array | Yes | No | Application module information. |
+| entryDir | string | Yes | No | Path for storing application files. |
+| customizeData | Map> | Yes | Yes | Custom data of the application. |
+| codePath | string | Yes| No| Installation directory of the application.|
+| metaData | Map> | Yes| No| Custom metadata of the application.|
+| removable | boolean | Yes| No| Whether the application is removable.|
+| accessTokenId | number | Yes| No| Access token ID of the application.|
+| uid | number | Yes| No| UID of the application.|
+
+## ModuleInfo
+
+Describes the application module information.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| moduleName | string | Yes | No | Module name.|
+| moduleSourceDir | string | Yes | No | Installation directory.|
+
+## CustomizeData
+
+Describes the custom metadata.
+
+| Name | Type | Readable| Writable| Description |
+| ----- | ------ | ---- | ---- | ---------------- |
+| name | string | Yes | Yes | Custom metadata name.|
+| value | string | Yes | Yes | Custom metadata value. |
+| extra | string | Yes | Yes | Custom resources. |
+
+
+## HapModuleInfo
+
+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 | Modes supported by the module. |
+| reqCapabilities | Array | Yes | No | Capabilities required for module running.|
+| deviceTypes | Array | Yes | No | An array of supported device types.|
+| abilityInfo | Array | Yes | No | Ability information. |
+| moduleName | string | Yes | No | Module name. |
+| mainAbilityName | string | Yes | No | Name of the entry ability. |
+| installationFree | boolean | Yes | No | Whether installation-free is supported. |
+| mainElementName | string | Yes| No| Information about the entry ability.|
+
+## ReqPermissionDetail
+
+Describes the detailed information of the permissions to request from the system.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| name | string | Yes | Yes | Name of the permission to request. |
+| reason | string | Yes | Yes | Reason for requesting the permission. |
+| usedScene | UsedScene | Yes| Yes| Application scenario and timing for using the permission.|
+
+## UsedScene
+
+Describes the application scenario and timing for using the permission.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| abilities | Array | Yes | Yes | Abilities that use the permission.|
+| when | string | Yes | Yes | Time when the permission is used. |
+
+
+## AbilityInfo
+
+Describes ability information.
+
+| Name | Type| Readable| Writable| Description|
+| ------ | ------ | ------ | ------ | ------ |
+| bundleName | string | Yes | No | Application bundle name. |
+| name | string | Yes | No | Ability name. |
+| label | string | Yes | No | Ability name visible to users. |
+| description | string | Yes | No | Ability description. |
+| icon | string | Yes | No | Index of the ability icon resource file. |
+| descriptionId | number | Yes | No | Ability description ID. |
+| iconId | number | Yes | No | Ability icon ID. |
+| moduleName | string | Yes | No | Name of the HAP file to which the ability belongs. |
+| process | string | Yes | No | Process in which this ability runs. If this parameter is not set, the bundle name is used by default.|
+| targetAbility | string | Yes | No | Target ability that this ability alias points to. |
+| backgroundModes | number | Yes | No | Background service mode of the ability. |
+| isVisible | boolean | Yes | No | Whether the ability can be called by other applications. |
+| formEnabled | boolean | Yes | No | Whether the ability provides the service widget capability. |
+| type | AbilityType | Yes | No | Ability type. |
+| orientation | DisplayOrientation | Yes | No | Ability display orientation. |
+| launchMode | LaunchMode | Yes | No | Ability launch mode. |
+| permissions | Array | Yes | No | Permissions required for other applications to call the ability.|
+| deviceTypes | Array | Yes | No | Device types supported by the ability. |
+| deviceCapabilities | Array | Yes | No | Device capabilities required for the ability. |
+| readPermission | string | Yes | No | Permission required for reading the ability data. |
+| writePermission | string | Yes | No | Permission required for writing data to the ability. |
+| applicationInfo | ApplicationInfo | Yes | No | Application configuration information. |
+| formEntity | number | Yes | No | Area where the ability form can be displayed. |
+| minFormHeight | number | Yes | No | Minimum height of the ability form. |
+| defaultFormHeight | number | Yes | No | Default height of the ability form. |
+| minFormWidth | number | Yes | No | Minimum width of the ability form. |
+| defaultFormWidth | number | Yes | No | Default width of the ability form. |
+| uri | string | Yes | No | URI of the ability. |
+| customizeData | Map> | Yes | Yes | Custom data of the ability. |
+| labelId | number | Yes | No | Ability label ID. |
+| subType | AbilitySubType | Yes | No | Subtype of the template that can be used by the ability. |
+| metaData | Array | Yes| No| Custom metadata of the ability.|
+| enabled | boolean | Yes| No| Whether the ability is enabled.|
+
+## AbilityType
+
+Describes the ability type.
+
+| Name | Type| Description |
+| ------- | ---- | --------------------------- |
+| UNKNOWN | None | Unknown ability type. |
+| PAGE | None | Ability that has a UI. |
+| SERVICE | None | Ability that does not have a UI. |
+| DATA | None | Ability that is used to provide data access services.|
+
+## DisplayOrientation
+
+Describes the display orientation.
+
+| Name | Type| Description |
+| ------------- | ---- | ------------------------ |
+| UNSPECIFIED | None | The system automatically determines the display orientation. |
+| LANDSCAPE | None | Landscape orientation. |
+| PORTRAIT | None | Portrait orientation. |
+| FOLLOW_RECENT | None | The page ability orientation is the same as that of the nearest ability in the stack.|
+
+## LaunchMode
+
+Describes the launch mode.
+
+| Name | Type| Description |
+| ----------- | ---- | ------------------- |
+| UNSPECIFIED | 0 | The ability has only one instance.|
+| STANDARD | 1 | The ability can have multiple instances. |
+
+## AbilitySubType
+
+Describes the ability subtype.
+
+| Name | Type| Description |
+| ----------- | ---- | ----------------------------- |
+| UNSPECIFIED | 0 | Undefined ability subtype. |
+| CA | 1 | Ability that has a UI.|
diff --git a/en/application-dev/reference/apis/js-apis-Context.md b/en/application-dev/reference/apis/js-apis-Context.md
index 3687d1cea2288447a3fa87e34b8edb8f9403bbba..ea7efb523f253f83fec2133b7a9acb37ddd5727d 100644
--- a/en/application-dev/reference/apis/js-apis-Context.md
+++ b/en/application-dev/reference/apis/js-apis-Context.md
@@ -25,12 +25,16 @@ Obtains the local root directory of the application. This method uses a callback
If this method is called for the first time, a root directory is created.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the local root directory of the application.|
+| callback | AsyncCallback\ | Yes | Callback used to return the local root directory of the application.|
**Example**
@@ -52,9 +56,13 @@ Obtains the local root directory of the application. This method uses a promise
If this method is called for the first time, a root directory is created.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ---------------------- |
| Promise\ | Promise used to return the local root directory of the application.|
@@ -63,8 +71,8 @@ If this method is called for the first time, a root directory is created.
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
-context.getOrCreateLocalDir().then((void) => {
- console.info("==========================>getOrCreateLocalDirCallback=======================>");
+context.getOrCreateLocalDir().then((data) => {
+ console.info("data=" + data);
});
```
@@ -76,14 +84,18 @@ verifyPermission(permission: string, options: PermissionOptions, callback: Async
Verifies whether a specific PID and UID have the given permission. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| ---------- | --------------------------------------- | ---- | ------------------------------------- |
-| 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.|
+| 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.|
**Example**
@@ -91,9 +103,9 @@ Verifies whether a specific PID and UID have the given permission. This method u
import featureAbility from '@ohos.ability.featureAbility'
import bundle from '@ohos.bundle'
var context = featureAbility.getContext();
-var datainfo = await bundle.getBundleInfo('com.context.test',1);
-context.verifyPermission("com.example.permission",datainfo.uid)
-
+bundle.getBundleInfo('com.context.test', 1, (datainfo) =>{
+ context.verifyPermission("com.example.permission", datainfo.uid);
+});
```
@@ -107,10 +119,10 @@ Verifies whether the current PID and UID have the given permission. This method
**Parameters**
-| Name| Type| Mandatory| Description|
+| 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.|
+| 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.|
**Example**
@@ -126,17 +138,21 @@ verifyPermission(permission: string, options?: PermissionOptions): 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.|
@@ -146,8 +162,9 @@ Verifies whether a specific PID and UID have the given permission. This method u
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
var Permission = context.PermissionOptions(1,1);
-context.getOrCreateLocalDir('com.context.permission',Permission).then((void) => {
- console.info("==========================>verifyPermissionCallback=======================>");
+context.verifyPermission('com.context.permission',Permission).then((data) => {
+ console.info("======================>verifyPermissionCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
});
```
@@ -159,26 +176,33 @@ requestPermissionsFromUser(permissions: Array\, requestCode: number, res
Requests certain permissions from the system. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------------- | ------------------------------------------------------------ | ---- | ----------------------------------------------- |
-| permissions | Array\ | Yes| Permissions to request. This parameter cannot be **null**.|
-| requestCode | number | Yes| Request code to be passed to **PermissionRequestResult**.|
-| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes| Permission request result.|
+| permissions | Array\ | Yes | Permissions to request. This parameter cannot be **null**. |
+| requestCode | number | Yes | Request code to be passed to **PermissionRequestResult**.|
+| resultCallback | AsyncCallback<[PermissionRequestResult](#permissionrequestresult)> | Yes | Permission request result. |
**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
-context.getOrCreateLocalDir(
+context.requestPermissionsFromUser(
["com.example.permission1",
"com.example.permission2",
"com.example.permission3",
"com.example.permission4",
"com.example.permission5"],
- 1,
+ 1,(err, data)=>{
+ console.info("====>requestdata====>" + JSON.stringify(data));
+ console.info("====>requesterrcode====>" + JSON.stringify(err.code));
+ }
)
```
@@ -190,11 +214,15 @@ getApplicationInfo(callback: AsyncCallback\)
Obtains information about the current application. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ------------------------------- | ---- | ------------------------ |
-| callback | AsyncCallback\ | Yes| Callback used to return the application information.|
+| callback | AsyncCallback\ | Yes | Callback used to return the application information.|
**Example**
@@ -212,9 +240,13 @@ getApplicationInfo(): Promise\
Obtains information about the current application. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| ------------------------- | ------------------ |
| Promise\ | Promise used to return the application information.|
@@ -223,8 +255,9 @@ Obtains information about the current application. This method uses a promise to
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
-context.getApplicationInfo().then((void) => {
- console.info("==========================>getApplicationInfoCallback=======================>");
+context.getApplicationInfo().then((data) => {
+ console.info("=====================>getApplicationInfoCallback===================>");
+ console.info("====>data====>" + JSON.stringify(data));
});
```
@@ -236,11 +269,15 @@ getBundleName(callback: AsyncCallback\): void
Obtains the bundle name of the current ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ----------------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the bundle name.|
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.|
**Example**
@@ -258,9 +295,13 @@ getBundleName(): Promise\
Obtains the bundle name of the current ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | ------------------------- |
| Promise\ | Promise used to return the bundle name.|
@@ -269,8 +310,9 @@ Obtains the bundle name of the current ability. This method uses a promise to re
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
-context.getBundleName().then((void) => {
- console.info("==========================>getBundleNameCallback=======================>");
+context.getBundleName().then((data) => {
+ console.info("=======================>getBundleNameCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
});
```
@@ -282,11 +324,15 @@ getProcessInfo(callback: AsyncCallback\)
Obtains information about the current process, including the PID and process name. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | -------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the process information.|
+| callback | AsyncCallback\ | Yes | Callback used to return the process information.|
**Example**
@@ -304,9 +350,13 @@ getProcessInfo(): Promise\
Obtains information about the current process, including the PID and process name. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| --------------------- | -------------- |
| Promise\ | Promise used to return the process information.|
@@ -315,8 +365,9 @@ Obtains information about the current process, including the PID and process nam
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
-context.getProcessInfo().then((void) => {
- console.info("==========================>getProcessInfoCallback=======================>");
+context.getProcessInfo().then((data) => {
+ console.info("=======================>getProcessInfoCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
});
```
@@ -330,11 +381,15 @@ Obtains the **ohos.bundle.ElementName** object of the current ability. This meth
This method is available only to Page abilities.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | --------------------------- | ---- | ---------------------------------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the **ohos.bundle.ElementName** object.|
+| callback | AsyncCallback\ | Yes | Callback used to return the **ohos.bundle.ElementName** object.|
**Example**
@@ -354,9 +409,13 @@ Obtains the **ohos.bundle.ElementName** object of the current ability. This meth
This method is available only to Page abilities.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| --------------------- | ------------------------------------------ |
| Promise\ | Promise used to return the **ohos.bundle.ElementName** object.|
@@ -365,8 +424,9 @@ This method is available only to Page abilities.
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
-context.getElementName().then((void) => {
- console.info("==========================>getElementNameCallback=======================>");
+context.getElementName().then((data) => {
+ console.info("=======================>getElementNameCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
});
```
@@ -376,9 +436,13 @@ getProcessName(callback: AsyncCallback\): void
Obtains the name of the current process. This method uses a callback to return the result.
-| Name| Type| Mandatory| Description|
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | -------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the process name.|
+| callback | AsyncCallback\ | Yes | Callback used to return the process name.|
**Example**
@@ -396,9 +460,13 @@ getProcessName(): Promise\
Obtains the name of the current process. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| ---------------- | -------------------- |
| Promise\ | Promise used to return the process name.|
@@ -407,8 +475,9 @@ Obtains the name of the current process. This method uses a promise to return th
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
-context.getProcessName().then((void) => {
- console.info("==========================>getProcessNameCallback=======================>");
+context.getProcessName().then((data) => {
+ console.info("=======================>getProcessNameCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
});
```
@@ -420,11 +489,15 @@ getCallingBundle(callback: AsyncCallback\): void
Obtains the bundle name of the calling ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Parameters**
-| Name| Type| Mandatory| Description|
+| Name | Type | Mandatory| Description |
| -------- | ---------------------- | ---- | ------------------------- |
-| callback | AsyncCallback\ | Yes| Callback used to return the bundle name.|
+| callback | AsyncCallback\ | Yes | Callback used to return the bundle name.|
**Example**
@@ -442,9 +515,13 @@ getCallingBundle(): Promise\
Obtains the bundle name of the calling ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
**Return value**
-| Type| Description|
+| Type | Description |
| --------------- | ------------------------- |
| Promise\ | Promise used to return the bundle name.|
@@ -453,22 +530,23 @@ Obtains the bundle name of the calling ability. This method uses a promise to re
```js
import featureAbility from '@ohos.ability.featureAbility'
var context = featureAbility.getContext();
-context.getCallingBundle().then((void) => {
- console.info("==========================>getCallingBundleCallback=======================>");
+context.getCallingBundle().then((data) => {
+ console.info("======================>getCallingBundleCallback====================>");
+ console.info("====>data====>" + JSON.stringify(data));
});
```
## PermissionOptions
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name| Readable/Writable| Type | Mandatory| Description |
| ---- | -------- | ------ | ---- | ------ |
-| pid | Read-only| number | No| PID.|
-| uid | Read-only| number | No| UID.|
+| pid | Read-only | number | No | PID. System capabilities: SystemCapability.Ability.AbilityRuntime.Core|
+| uid | Read-only | number | No | UID. System capabilities: SystemCapability.Ability.AbilityRuntime.Core|
## PermissionRequestResult
-| Name| Readable/Writable| Type| Mandatory| Description|
+| Name | Readable/Writable| Type | Mandatory| Description |
| ----------- | -------- | -------------- | ---- | ------------------ |
-| requestCode | Read-only| number | Yes| Request code passed.|
-| permissions | Read-only| Array\ | Yes| Permissions passed.|
-| authResults | Read-only| Array\ | Yes| Permission request result.|
+| requestCode | Read-only | number | Yes | Request code passed. System capabilities: SystemCapability.Ability.AbilityRuntime.Core|
+| permissions | Read-only | Array\ | Yes | Permissions passed. System capabilities: SystemCapability.Ability.AbilityRuntime.Core |
+| authResults | Read-only | Array\ | Yes | Permission request result. System capabilities: SystemCapability.Ability.AbilityRuntime.Core |
diff --git a/en/application-dev/reference/apis/js-apis-DataUriUtils.md b/en/application-dev/reference/apis/js-apis-DataUriUtils.md
index 4aa00cd0b3c9caa6c12a89b5fc5b629bdf6abc4d..b45c839bc405c3cd65bbebe2f029e9930d8074ee 100644
--- a/en/application-dev/reference/apis/js-apis-DataUriUtils.md
+++ b/en/application-dev/reference/apis/js-apis-DataUriUtils.md
@@ -27,7 +27,6 @@ Obtains the ID attached to the end of a given URI.
**Example**
```js
-import dataUriUtils from '@ohos.ability.datauriutils'
dataUriUtils.getIdSync("com.example.dataUriUtils/1221")
```
@@ -55,10 +54,9 @@ Attaches an ID to the end of a given URI.
**Example**
```js
-import dataUriUtils from '@ohos.ability.datauriutils'
var idint = 1122;
dataUriUtils.attachId(
- "com.example.dataUriUtils"
+ "com.example.dataUriUtils",
idint,
)
```
@@ -85,7 +83,6 @@ Deletes the ID from the end of a given URI.
**Example**
```js
-import dataUriUtils from '@ohos.ability.datauriutils'
dataUriUtils.deleteId("com.example.dataUriUtils/1221")
```
@@ -112,10 +109,9 @@ Updates the ID in a given URI.
**Example**
```js
-import dataUriUtils from '@ohos.ability.datauriutils'
var idint = 1122;
dataUriUtils.updateId(
- "com.example.dataUriUtils"
- idint,
+ "com.example.dataUriUtils",
+ idint
)
```
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 5d85731dc2ee337581c5fa38d7d52d60170675d4..7652774178a2357e7a8cb5928545f80348d1c2d2 100644
--- a/en/application-dev/reference/apis/js-apis-ability-context.md
+++ b/en/application-dev/reference/apis/js-apis-ability-context.md
@@ -1,12 +1,29 @@
# AbilityContext
->  **Note:**
-> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
+>  **NOTE**
+> The initial APIs of this module are supported since API 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
Implements the ability context. This module is inherited from **Context**.
+## Usage
+
+
+Before using the **AbilityContext** module, you must define a child class that inherits from **Ability**.
+
+
+
+```
+import Ability from '@ohos.application.Ability'
+class MainAbility extends Ability {
+ onWindowStageCreate(windowStage) {
+ let context = this.context;
+ }
+}
+```
+
+
## Attributes
| Name| Type| Readable| Writable| Description|
@@ -21,6 +38,10 @@ startAbility(want: Want, callback: AsyncCallback<void>): void
Starts an ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
@@ -42,14 +63,53 @@ Starts an ability. This method uses a callback to return the result.
## startAbility
-startAbility(want: Want): Promise<void>;
+startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void>): void
+
+Starts an ability. This method uses a callback to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | want | [Want](js-apis-featureAbility.md#Want) | Yes| Information about the **Want** used for starting an ability.|
+ | options | StartOptions | Yes| Parameters used for starting the ability.|
+ | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
+
+- Example
+
+ ```
+ var want = {
+ "deviceId": "",
+ "bundleName": "com.extreme.test",
+ "abilityName": "com.extreme.test.MainAbility"
+ };
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbility(want, options, (error) => {
+ console.log("error.code = " + error.code)
+ })
+ ```
+
+
+## startAbility
+
+startAbility(want: Want, options: StartOptions): Promise<void>;
Starts an ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
+ | options | StartOptions | Yes| Parameters used for starting the ability.|
- Return value
| Type| Description|
@@ -63,7 +123,10 @@ Starts an ability. This method uses a promise to return the result.
"bundleName": "com.extreme.test",
"abilityName": "com.extreme.test.MainAbility"
};
- this.context.startAbility(want)
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbility(want, options)
.then((data) => {
console.log('Operation successful.')
}).catch((error) => {
@@ -78,11 +141,15 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>):
Starts an ability. This method uses a callback to return the execution result when the ability is terminated.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
- | callback | Callback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.|
+ | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.|
- Example
@@ -96,17 +163,55 @@ Starts an ability. This method uses a callback to return the execution result wh
);
```
+## startAbilityForResult
+
+startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback<AbilityResult>): void;
+
+Starts an ability. This method uses a callback to return the execution result when the ability is terminated.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | want |[Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
+ | options | StartOptions | Yes| Parameters used for starting the ability.|
+ | callback | AsyncCallback<[AbilityResult](js-apis-featureAbility.md#abilityresult)> | Yes| Callback used to return the result.|
+
+
+- Example
+ ```
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbilityForResult(
+ {bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options,
+ (error, result) => {
+ console.log("startAbilityForResult AsyncCallback is called, error.code = " + error.code)
+ console.log("startAbilityForResult AsyncCallback is called, result.resultCode = " + result.resultCode)
+ }
+ );
+ ```
+
## startAbilityForResult
-startAbilityForResult(want: Want): Promise<AbilityResult>;
+startAbilityForResult(want: Want, options: StartOptions): Promise<AbilityResult>;
Starts an ability. This method uses a promise to return the execution result when the ability is terminated.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
+ | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the **Want** used for starting an ability.|
+ | options | StartOptions | Yes| Parameters used for starting the ability.|
+
- Return value
| Type| Description|
@@ -115,7 +220,10 @@ Starts an ability. This method uses a promise to return the execution result whe
- Example
```
- this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}).then((result) => {
+ var options = {
+ windowMode: 0,
+ };
+ this.context.startAbilityForResult({bundleName: "com.extreme.myapplication", abilityName: "MainAbilityDemo2"}, options).then((result) => {
console.log("startAbilityForResult Promise.resolve is called, result.resultCode = " + result.resultCode)
}, (error) => {
console.log("startAbilityForResult Promise.Reject is called, error.code = " + error.code)
@@ -129,16 +237,20 @@ terminateSelf(callback: AsyncCallback<void>): void;
Terminates this ability. This method uses a callback to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
- | callback | AsyncCallback<void> | No| Callback used to return the result indicating whether the method is successfully called.|
+ | callback | AsyncCallback<void> | Yes| Callback used to return the result indicating whether the method is successfully called.|
- Example
```
this.context.terminateSelf((err) => {
- console.log('terminateSelf result:' + JSON.stringfy(err);
- }
+ console.log('terminateSelf result:' + JSON.stringfy(err));
+ });
```
@@ -148,6 +260,10 @@ terminateSelf(): Promise<void>;
Terminates this ability. This method uses a promise to return the result.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Return value
| Type| Description|
| -------- | -------- |
@@ -157,7 +273,7 @@ Terminates this ability. This method uses a promise to return the result.
```
this.context.terminateSelf(want).then((data) => {
console.log('success:' + JSON.stringfy(data));
- )).catch((error) => {
+ }).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
});
```
@@ -169,11 +285,15 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi
Terminates this ability. This method uses a callback to return the information to the caller of **startAbilityForResult**.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| parameter | [AbilityResult](js-apis-featureAbility.md#abilityresult) | Yes| Information returned to the caller.|
- | callback | Callback<void> | No| Callback used to return the information.|
+ | callback | AsyncCallback<void> | Yes| Callback used to return the result.|
- Example
```
@@ -194,6 +314,10 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
Terminates this ability. This method uses a promise to return information to the caller of **startAbilityForResult**.
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
- Parameters
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
@@ -215,3 +339,157 @@ Terminates this ability. This method uses a promise to return information to the
}
)
```
+
+
+## startAbilityByCall
+
+startAbilityByCall(want: Want): Promise<Caller>;
+
+Obtains the caller interface of the specified ability, and if the specified ability is not started, starts the ability in the background.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | want | [Want](js-apis-featureAbility.md#Want)| Yes| Information about the ability to start, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, the local ability will be started.|
+
+- Return value
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<> | Promise used to return the caller object to communicate with.|
+
+- Example
+
+ ```
+ import Ability from '@ohos.application.Ability';
+ var caller;
+ export default class MainAbility extends Ability {
+ onWindowStageCreate(windowStage) {
+ this.context.startAbilityByCall({
+ bundleName: "com.example.myservice",
+ abilityName: "com.example.myservice.MainAbility",
+ deviceId: ""
+ }).then((obj) => {
+ caller = obj;
+ console.log('Caller GetCaller Get ' + call);
+ }).catch((e) => {
+ console.log('Caller GetCaller error ' + e);
+ });
+ }
+ }
+ ```
+
+
+## requestPermissionsFromUser
+
+requestPermissionsFromUser(permissions: Array<string>, requestCallback: AsyncCallback<PermissionRequestResult>) : void;
+
+Requests permissions from the user by displaying a pop-up window. This method uses a callback to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | 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 method is successfully called.|
+
+- Example
+
+ ```
+ this.context.requestPermissionsFromUser(permissions,(result) => {
+ console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
+ });
+ ```
+
+
+## requestPermissionsFromUser
+
+requestPermissionsFromUser(permissions: Array<string>) : Promise<PermissionRequestResult>;
+
+Requests permissions from the user by displaying a pop-up window. This method uses a promise to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | permissions | Array<string> | Yes| Permissions to request.|
+
+- Return value
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<[PermissionRequestResult](js-apis-permissionrequestresult.md)> | Promise used to return the result indicating whether the method is successfully called.|
+
+- Example
+
+ ```
+ this.context.requestPermissionsFromUser(permissions).then((data) => {
+ console.log('success:' + JSON.stringfy(data));
+ }).catch((error) => {
+ console.log('failed:' + JSON.stringfy(error));
+ });
+ ```
+
+
+## setMissionLabel
+
+setMissionLabel(label: string, callback:AsyncCallback<void>): void;
+
+Sets the label of the ability displayed in the task. This method uses a callback to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | 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 method is successfully called.|
+
+- Example
+
+ ```
+ this.context.setMissionLabel("test",(result) => {
+ console.log('requestPermissionsFromUserresult:' + JSON.stringfy(result));
+ });
+ ```
+
+
+## setMissionLabel
+
+setMissionLabel(label: string): Promise<void>
+
+Sets the label of the ability displayed in the task. This method uses a promise to return the result.
+
+**System capabilities**
+
+SystemCapability.Ability.AbilityRuntime.Core
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | -------- | -------- | -------- | -------- |
+ | label | string | Yes| Label of the ability to set.|
+
+- Return value
+ | Type| Description|
+ | -------- | -------- |
+ | Promise<void> | Promise used to return the result indicating whether the method is successfully called.|
+
+- Example
+
+ ```
+ this.context.setMissionLabel("test").then((data) => {
+ console.log('success:' + JSON.stringfy(data));
+ }).catch((error) => {
+ console.log('failed:' + JSON.stringfy(error));
+ });
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
index b69cb0e03eb33b0e683d773b4bdcb5a379bb6a41..8a747168fbe34c82c02c7233881a1461da2706c5 100644
--- a/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
+++ b/en/application-dev/reference/apis/js-apis-abilityAccessCtrl.md
@@ -217,3 +217,12 @@ promise.then(data => {
console.log(`promise: data->${JSON.stringify(data)}`);
});
```
+
+### GrantStatus
+
+Enumerates the permission grant states.
+
+| Name| Default Value| Description|
+| ----------------------------- | ---------------------- | ----------------------- |
+| PERMISSION_DENIED | -1 | Permission denied.|
+| PERMISSION_GRANTED | 0 | Permission granted.|
diff --git a/en/application-dev/reference/apis/js-apis-appAccount.md b/en/application-dev/reference/apis/js-apis-appAccount.md
index f8f6d6d65bc10a819d5ff85b562d9910e47d7b5d..be6cd158135e72fe8fa598c930fd1bf15e3ddd04 100644
--- a/en/application-dev/reference/apis/js-apis-appAccount.md
+++ b/en/application-dev/reference/apis/js-apis-appAccount.md
@@ -1,6 +1,7 @@
-# Application Account Management
+# App Account Management
->  **Note:**
+>  **NOTE**
+>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
@@ -11,6 +12,11 @@ import account_appAccount from '@ohos.account.appAccount';
```
+## System Capabilities
+
+SystemCapability.Account.AppAccount
+
+
## account_appAccount.createAppAccountManager
createAppAccountManager(): AppAccountManager;
@@ -29,13 +35,13 @@ Creates an **AppAccountManager** instance.
## AppAccountManager
-Provides methods to manage application accounts.
+Provides methods to manage app accounts.
### addAccount
addAccount(name: string, callback: AsyncCallback<void>): void;
-Adds an application account to the account management service. This method uses an asynchronous callback to return the result.
+Adds an app account to the account management service. This method uses an asynchronous callback to return the result.
Required permission: none.
@@ -43,8 +49,8 @@ Required permission: none.
| Name| Type| Mandatory| Description|
| -------- | ------------------- | ---- | ------------------------------------------ |
- | name | string | Yes| Name of the application account to add.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when the application account is added.|
+ | name | string | Yes| Name of the app account to add.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when the app account is added.|
- Example
@@ -59,7 +65,7 @@ Required permission: none.
addAccount(name: string, extraInfo: string, callback: AsyncCallback<void>): void;
-Adds an application account and its additional information to the account management service. This method uses an asynchronous callback to return the result.
+Adds an app account and its additional information to the account management service. This method uses an asynchronous callback to return the result.
Required permission: none.
@@ -67,9 +73,9 @@ Required permission: none.
| Name| Type| Mandatory| Description|
| --------- | ------------------- | ---- | ------------------------------------------------------------ |
- | name | string | Yes| Name of the application account to add.|
- | extraInfo | string | Yes| Additional information (for example, token) of the application account to add. The additional information cannot contain sensitive information about the application account.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when the application account and its additional information are added.|
+ | name | string | Yes| Name of the app account to add.|
+ | extraInfo | string | Yes| Additional information (for example, token) of the app account to add. The additional information cannot contain sensitive information about the app account.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when the app account and its additional information are added.|
- Example
@@ -86,7 +92,7 @@ Required permission: none.
addAccount(name: string, extraInfo?: string): Promise<void>;
-Adds an application account and its additional information to the account management service. This method uses a promise to return the result asynchronously.
+Adds an app account and its additional information to the account management service. This method uses a promise to return the result.
Required permission: none.
@@ -94,8 +100,8 @@ Required permission: none.
| Name| Type| Mandatory| Description|
| --------- | ------ | ---- | ------------------------------------------------------------ |
- | name | string | Yes| Name of the application account to add.|
- | extraInfo | string | Yes| Additional information of the application account to add. The additional information cannot contain sensitive information about the application account.|
+ | name | string | Yes| Name of the app account to add.|
+ | extraInfo | string | Yes| Additional information of the app account to add. The additional information cannot contain sensitive information about the app account.|
- Return value
@@ -114,18 +120,59 @@ Required permission: none.
});
```
+### addAccountImplicitly8+
+
+addAccountImplicitly(owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;
+
+Implicitly adds an app account based on the specified account owner, authentication type, and options. This method uses an asynchronous callback to return the result.
+
+Required permission: none.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | --------------------- | --- | -------------------------- |
+ | owner | string | Yes| Bundle name of the app account to add.|
+ | authType | string | Yes| Authentication type of the app account to add.|
+ | options | {[key: string]: any} | Yes| Options for the authentication.|
+ | callback | AuthenticatorCallback | Yes| Authenticator callback invoked to return the authentication result.|
+
+- Example
+
+ ```
+ import featureAbility from '@ohos.ability.featureAbility';
+
+ function onResultCallback(code, result) {
+ console.log("resultCode: " + code);
+ console.log("result: " + JSON.stringify(result));
+ }
+
+ function onRequestRedirectedCallback(request) {
+ let abilityStartSetting = {want: request};
+ featureAbility.startAbility(abilityStartSetting, (err)=>{
+ console.log("startAbility err: " + JSON.stringify(err));
+ });
+ }
+
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.addAccountImplicitly("LiSi", "readAge", {}, {
+ onResult: onResultCallback,
+ onRequestRedirected: onRequestRedirectedCallback
+ });
+ ```
+
### deleteAccount
deleteAccount(name: string, callback: AsyncCallback<void>): void;
-Deletes an application account from the account management service. This method uses an asynchronous callback to return the result.
+Deletes an app account from the account management service. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | ------------------- | ---- | ---------------------------------- |
- | name | string | Yes| Name of the application account to delete.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when the application account is deleted.|
+ | name | string | Yes| Name of the app account to delete.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when the app account is deleted.|
- Example
@@ -140,13 +187,13 @@ Deletes an application account from the account management service. This method
deleteAccount(name: string): Promise<void>;
-Deletes an application account from the account management service. This method uses a promise to return the result asynchronously.
+Deletes an app account from the account management service. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | ------------------------ |
- | name | string | Yes| Name of the application account to delete.|
+ | name | string | Yes| Name of the app account to delete.|
- Return value
@@ -169,15 +216,15 @@ Deletes an application account from the account management service. This method
disableAppAccess(name: string, bundleName: string, callback: AsyncCallback<void>): void;
-Disables the specified third-party application account from accessing the third-party application with the given bundle name. This method uses an asynchronous callback to return the result.
+Disables an app account from accessing an application with the given bundle name. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | ------------------- | ---- | ------------------------------------------------------------ |
- | name | string | Yes| Name of the third-party application account.|
- | bundleName | string | Yes| Bundle name of the third-party application.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when the third-party application account is disabled from accessing the third-party application with the given bundle name.|
+ | name | string | Yes| App account name.|
+ | bundleName | string | Yes| Bundle name of an app.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when the app account is disabled from accessing the application with the given bundle name.|
- Example
@@ -192,14 +239,14 @@ Disables the specified third-party application account from accessing the third-
disableAppAccess(name: string, bundleName: string): Promise<void>;
-Disables the specified third-party application account from accessing the third-party application with the given bundle name. This method uses a promise to return the result asynchronously.
+Disables an app account from accessing an application with the given bundle name. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | ------ | ---- | ---------------------------------- |
- | name | string | Yes| Name of the third-party application account.|
- | bundleName | string | Yes| Bundle name of a third-party application.|
+ | name | string | Yes| App account name.|
+ | bundleName | string | Yes| Bundle name of an app.|
- Return value
@@ -222,15 +269,15 @@ Disables the specified third-party application account from accessing the third-
enableAppAccess(name: string, bundleName: string, callback: AsyncCallback<void>): void;
-Enables the specified third-party application account to access the third-party application with the given bundle name. This method uses an asynchronous callback to return the result.
+Enables an app account to access an application with the given bundle name. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | ------------------- | ---- | ------------------------------------------------------------ |
- | name | string | Yes| Application account name.|
- | bundleName | string | Yes| Bundle name of the third-party application.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when the third-party application account is enabled to access the third-party application with the given bundle name.|
+ | name | string | Yes| App account name.|
+ | bundleName | string | Yes| Bundle name of an app.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when the app account is enabled to access the application with the given bundle name.|
- Example
@@ -245,14 +292,14 @@ Enables the specified third-party application account to access the third-party
enableAppAccess(name: string, bundleName: string): Promise<void>;
-Enables the specified third-party application account to access the third-party application with the given bundle name. This method uses a promise to return the result.
+Enables an app account to access an application with the given bundle name. This method uses a promise to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| ---------- | ------ | ---- | ------------------ |
- | name | string | Yes| Application account name.|
- | bundleName | string | Yes| Bundle name of the third-party application.|
+ | name | string | Yes| App account name.|
+ | bundleName | string | Yes| Bundle name of an app.|
- Return value
@@ -274,7 +321,7 @@ Enables the specified third-party application account to access the third-party
checkAppAccountSyncEnable(name: string, callback: AsyncCallback<boolean>): void;
-Checks whether the specified application account allows application data synchronization. This method uses an asynchronous callback to return the result.
+Checks whether an app account allows application data synchronization. This method uses an asynchronous callback to return the result.
The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permission is intended for system applications only.
@@ -282,8 +329,8 @@ The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permis
| Name| Type| Mandatory| Description|
| -------- | ---------------------- | ---- | -------------------------------------------- |
- | name | string | Yes| Application account name.|
- | callback | AsyncCallback<boolean> | Yes| Callback invoked to specify whether the application account allows application data synchronization.|
+ | name | string | Yes| App account name.|
+ | callback | AsyncCallback<boolean> | Yes| Callback used to return whether the app account allows application data synchronization.|
- Example
@@ -299,7 +346,7 @@ The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permis
checkAppAccountSyncEnable(name: string): Promise<boolean>;
-Checks whether the specified application account allows application data synchronization. This method uses a promise to return the result asynchronously.
+Checks whether an app account allows application data synchronization. This method uses a promise to return the result.
The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permission is intended for system applications only.
@@ -307,7 +354,7 @@ The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permis
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | -------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
- Return value
@@ -330,16 +377,16 @@ The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permis
setAccountCredential(name: string, credentialType: string, credential: string,callback: AsyncCallback<void>): void;
-Sets a credential for an application account. This method uses an asynchronous callback to return the result.
+Sets a credential for an app account. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------------- | ------------------- | ---- | ---------------------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| credentialType | string | Yes| Type of the credential to set.|
| credential | string | Yes| Credential to set.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when a credential is set for the specified application account.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when a credential is set for the specified app account.|
- Example
@@ -354,13 +401,13 @@ Sets a credential for an application account. This method uses an asynchronous c
setAccountCredential(name: string, credentialType: string, credential: string): Promise<void>;
-Sets a credential for an application account. This method uses a promise to return the result asynchronously.
+Sets a credential for an app account. This method uses a promise to return the result asynchronously.
- Parameters
| Name| Type| Mandatory| Description|
| -------------- | ------ | ---- | -------------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| credentialType | string | Yes| Type of the credential to set.|
| credential | string | Yes| Credential to set.|
@@ -385,15 +432,15 @@ Sets a credential for an application account. This method uses a promise to retu
setAccountExtraInfo(name: string, extraInfo: string, callback: AsyncCallback<void>): void;
-Sets additional information for an application account. This method uses an asynchronous callback to return the result.
+Sets additional information for an app account. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| --------- | ------------------- | ---- | -------------------------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| extraInfo | string | Yes| Additional information to set.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when additional information is set for the specified application account.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when additional information is set for the specified app account.|
- Example
@@ -408,13 +455,13 @@ Sets additional information for an application account. This method uses an asyn
setAccountExtraInfo(name: string, extraInfo: string): Promise<void>;
-Sets additional information for an application account. This method uses a promise to return the result asynchronously.
+Sets additional information for an app account. This method uses a promise to return the result asynchronously.
- Parameters
| Name| Type| Mandatory| Description|
| --------- | ------ | ---- | ------------------ |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| extraInfo | string | Yes| Additional information to set.|
- Return value
@@ -438,7 +485,7 @@ Sets additional information for an application account. This method uses a promi
setAppAccountSyncEnable(name: string, isEnable: boolean, callback: AsyncCallback<void>): void;
-Sets whether to enable application data synchronization for an application account. This method uses an asynchronous callback to return the result.
+Sets whether to enable application data synchronization for an app account. This method uses an asynchronous callback to return the result.
The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permission is intended for system applications only.
@@ -446,9 +493,9 @@ The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permis
| Name| Type| Mandatory| Description|
| -------- | ------------------- | ---- | -------------------------------------------------- |
- | name | string | Yes| Application account name.|
- | isEnable | boolean | Yes| Specifies whether to enable application data synchronization.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when application data synchronization is enabled or disabled for the application account.|
+ | name | string | Yes| App account name.|
+ | isEnable | boolean | Yes| Whether to enable app data synchronization.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when application data synchronization is enabled or disabled for the app account.|
- Example
@@ -463,7 +510,7 @@ The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permis
setAppAccountSyncEnable(name: string, isEnable: boolean): Promise<void>;
-Sets whether to enable application data synchronization for an application account. This method uses a promise to return the result asynchronously.
+Sets whether to enable application data synchronization for an app account. This method uses a promise to return the result asynchronously.
The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permission is intended for system applications only.
@@ -471,8 +518,8 @@ The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permis
| Name| Type| Mandatory| Description|
| -------- | ------- | ---- | ---------------------- |
- | name | string | Yes| Application account name.|
- | isEnable | boolean | Yes| Specifies whether to enable application data synchronization.|
+ | name | string | Yes| App account name.|
+ | isEnable | boolean | Yes| Whether to enable app data synchronization.|
- Return value
@@ -495,16 +542,16 @@ The **ohos.permission.DISTRIBUTED_DATASYNC** permission is required. This permis
setAssociatedData(name: string, key: string, value: string, callback: AsyncCallback<void>): void;
-Sets data to be associated with an application account. This method uses an asynchronous callback to return the result.
+Sets data to be associated with an app account. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | ------------------- | ---- | ---------------------------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| key | string | Yes| Key of the data to set. The private key can be customized.|
| value | string | Yes| Value of the data to be set.|
- | callback | AsyncCallback<void> | Yes| Callback invoked when the data associated with the specified application account is set.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked when the data associated with the specified app account is set.|
- Example
@@ -518,13 +565,13 @@ Sets data to be associated with an application account. This method uses an asyn
setAssociatedData(name: string, key: string, value: string): Promise<void>;
-Sets data to be associated with an application account. This method uses a promise to return the result asynchronously.
+Sets data to be associated with an app account. This method uses a promise to return the result asynchronously.
- Parameters
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | ---------------------------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| key | string | Yes| Key of the data to set. The private key can be customized.|
| value | string | Yes| Value of the data to be set.|
@@ -549,15 +596,15 @@ Sets data to be associated with an application account. This method uses a promi
getAccountCredential(name: string, credentialType: string, callback: AsyncCallback<string>): void;
-Obtains the credential of an application account. This method uses an asynchronous callback to return the result.
+Obtains the credential of an app account. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------------- | --------------------- | ---- | ---------------------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| credentialType | string | Yes| Type of the credential to obtain.|
- | callback | AsyncCallback<string> | Yes| Callback invoked to return the credential of the specified application account.|
+ | callback | AsyncCallback<string> | Yes| Callback invoked to return the credential of the specified app account.|
- Example
@@ -573,13 +620,13 @@ Obtains the credential of an application account. This method uses an asynchrono
getAccountCredential(name: string, credentialType: string): Promise<string>;
-Obtains the credential of an application account. This method uses a promise to return the result asynchronously.
+Obtains the credential of an app account. This method uses a promise to return the result asynchronously.
- Parameters
| Name| Type| Mandatory| Description|
| -------------- | ------ | ---- | -------------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| credentialType | string | Yes| Type of the credential to obtain.|
- Return value
@@ -603,14 +650,14 @@ Obtains the credential of an application account. This method uses a promise to
getAccountExtraInfo(name: string, callback: AsyncCallback<string>): void;
-Obtains additional information of an application account. This method uses an asynchronous callback to return the result.
+Obtains additional information of an app account. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | --------------------- | ---- | -------------------------------- |
- | name | string | Yes| Application account name.|
- | callback | AsyncCallback<string> | Yes| Callback invoked to return the additional information of the specified application account.|
+ | name | string | Yes| App account name.|
+ | callback | AsyncCallback<string> | Yes| Callback invoked to return the additional information of the specified app account.|
- Example
@@ -626,13 +673,13 @@ Obtains additional information of an application account. This method uses an as
getAccountExtraInfo(name: string): Promise<string>;
-Obtains additional information of an application account. This method uses a promise to return the result asynchronously.
+Obtains additional information of an app account. This method uses a promise to return the result asynchronously.
- Parameters
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | -------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
- Return value
@@ -655,15 +702,15 @@ Obtains additional information of an application account. This method uses a pro
getAssociatedData(name: string, key: string, callback: AsyncCallback<string>): void;
-Obtains data associated with an application account. This method uses an asynchronous callback to return the result.
+Obtains data associated with an app account. This method uses an asynchronous callback to return the result.
- Parameters
| Name| Type| Mandatory| Description|
| -------- | --------------------- | ---- | ---------------------------------- |
- | name | string | Yes| Application account name.|
- | key | string | Yes| Key of the data to be obtained.|
- | callback | AsyncCallback<string> | Yes| Callback invoked to return the data associated with the specified application account.|
+ | name | string | Yes| App account name.|
+ | key | string | Yes| Key of the data to obtain.|
+ | callback | AsyncCallback<string> | Yes| Callback invoked to return the data associated with the specified app account.|
- Example
@@ -679,13 +726,13 @@ Obtains data associated with an application account. This method uses an asynchr
getAssociatedData(name: string, key: string): Promise<string>;
-Obtains data associated with an application account. This method uses a promise to return the result asynchronously.
+Obtains data associated with an app account. This method uses a promise to return the result asynchronously.
- Parameters
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | ------------------- |
- | name | string | Yes| Application account name.|
+ | name | string | Yes| App account name.|
| key | string | Yes| Key of the data to obtain.|
- Return value
@@ -709,7 +756,7 @@ Obtains data associated with an application account. This method uses a promise
getAllAccessibleAccounts(callback: AsyncCallback<Array<AppAccountInfo>>): void;
-Obtains information about all accessible accounts. This method uses an asynchronous callback to return the result.
+Obtains information about all accessible app accounts. This method uses an asynchronous callback to return the result.
The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This permission is intended for system applications only.
@@ -717,7 +764,7 @@ The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This per
| Name| Type| Mandatory| Description|
| -------- | ------------------------------------ | ---- | ---------------- |
- | callback | AsyncCallback<Array<AppAccountInfo>> | Yes| Callback invoked to return information about all accessible accounts.|
+ | callback | AsyncCallback<Array<AppAccountInfo>> | Yes| Callback invoked to return information about all accessible app accounts.|
- Example
@@ -733,7 +780,7 @@ The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This per
getAllAccessibleAccounts(): Promise<Array<AppAccountInfo>>;
-Obtains information about all accessible accounts. This method uses a promise to return the result.
+Obtains information about all accessible app accounts. This method uses a promise to return the result.
The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This permission is intended for system applications only.
@@ -758,7 +805,7 @@ The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This per
getAllAccounts(owner: string, callback: AsyncCallback<Array<AppAccountInfo>>): void;
-Obtains information about all accounts of the specified account owner. This method uses an asynchronous callback to return the result.
+Obtains information about all app accounts of the specified app. This method uses an asynchronous callback to return the result.
The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This permission is intended for system applications only.
@@ -766,8 +813,8 @@ The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This per
| Name| Type| Mandatory| Description|
| -------- | ------------------------------------ | ---- | ---------------- |
- | owner | string | Yes| Owner of a system application account or third-party application account.|
- | callback | AsyncCallback<Array<AppAccountInfo>> | Yes| Callback invoked to return information about all accounts of the specified account owner.|
+ | owner | string | Yes| Bundle name of the app.|
+ | callback | AsyncCallback<Array<AppAccountInfo>> | Yes| Callback invoked to return information about all app accounts.|
- Example
@@ -784,7 +831,7 @@ The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This per
getAllAccounts(owner: string): Promise<Array<AppAccountInfo>>;
-Obtains information about all accounts of the specified account owner. This method uses a promise to return the result.
+Obtains information about all app accounts of the specified app. This method uses a promise to return the result.
The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This permission is intended for system applications only.
@@ -792,7 +839,7 @@ The **ohos.permission.GET_ACCOUNTS_PRIVILEGED** permission is required. This per
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | ---------- |
- | owner | string | Yes| Owner of a system application account or third-party application account.|
+ | owner | string | Yes| Bundle name of the app.|
- Parameters
@@ -822,8 +869,8 @@ Subscribes to the account change event of the specified account owners. This met
| Name| Type| Mandatory| Description|
| -------- | ------------------------------- | ---- | ------------------------------------------------------------ |
- | type | 'change' | Yes| Type of the event to subscribe to. The subscriber will receive a notification when the account owner updates the account.|
- | owners | Array<string> | Yes| Owners of the account.|
+ | type | 'change' | Yes| Type of the event to subscribe to. The subscriber will receive a notification when the account owners update their accounts.|
+ | owners | Array<string> | Yes| Owners of the accounts.|
| callback | Callback<Array<AppAccountInfo>> | Yes| Callback invoked to return the account change.|
- Example
@@ -851,7 +898,7 @@ Unsubscribes from the account change event. This method uses an asynchronous cal
| Name| Type| Mandatory| Description|
| -------- | -------------------- | ---- | ------------------------ |
- | type | 'change' | Yes| Account change event.|
+ | type | 'change' | Yes| Account change event to unsubscribe from.|
| callback | Callback<void> | No| Callback used to report the account change.|
- Example
@@ -872,11 +919,739 @@ Unsubscribes from the account change event. This method uses an asynchronous cal
}
```
+### authenticate8+
+
+authenticate(name: string, owner: string, authType: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;
+
+Authenticates an app account to obtain the Open Authorization (OAuth) access token. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | --------------------- | ---- | --------------------------- |
+ | name | string | Yes| Name of the app account to authenticate.|
+ | owner | string | Yes| Bundle name of the app.|
+ | authType | string | Yes| Authentication type.|
+ | options | {[key: string]: any} | Yes| Options for the authentication.|
+ | callback | AuthenticatorCallback | Yes| Authenticator callback invoked to return the authentication result.|
+
+- Example
+
+ ```
+ import featureAbility from '@ohos.ability.featureAbility';
+
+ function onResultCallback(code, result) {
+ console.log("resultCode: " + code);
+ console.log("result: " + JSON.stringify(result));
+ }
+
+ function onRequestRedirectedCallback(request) {
+ let abilityStartSetting = {want: request};
+ featureAbility.startAbility(abilityStartSetting, (err)=>{
+ console.log("startAbility err: " + JSON.stringify(err));
+ });
+ }
+
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.authenticate("LiSi", "com.example.ohos.accountjsdemo", "readAge", {}, {
+ onResult: onResultCallback,
+ onRequestRedirected: onRequestRedirectedCallback
+ });
+ ```
+
+### getOAuthToken8+
+
+getOAuthToken(name: string, owner: string, authType: string, callback: AsyncCallback<string>): void;
+
+Obtains the OAuth access token of an app account based on the specified authentication type. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | --------------------------- | ---- | -------------------- |
+ | name | string | Yes| App account name.|
+ | owner | string | Yes| Bundle name of the app.|
+ | authType | string | Yes| Authentication type.|
+ | callback | AsyncCallback<string> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", (err, data) => {
+ console.log('getOAuthToken err: ' + JSON.stringify(err));
+ console.log('getOAuthToken token: ' + data);
+ });
+ ```
+
+### getOAuthToken8+
+
+getOAuthToken(name: string, owner: string, authType: string): Promise<string>;
+
+Obtains the OAuth access token of an app account based on the specified authentication type. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ------ | ---- | -------------------- |
+ | name | string | Yes| App account name.|
+ | owner | string | Yes| Bundle name of the app.|
+ | authType | string | Yes| Authentication type.|
+
+- Parameters
+
+ | Type| Description|
+ | --------------------- | -------------------------------- |
+ | Promise<string> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.getOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge").then((data) => {
+ console.log('getOAuthToken token: ' + data);
+ }).catch((err) => {
+ console.log("getOAuthToken err: " + JSON.stringify(err));
+ });
+ ```
+
+### setOAuthToken8+
+
+setOAuthToken(name: string, authType: string, token: string, callback: AsyncCallback<void>): void;
+
+Sets an OAuth access token for an app account. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ------------------------- | ---- | ------------- |
+ | name | string | Yes| App account name.|
+ | authType | string | Yes| Authentication type.|
+ | token | string | Yes| OAuth access token to set.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx", (err) => {
+ console.log('setOAuthToken err: ' + JSON.stringify(err));
+ });
+ ```
+
+### setOAuthToken8+
+
+setOAuthToken(name: string, authType: string, token: string): Promise<void>;
+
+Sets an OAuth access token for an app account. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ------ | ---- | ------------- |
+ | name | string | Yes| App account name.|
+ | authType | string | Yes| Authentication type.|
+ | token | string | Yes| OAuth access token to set.|
+
+- Parameters
+
+ | Type| Description|
+ | ------------------- | -------------------------------- |
+ | Promise<void> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.setOAuthToken("LiSi", "readAge", "xxxx").then(() => {
+ console.log('setOAuthToken successfully');
+ }).catch((err) => {
+ console.log('setOAuthToken err: ' + JSON.stringify(err));
+ });
+ ```
+
+### deleteOAuthToken8+
+
+deleteOAuthToken(name: string, owner: string, authType: string, token: string, callback: AsyncCallback<void>): void;
+
+Deletes the specified OAuth access token for an app account. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ------------------------- | ---- | ------------------ |
+ | name | string | Yes| App account name.|
+ | owner | string | Yes| Bundle name of the app.|
+ | authType | string | Yes| Authentication type.|
+ | token | string | Yes| OAuth access token to delete.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx", (err) => {
+ console.log('deleteOAuthToken err: ' + JSON.stringify(err));
+ });
+ ```
+
+### deleteOAuthToken8+
+
+deleteOAuthToken(name: string, owner: string, authType: string, token: string): Promise<void>;
+
+Deletes the specified OAuth access token for an app account. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ------ | ---- | ------------------ |
+ | name | string | Yes| App account name.|
+ | owner | string | Yes| Bundle name of the app.|
+ | authType | string | Yes| Authentication type.|
+ | token | string | Yes| OAuth access token to delete.|
+
+- Parameters
+
+ | Type| Description|
+ | ------------------------------ | --------------------- |
+ | Promise<void> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.deleteOAuthToken("LiSi", "com.example.ohos.accountjsdemo", "readAge", "xxxxx").then(() => {
+ console.log('deleteOAuthToken successfully');
+ }).catch((err) => {
+ console.log("deleteOAuthToken err: " + JSON.stringify(err));
+ });
+ ```
+
+### setOAuthTokenVisibility8+
+
+setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean, callback: AsyncCallback<void>): void;
+
+Sets the visibility of an OAuth access token to the specified app. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | ---------- | ------------------------- | ---- | ------------------- |
+ | name | string | Yes| App account name.|
+ | authType | string | Yes| Authentication type.|
+ | bundleName | string | Yes| Bundle name of the app.|
+ | isVisible | boolean | Yes| Whether the OAuth access token is visible to the app.|
+ | callback | AsyncCallback<void> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err) => {
+ console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
+ });
+ ```
+
+### setOAuthTokenVisibility8+
+
+setOAuthTokenVisibility(name: string, authType: string, bundleName: string, isVisible: boolean): Promise<void>;
+
+Sets the visibility of an OAuth access token to the specified app. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | ---------- | ------------------------- | ---- | ------------------- |
+ | name | string | Yes| App account name.|
+ | authType | string | Yes| Authentication type.|
+ | bundleName | string | Yes| Bundle name of the app.|
+ | isVisible | boolean | Yes| Whether the OAuth access token is visible to the app.|
+
+- Parameters
+
+ | Type| Description|
+ | ------------------------------ | --------------------- |
+ | Promise<void> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.setOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then(() => {
+ console.log('setOAuthTokenVisibility successfully');
+ }).catch((err) => {
+ console.log('setOAuthTokenVisibility err: ' + JSON.stringify(err));
+ });
+ ```
+
+### checkOAuthTokenVisibility8+
+
+checkOAuthTokenVisibility(name: string, authType: string, bundleName: string, callback: AsyncCallback<boolean>): void;
+
+Checks whether an OAuth token is visible to the specified app. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | ---------- | ---------------------------- | ---- | ---------------------- |
+ | name | string | Yes| App account name.|
+ | authType | string | Yes| Authentication type.|
+ | bundleName | string | Yes| Bundle name of the app.|
+ | callback | AsyncCallback<boolean> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true, (err, data) => {
+ console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
+ console.log('checkOAuthTokenVisibility isVisible: ' + data);
+ });
+ ```
+
+### checkOAuthTokenVisibility8+
+
+checkOAuthTokenVisibility(name: string, authType: string, bundleName: string): Promise<boolean>;
+
+Checks whether an OAuth token is visible to the specified app. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | ---------- | ------------------------- | ---- | ---------------------- |
+ | name | string | Yes| App account name.|
+ | authType | string | Yes| Authentication type.|
+ | bundleName | string | Yes| Bundle name of the app.|
+
+- Parameters
+
+ | Type| Description|
+ | ------------------------------ | ------------------------ |
+ | Promise<boolean> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.checkOAuthTokenVisibility("LiSi", "readAge", "com.example.ohos.accountjsdemo", true).then((data) => {
+ console.log('checkOAuthTokenVisibility isVisible: ' + data);
+ }).catch((err) => {
+ console.log('checkOAuthTokenVisibility err: ' + JSON.stringify(err));
+ });
+ ```
+
+### getAllOAuthTokens8+
+
+getAllOAuthTokens(name: string, owner: string, callback: AsyncCallback<Array<OAuthTokenInfo>>): void;
+
+Obtains information about all OAuth access tokens of an app account visible to the specified app. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ------------------------------------------------ | ---- | ------------------- |
+ | name | string | Yes| App account name.|
+ | owner | string | Yes| Bundle name of the app.|
+ | callback | AsyncCallback<Array<OAuthTokenInfo>> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo", (err, data) => {
+ console.log("getAllOAuthTokens err: " + JSON.stringify(err));
+ console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
+ });
+ ```
+
+### getAllOAuthTokens8+
+
+getAllOAuthTokens(name: string, owner: string): Promise<Array<OAuthTokenInfo>>;
+
+Obtains information about all OAuth access tokens of an app account visible to the specified app. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ------ | ---- | ------------------- |
+ | name | string | Yes| App account name.|
+ | owner | string | Yes| Bundle name of the app.|
+
+- Parameters
+
+ | Type| Description|
+ | ------------------------------ | ----------------------------------- |
+ | Promise<Array<OAuthTokenInfo>> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.getAllOAuthTokens("LiSi", "com.example.ohos.accountjsdemo").then((data) => {
+ console.log('getAllOAuthTokens data: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("getAllOAuthTokens err: " + JSON.stringify(err));
+ });
+ ```
+
+### getOAuthList8+
+
+getOAuthList(name: string, authType: string, callback: AsyncCallback<Array<string>>): void;
+
+Obtains the authorization list of OAuth access tokens of an app account. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ---------------------------------------- | ---- | ------------------ |
+ | name | string | Yes| App account name.|
+ | owner | string | Yes| Bundle name of the app.|
+ | callback | AsyncCallback<Array<string>> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge", (err, data) => {
+ console.log('getOAuthList err: ' + JSON.stringify(err));
+ console.log('getOAuthList data: ' + JSON.stringify(data));
+ });
+ ```
+
+### getOAuthList8+
+
+getOAuthList(name: string, authType: string): Promise<Array<string>>;
+
+Obtains the authorization list of OAuth access tokens of an app account. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | ------ | ---- | ------------------- |
+ | name | string | Yes| App account name.|
+ | owner | string | Yes| Bundle name of the app.|
+
+- Parameters
+
+ | Type| Description|
+ | ------------------------------ | ------------------------------------ |
+ | Promise<Array<string>> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.getOAuthList("com.example.ohos.accountjsdemo", "readAge").then((data) => {
+ console.log('getOAuthList data: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("getOAuthList err: " + JSON.stringify(err));
+ });
+ ```
+
+### getAuthenticatorCallback8+
+
+getAuthenticatorCallback(sessionId: string, callback: AsyncCallback<AuthenticatorCallback>): void;
+
+Obtains the authenticator callback for a session. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | --------- | ------------------------------------------ | ---- | -------------- |
+ | sessionId | string | Yes| ID of the session to authenticate.|
+ | callback | AsyncCallback<AuthenticatorCallback> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ featureAbility.getWant((err, want) => {
+ var sessionId = want.parameters[Constants.KEY_SESSION_ID];
+ appAccountManager.getAuthenticatorCallback(sessionId, (err, callback) => {
+ if (err.code != ResultCode.SUCCESS) {
+ console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
+ return;
+ }
+ var result = {Constants.KEY_NAME: "LiSi", Constants.KEY_OWNER: "com.example.ohos.accountjsdemo",
+ Constants.KEY_AUTH_TYPE: "readAge", Constants.KEY_TOKEN: "xxxxxx"};
+ callback.OnResult(ResultCode.SUCCESS, result);
+ });
+ });
+ ```
+
+### getAuthenticatorCallback8+
+
+getAuthenticatorCallback(sessionId: string): Promise<AuthenticatorCallback>;
+
+Obtains the authenticator callback for a session. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | ---------- | ------ | ---- | -------------- |
+ | sessionId | string | Yes| ID of the session to authenticate.|
+
+- Parameters
+
+ | Type| Description|
+ | ------------------------------------ | -------------------------------- |
+ | Promise<AuthenticatorCallback> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ featureAbility.getWant().then((want) => {
+ var sessionId = want.parameters[Constants.KEY_SESSION_ID];
+ appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
+ var result = {Constants.KEY_NAME: "LiSi", Constants.KEY_OWNER: "com.example.ohos.accountjsdemo",
+ Constants.KEY_AUTH_TYPE: "readAge", Constants.KEY_TOKEN: "xxxxxx"};
+ callback.OnResult(ResultCode.SUCCESS, result);
+ }).catch((err) => {
+ console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
+ });
+ }).catch((err) => {
+ console.log("getWant err: " + JSON.stringify(err));
+ });
+ ```
+
+### getAuthenticatorInfo8+
+
+getAuthenticatorInfo(owner: string, callback: AsyncCallback<AuthenticatorInfo>): void;
+
+Obtains authenticator information of an app account. This method uses an asynchronous callback to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | -------- | -------------------------------------- | ---- | ------------------- |
+ | owner | string | Yes| Bundle name of the app.|
+ | callback | AsyncCallback<AuthenticatorInfo> | Yes| Callback invoked to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo", (err, data) => {
+ console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
+ console.log('getAuthenticatorInfo data: ' + JSON.stringify(data));
+ });
+ ```
+
+### getAuthenticatorInfo8+
+
+getAuthenticatorInfo(owner: string): Promise<AuthenticatorInfo>;
+
+Obtains authenticator information of an app account. This method uses a promise to return the result.
+
+- Parameters
+
+ | Name| Type| Mandatory| Description|
+ | ----- | ------ | ---- | -------------------- |
+ | owner | string | Yes| Bundle name of the app.|
+
+- Parameters
+
+ | Type| Description|
+ | ------------------------------ | ----------------------------------- |
+ | Promise<AuthenticatorInfo> | Promise used to return the result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ appAccountManager.getAuthenticatorInfo("com.example.ohos.accountjsdemo").then((data) => {
+ console.log('getAuthenticatorInfo: ' + JSON.stringify(data));
+ }).catch((err) => {
+ console.log("getAuthenticatorInfo err: " + JSON.stringify(err));
+ });
+ ```
+
## AppAccountInfo
+Defines app account information.
+
+| Name| Type| Mandatory| Description|
+| ----- | ------ | ---- | ---------------- |
+| owner | string | Yes| Bundle name of the app.|
+| name | string | Yes| App account name.|
+
+## OAuthTokenInfo8+
+Defines OAuth access token information.
| Name| Type| Mandatory| Description|
-| ------ | ------ | ---- | ------------------ |
-| owner | string | Yes| Owner of an application account.|
-| name | string | Yes| Name of an application account.|
+| -------- | ------ | ---- | -------------- |
+| authType | string | Yes| Authentication type.|
+| token | string | Yes| Value of the access token.|
+
+## AuthenticatorInfo8+
+
+Defines OAuth authenticator information.
+
+| Name| Type| Mandatory| Description|
+| ------- | ------ | ---- | ------------------ |
+| owner | string | Yes| Bundle name of the authenticator owner.|
+| iconId | string | Yes| ID of the authenticator icon.|
+| labelId | string | Yes| ID of the authenticator label.|
+
+## Constants8+
+
+Enumerates the constants.
+
+| Name| Default Value| Description|
+| ----------------------------- | ---------------------- | ----------------------- |
+| ACTION_ADD_ACCOUNT_IMPLICITLY | "addAccountImplicitly" | Operation for implicitly adding an account.|
+| ACTION_AUTHENTICATE | "authenticate" | Authentication operation.|
+| KEY_NAME | "name" | App account name.|
+| KEY_OWNER | "owner" | App account owner.|
+| KEY_TOKEN | "token" | OAuth access token.|
+| KEY_ACTION | "action" | Action.|
+| KEY_AUTH_TYPE | "authType" | Authentication type.|
+| KEY_SESSION_ID | "sessionId" | Session ID.|
+| KEY_CALLER_PID | "callerPid" | Caller process ID (PID).|
+| KEY_CALLER_UID | "callerUid" | Caller user ID (UID).|
+| KEY_CALLER_BUNDLE_NAME | "callerBundleName" | Caller bundle name.|
+
+## ResultCode8+
+
+Enumerates the result codes.
+
+| Name| Default Value| Description|
+| ----------------------------------- | ----- | ---------------------- |
+| SUCCESS | 0 | The operation is successful.|
+| ERROR_ACCOUNT_NOT_EXIST | 10001 | The app account does not exist.|
+| ERROR_APP_ACCOUNT_SERVICE_EXCEPTION | 10002 | The app account service is abnormal.|
+| ERROR_INVALID_PASSWORD | 10003 | The password is invalid.|
+| ERROR_INVALID_REQUEST | 10004 | The request is invalid.|
+| ERROR_INVALID_RESPONSE | 10005 | The response is invalid.|
+| ERROR_NETWORK_EXCEPTION | 10006 | The network is abnormal.|
+| ERROR_OAUTH_AUTHENTICATOR_NOT_EXIST | 10007 | The authenticator does not exist.|
+| ERROR_OAUTH_CANCELED | 10008 | The authentication is canceled.|
+| ERROR_OAUTH_LIST_TOO_LARGE | 10009 | The size of the OAuth list exceeds the limit.|
+| ERROR_OAUTH_SERVICE_BUSY | 10010 | The OAuth service is busy.|
+| ERROR_OAUTH_SERVICE_EXCEPTION | 10011 | The OAuth service is abnormal.|
+| ERROR_OAUTH_SESSION_NOT_EXIST | 10012 | The session to be authenticated does not exist.|
+| ERROR_OAUTH_TIMEOUT | 10013 | The authentication timed out.|
+| ERROR_OAUTH_TOKEN_NOT_EXIST | 10014 | The OAuth access token does not exist.|
+| ERROR_OAUTH_TOKEN_TOO_MANY | 10015 | The number of OAuth access tokens reaches the limit.|
+| ERROR_OAUTH_UNSUPPORT_ACTION | 10016 | The authentication operation is not supported.|
+| ERROR_OAUTH_UNSUPPORT_AUTH_TYPE | 10017 | The authentication type is not supported.|
+| ERROR_PERMISSION_DENIED | 10018 | The required permission is missing.|
+
+## AuthenticatorCallback8+
+
+Provides methods for managing the OAuth authenticator callback.
+
+### onResult8+
+
+onResult: (code: number, result: {[key: string]: any}) => void;
+
+Called back to send the authentication result.
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | ------ | -------------------- | ---- | ----------- |
+ | code | number | Yes| Authentication result code.|
+ | result | {[key: string]: any} | Yes| Authentication result.|
+
+- Example
+
+ ```
+ const appAccountManager = account_appAccount.createAppAccountManager();
+ var sessionId = "1234";
+ appAccountManager.getAuthenticatorCallback(sessionId).then((callback) => {
+ var result = {Constants.KEY_NAME: "LiSi", Constants.KEY_OWNER: "com.example.ohos.accountjsdemo",
+ Constants.KEY_AUTH_TYPE: "readAge", Constants.KEY_TOKEN: "xxxxxx"};
+ callback.OnResult(ResultCode.SUCCESS, result);
+ }).catch((err) => {
+ console.log("getAuthenticatorCallback err: " + JSON.stringify(err));
+ });
+ ```
+
+### onRequestRedirected8+
+
+onRequestRedirected: (request: Want) => void;
+
+Called back to redirect an authentication request.
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | ------- | ---- | ---- | ------------------ |
+ | request | Want | Yes| Request to be redirected.|
+
+- Example
+
+ ```
+ class MyAuthenticator extends account_appAccount.Authenticator {
+ addAccountImplicitly(authType, callerBundleName, options, callback) {
+ callback.onRequestRedirected({
+ bundleName: "com.example.ohos.accountjsdemo",
+ abilityName: "com.example.ohos.accountjsdemo.LoginAbility",
+ });
+ }
+
+ authenticate(name, authType, callerBundleName, options, callback) {
+ var result = {Constants.KEY_NAME: name, Constants.KEY_AUTH_TYPE: authType, Constants.KEY_TOKEN: "xxxxxx"};
+ callback.onResult(ResultCode.SUCCESS, result);
+ }
+ }
+ ```
+
+## Authenticator8+
+
+Defines the OAuth authenticator base class.
+
+### addAccountImplicitly8+
+
+addAccountImplicitly(authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;
+
+Implicitly adds an app account based on the specified authentication type and options. This method uses an asynchronous callback to return the result.
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | ---------------- | --------------------- | --- | -------------------------- |
+ | authType | string | Yes| Authentication type.|
+ | callerBundleName | string | Yes| Bundle name of the authentication requester.|
+ | options | {[key: string]: any} | Yes| Options for the authentication.|
+ | callback | AuthenticatorCallback | Yes| Authenticator callback invoked to return the authentication result.|
+
+### authenticate8+
+
+authenticate(name: string, authType: string, callerBundleName: string, options: {[key: string]: any}, callback: AuthenticatorCallback): void;
+
+Authenticates an app account to obtain the OAuth access token. This method uses an asynchronous callback to return the result.
+
+- Parameters
+ | Name| Type| Mandatory| Description|
+ | ---------------- | --------------------- | ---- | -------------------------- |
+ | name | string | Yes| App account name.|
+ | authType | string | Yes| Authentication type.|
+ | callerBundleName | string | Yes| Bundle name of the authentication requester.|
+ | options | {[key: string]: any} | Yes| Options for the authentication.|
+ | callback | AuthenticatorCallback | Yes| Authenticator callback invoked to return the authentication result.|
+
+- Example
+
+ ```
+ class MyAuthenticator extends account_appAccount.Authenticator {
+ addAccountImplicitly(authType, callerBundleName, options, callback) {
+ callback.onRequestRedirected({
+ bundleName: "com.example.ohos.accountjsdemo",
+ abilityName: "com.example.ohos.accountjsdemo.LoginAbility",
+ });
+ }
+
+ authenticate(name, authType, callerBundleName, options, callback) {
+ var result = {Constants.KEY_NAME: name, Constants.KEY_AUTH_TYPE: authType, Constants.KEY_TOKEN: "xxxxxx"};
+ callback.onResult(ResultCode.SUCCESS, result);
+ }
+ }
+
+ export default {
+ onConnect(want) {
+ return new MyAuthenticator();
+ }
+ }
+ ```
diff --git a/en/application-dev/reference/apis/js-apis-arraylist.md b/en/application-dev/reference/apis/js-apis-arraylist.md
new file mode 100644
index 0000000000000000000000000000000000000000..e3ba42ce0955682922d7d36766a8a4544d111b83
--- /dev/null
+++ b/en/application-dev/reference/apis/js-apis-arraylist.md
@@ -0,0 +1,576 @@
+# Linear Container ArrayList
+
+>  **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
+
+```
+import ArrayList from '@ohos.util.ArrayList'
+```
+
+## System Capabilities
+
+SystemCapability.Utils.Lang
+
+## ArrayList
+
+### Attributes
+
+| Name| Type| Readable| Writable| Description|
+| -------- | -------- | -------- | -------- | -------- |
+| length | number | Yes| No| Number of entries in an array list (called container later).|
+
+
+### constructor
+
+constructor()
+
+A constructor used to create an **ArrayList** instance.
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+```
+
+
+### add
+
+add(element: T): boolean
+
+Adds an entry at the end of this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to add.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the entry is added successfully; returns **false** otherwise.|
+
+**Example**
+
+ ```
+ let arrayList = new ArrayList();
+ let result = arrayList.add("a");
+ let result1 = arrayList.add(1);
+ let b = [1, 2, 3];
+ let result2 = arrayList.add(b);
+ let c = {name: "lala", age: "13"};
+ let result3 = arrayList.add(false);
+ ```
+
+### insert
+
+insert(element: T, index: number): void
+
+Inserts an entry at the specified position in this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to insert.|
+| index | number | Yes| Index of the position where the entry is to be inserted.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.insert("A", 0);
+arrayList.insert(0, 1);
+arrayList.insert(true, 2);
+```
+
+### has
+
+has(element: T): boolean
+
+Checks whether this container has the specified entry.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to check.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the specified entry is contained; returns **false** otherwise.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+let result = arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+arrayList.add("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+let result1 = arrayList.has("Ahfbrgrbgnutfodgorrogorgrogofdfdf");
+```
+
+### getIndexOf
+
+getIndexOf(element: T): number
+
+Obtains the index of the first occurrence of the specified entry in this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to query.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| number | Returns the position index if obtained; returns **-1** if the specified entry is not found.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(2);
+arrayList.add(1);
+arrayList.add(2);
+arrayList.add(4);
+let result = arrayList.getIndexOf(2);
+```
+
+### getLastIndexOf
+
+getLastIndexOf(element: T): number
+
+Obtains the index of the last occurrence of the specified entry in this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to query.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| number | Returns the position index if obtained; returns **-1** if the specified entry is not found.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(2);
+arrayList.add(1);
+arrayList.add(2);
+arrayList.add(4);
+let result = arrayList.getLastIndexOf(2);
+```
+
+### removeByIndex
+
+removeByIndex(index: number): T
+
+Removes an entry with the specified position from this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| index | number | Yes| Position index of the entry to remove.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| T | Entry removed.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(2);
+arrayList.add(4);
+let result = arrayList.removeByIndex(2);
+```
+
+### remove
+
+remove(element: T): boolean
+
+Removes the first occurrence of the specified entry from this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| element | T | Yes| Entry to remove.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the entry is removed successfully; returns **false** otherwise.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.remove(2);
+```
+
+### removeByRange
+
+removeByRange(fromIndex: number, toIndex: number): void
+
+Removes from this container all of the entries within a range, including the entry at the start position but not that at the end position.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| fromIndex | number | Yes| Index of the start position.|
+| toIndex | number | Yes| Index of the end position.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.removeByRange(2, 4);
+arrayList.removeByRange(4, 3);
+arrayList.removeByRange(2, 6);
+```
+
+### replaceAllElements
+replaceAllElements(callbackfn: (value: T, index?: number, arrlist?: ArrayList<T>) => T,
+thisArg?: Object): void
+
+Replaces all entries in this container with new entries, and returns the new ones.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callbackfn | function | Yes| Callback invoked for the replacement.|
+| thisArg | Object | No| Value to use when the callback is invoked.|
+
+callbackfn
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| value | T | Yes| Value of the entry that is currently traversed.|
+| index | number | No| Position index of the entry that is currently traversed.|
+| arrlist | ArrayList<T> | No| Instance that invokes the **replaceAllElements** method.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.replaceAllElements((value, index) => {
+ return value = 2 * value;
+});
+arrayList.replaceAllElements((value, index) => {
+ return value = value - 2;
+});
+```
+
+### forEach
+forEach(callbackfn: (value: T, index?: number, arrlist?: ArrayList<T>) => void,
+thisArg?: Object): void
+
+Uses a callback to traverse the entries in this container and obtain their position indexes.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| callbackfn | function | Yes| Callback invoked to traverse the entries in the container.|
+| thisArg | Object | No| Value to use when the callback is invoked.|
+
+callbackfn
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| value | T | Yes| Value of the entry that is currently traversed.|
+| index | number | No| Position index of the entry that is currently traversed.|
+| arrlist | ArrayList<T> | No| Instance that invokes the **forEach** method.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.forEach((value, index) => {
+ console.log(value, index);
+});
+```
+
+### sort
+sort(comparator?: (firstValue: T, secondValue: T) => number): void
+
+Sorts entries in this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| comparator | function | No| Callback invoked for sorting.|
+
+comparator
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| firstValue | T | Yes| Previous entry.|
+| secondValue | T | Yes| Next entry.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.sort(a, (b => a - b));
+arrayList.sort(a, (b => b - a));
+arrayList.sort();
+```
+
+### subArrayList
+subArrayList(fromIndex: number, toIndex: number): ArrayList<T>
+
+Obtains entries within a range in this container, including the entry at the start position but not that at the end position, and returns these entries as a new **ArrayList** instance.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| fromIndex | number | Yes| Index of the start position.|
+| toIndex | number | Yes| Index of the end position.|
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| ArrayList<T> | New **ArrayList** instance obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result1 = arrayList.subArrayList(2, 4);
+let result2 = arrayList.subArrayList(4, 3);
+let result3 = arrayList.subArrayList(2, 6);
+```
+
+### clear
+clear(): void
+
+Clears this container and sets its length to **0**.
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.clear();
+```
+
+### clone
+clone(): ArrayList<T>
+
+Clones this container and returns a copy. The modification to the copy does not affect the original instance.
+
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| ArrayList<T> | New **ArrayList** instance obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.clone();
+```
+
+### getCapacity
+getCapacity(): number
+
+Obtains the capacity of this container.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| number | Capacity obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.getCapacity();
+```
+
+### convertToArray
+convertToArray(): Array<T>
+
+Converts this container into an array.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| Array<T> | Array obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.convertToArray();
+```
+
+### isEmpty
+isEmpty(): boolean
+
+Checks whether this container is empty (contains no entry).
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| boolean | Returns **true** if the container is empty; returns **false** otherwise.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+let result = arrayList.isEmpty();
+```
+
+### increaseCapacityTo
+increaseCapacityTo(newCapacity: number): void
+
+Increases the capacity of this container.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| newCapacity | number | Yes| New capacity.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.increaseCapacityTo(2);
+arrayList.increaseCapacityTo(8);
+```
+
+### trimToCurrentLength
+trimToCurrentLength(): void
+
+Trims the capacity of this container to its current length.
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+arrayList.trimToCurrentLength();
+```
+
+### [Symbol.iterator]
+
+[Symbol.iterator]\(): IterableIterator<T>
+
+Obtains an iterator, each item of which is a JavaScript object.
+
+**Return value**
+
+| Type| Description|
+| -------- | -------- |
+| IterableIterator<T> | Iterator obtained.|
+
+**Example**
+
+```
+let arrayList = new ArrayList();
+arrayList.add(2);
+arrayList.add(4);
+arrayList.add(5);
+arrayList.add(4);
+
+// Method 1:
+for (let item of arrayList) {
+ console.log(item);
+}
+
+// Method 2:
+let iter = arrayList[Symbol.iterator]();
+let temp = iter.next().value;
+while(temp != undefined) {
+ console.log(temp);
+ temp = iter.next().value;
+}
+```
diff --git a/en/application-dev/reference/apis/js-apis-audio.md b/en/application-dev/reference/apis/js-apis-audio.md
index 80ac13c01931162680670633ac374864c8a24101..85d2dc6b01ebe7dc2dc97e3965985ae1a61efb52 100644
--- a/en/application-dev/reference/apis/js-apis-audio.md
+++ b/en/application-dev/reference/apis/js-apis-audio.md
@@ -1,6 +1,7 @@
# Audio
-This module provides the following functions: audio management, audio rendering and system sound management.
+>  **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
@@ -284,8 +285,18 @@ Enumerates audio device types.
+## ActiveDeviceType
-## AudioRingMode7+
+Enumerates the active device types.
+
+| Name | Default Value | Default Value |
+| ------------- | ------ | ------------------------------------------------------------ |
+| SPEAKER | 2 | Speaker. **System capabilities:** SystemCapability.Multimedia.Audio.Device |
+| BLUETOOTH_SCO | 7 | Bluetooth device using the SCO link. **System capabilities:** SystemCapability.Multimedia.Audio.Device |
+
+
+
+## AudioRingMode
Enumerates ringer modes.
@@ -1028,7 +1039,7 @@ audioManager.getMaxVolume(audio.AudioVolumeType.MEDIA).then((data)=>
## audioManager.mute
-mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void7+
+mute\(volumeType: AudioVolumeType, mute: boolean, callback: AsyncCallback\): void
Mutes a stream. This method uses an asynchronous callback to return the result.
@@ -1096,7 +1107,7 @@ audioManager.mute(audio.AudioVolumeType.MEDIA, true, (err) => {
## audioManager.mute
-mute\(volumeType: AudioVolumeType, mute: boolean\): Promise7+
+mute\(volumeType: AudioVolumeType, mute: boolean\): Promise
Mutes a stream. This method uses a promise to return the result.
@@ -1164,7 +1175,7 @@ audioManager.mute(audio.AudioVolumeType.MEDIA, true).then(() =>
## audioManager.isMute
-isMute\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+
+isMute\(volumeType: AudioVolumeType, callback: AsyncCallback\): void
Checks whether a stream is muted. This method uses an asynchronous callback to return the query result.
@@ -1223,7 +1234,7 @@ audioManager.isMute(audio.AudioVolumeType.MEDIA, (err, value) => {
## audioManager.isMute
-isMute\(volumeType: AudioVolumeType\): Promise7+
+isMute\(volumeType: AudioVolumeType\): Promise
Checks whether a stream is muted. This method uses a promise to return the result.
@@ -1282,7 +1293,7 @@ audioManager.isMute(audio.AudioVolumeType.MEDIA).then((value) =>
## audioManager.isActive
-isActive\(volumeType: AudioVolumeType, callback: AsyncCallback\): void7+
+isActive\(volumeType: AudioVolumeType, callback: AsyncCallback\)
Checks whether a stream is active. This method uses an asynchronous callback to return the query result.
@@ -1341,7 +1352,7 @@ audioManager.isActive(audio.AudioVolumeType.MEDIA, (err, value) => {
## audioManager.isActive
-isActive\(volumeType: AudioVolumeType\): Promise7+
+isActive\(volumeType: AudioVolumeType\): Promise
Checks whether a stream is active. This method uses a promise to return the query result.
@@ -1400,7 +1411,7 @@ audioManager.isActive(audio.AudioVolumeType.MEDIA).then((value) =>
## audioManager.setRingerMode
-setRingerMode\(mode: AudioRingMode, callback: AsyncCallback\): void7+
+setRingerMode\(mode: AudioRingMode, callback: AsyncCallback\): void
Sets the ringer mode. This method uses an asynchronous callback to return the result.
@@ -1459,7 +1470,7 @@ audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL, (err) => {
## audioManager.setRingerMode
-setRingerMode\(mode: AudioRingMode\): Promise7+
+setRingerMode\(mode: AudioRingMode\): Promise
Sets the ringer mode. This method uses a promise to return the result.
@@ -1518,7 +1529,7 @@ audioManager.setRingerMode(audio.AudioRingMode.RINGER_MODE_NORMAL).then(() =>
## audioManager.getRingerMode
-getRingerMode\(callback: AsyncCallback\): void7+
+getRingerMode\(callback: AsyncCallback\): void
Obtains the ringer mode. This method uses an asynchronous callback to return the query result.
@@ -1568,7 +1579,7 @@ audioManager.getRingerMode((err, value) => {
## audioManager.getRingerMode
-getRingerMode\(\): Promise7+
+getRingerMode\(\): Promise
Obtains the ringer mode. This method uses a promise to return the query result.
@@ -1606,7 +1617,7 @@ audioManager.getRingerMode().then((value) =>
## audioManager.setAudioParameter
-setAudioParameter\(key: string, value: string, callback: AsyncCallback\): void7+
+setAudioParameter\(key: string, value: string, callback: AsyncCallback\): void
Sets an audio parameter. This method uses an asynchronous callback to return the result.
@@ -1674,7 +1685,7 @@ audioManager.setAudioParameter('PBits per sample', '8 bit', (err) => {
## audioManager.setAudioParameter
-setAudioParameter\(key: string, value: string\): Promise7+
+setAudioParameter\(key: string, value: string\): Promise
Sets an audio parameter. This method uses a promise to return the result.
@@ -1742,7 +1753,7 @@ audioManager.setAudioParameter('PBits per sample', '8 bit').then(() =>
## audioManager.getAudioParameter
-getAudioParameter\(key: string, callback: AsyncCallback\): void7+
+getAudioParameter\(key: string, callback: AsyncCallback\)
Obtains the value of an audio parameter. This method uses an asynchronous callback to return the query result.
@@ -1801,7 +1812,7 @@ audioManager.getAudioParameter('PBits per sample', (err, value) => {
## audioManager.getAudioParameter
-getAudioParameter\(key: string\): Promise7+
+getAudioParameter\(key: string\): Promise
Obtains the value of an audio parameter. This method uses a promise to return the query result.
@@ -1979,7 +1990,7 @@ audioManager.getDevices(audio.DeviceFlag.OUTPUT_DEVICES_FLAG).then((data)=>
## audioManager.setDeviceActive
-setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void7+
+setDeviceActive\(deviceType: DeviceType, active: boolean, callback: AsyncCallback\): void
Sets a device to the active state. This method uses an asynchronous callback to return the result.
@@ -2048,7 +2059,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true, (err)=> {
## audioManager.setDeviceActive
-setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise7+
+setDeviceActive\(deviceType: DeviceType, active: boolean\): Promise
Sets a device to the active state. This method uses a promise to return the result.
@@ -2116,7 +2127,7 @@ audioManager.setDeviceActive(audio.DeviceType.SPEAKER, true).then(()=>
## audioManager.isDeviceActive
-isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void7+
+isDeviceActive\(deviceType: DeviceType, callback: AsyncCallback\): void
Checks whether a device is active. This method uses an asynchronous callback to return the query result.
@@ -2175,7 +2186,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER, (err, value) => {
## audioManager.isDeviceActive
-isDeviceActive\(deviceType: DeviceType\): Promise7+
+isDeviceActive\(deviceType: DeviceType\): Promise
Checks whether a device is active. This method uses a promise to return the query result.
@@ -2234,7 +2245,7 @@ audioManager.isDeviceActive(audio.DeviceType.SPEAKER).then((value) =>
## audioManager.setMicrophoneMute
-setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void7+
+setMicrophoneMute\(mute: boolean, callback: AsyncCallback\): void
Mutes or unmutes the microphone. This method uses an asynchronous callback to return the result.
@@ -2293,7 +2304,7 @@ audioManager.setMicrophoneMute(true, (err) => {
## audioManager.setMicrophoneMute
-setMicrophoneMute\(mute: boolean\): Promise7+
+setMicrophoneMute\(mute: boolean\): Promise
Mutes or unmutes the microphone. This method uses a promise to return the result.
@@ -2352,7 +2363,7 @@ audioManager.setMicrophoneMute(true).then(() =>
## audioManager.isMicrophoneMute
-isMicrophoneMute\(callback: AsyncCallback\): void7+
+isMicrophoneMute\(callback: AsyncCallback\): void
Checks whether the microphone is muted. This method uses an asynchronous callback to return the query result.
@@ -2402,7 +2413,7 @@ audioManager.isMicrophoneMute((err, value) => {
## audioManager.isMicrophoneMute
-isMicrophoneMute\(\): Promise7+
+isMicrophoneMute\(\): Promise
Checks whether the microphone is muted. This method uses a promise to return the query result.
@@ -4121,3 +4132,20 @@ None
```
await ringtonePlayer.release();
```
+
+
+## AudioDeviceDescriptor
+
+Describes an audio device.
+
+| Name | Type | Readable | Writable | Description |
+| -------- | -------- | -------- | -------- | -------- |
+| deviceRole | [DeviceRole](#devicerole) | Yes | No | Device role. **System capabilities:** SystemCapability.Multimedia.Audio.Device |
+| deviceType | [DeviceType](#devicetype) | Yes | No | Device type. **System capabilities:** SystemCapability.Multimedia.Audio.Device |
+
+
+## AudioDeviceDescriptors
+
+| Name | Description |
+| -------- | -------- |
+| AudioDeviceDescriptors | Array of **AudioDeviceDescriptor** objects. It is read-only. **System capabilities:** SystemCapability.Multimedia.Audio.Device |
\ No newline at end of file
diff --git a/en/application-dev/reference/apis/js-apis-bluetooth.md b/en/application-dev/reference/apis/js-apis-bluetooth.md
index 41295611985e939ba1ada638060c747b9873f5cb..588c942cb2b77556023606197b23a106f9ffc0be 100644
--- a/en/application-dev/reference/apis/js-apis-bluetooth.md
+++ b/en/application-dev/reference/apis/js-apis-bluetooth.md
@@ -2111,7 +2111,7 @@ let deviceName = gattClient.getDeviceName().then((data) => {
getRssiValue(callback: AsyncCallback<number>): void
-Obtains the received signal strength indication (RSSI) of the peer BLE device. This method uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect-boolean).
+Obtains the received signal strength indication (RSSI) of the peer BLE device. This method uses an asynchronous callback to return the result. It can be used only after a connection is set up by calling [connect](#connect).
**Parameters:**
@@ -2140,7 +2140,7 @@ let rssi = gattClient.getRssiValue((err, data)=> {
getRssiValue(): Promise<number>
-Obtains the RSSI of the peer BLE device. This method uses a promise to return the result. It can be used only after a connection is set up by calling [connect](#connect-boolean).
+Obtains the RSSI of the peer BLE device. This method uses a promise to return the result. It can be used only after a connection is set up by calling [connect](#connect).
**Return values:**
diff --git a/en/application-dev/reference/apis/js-apis-bytrace.md b/en/application-dev/reference/apis/js-apis-bytrace.md
index a79e890d2a29af43852f76653150048c23f84c4a..ff5fbcee930005827440c17da32630e0e372ed3b 100644
--- a/en/application-dev/reference/apis/js-apis-bytrace.md
+++ b/en/application-dev/reference/apis/js-apis-bytrace.md
@@ -1,197 +1,110 @@
-# Performance Tracing
+# Performance Tracing
-> **NOTE:**
+>  **NOTE**
> - The APIs of this module are no longer maintained since API version 8. It is recommended that you use the APIs of [hiTraceMeter](js-apis-hitracemeter.md) instead.
> - The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
-## Modules to Import
+
+## Modules to Import
```
import bytrace from '@ohos.bytrace';
```
-## Required Permissions
-
-None
-
-## bytrace.startTrace
-
-startTrace\(name: string, taskId: number, expectedTime?: number\): void
-
-Starts a trace of a task. **expectedTime** is an optional parameter, which specifies the expected duration of the trace.
-
-- Parameters
-
-
-
Name
-
-
Type
-
-
Mandatory
-
-
Description
-
-
-
-
name
-
-
string
-
-
Yes
-
-
Name of the trace task to start.
-
-
-
taskId
-
-
number
-
-
Yes
-
-
Task ID.
-
-
-
expectedTime
-
-
number
-
-
No
-
-
Expected duration of the trace, in ms.
-
-
-
-
-
- > **NOTE:**
- >If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different **taskId**s must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same **taskId** can be used. For details, see the **bytrace.finishTrace** example.
-
-- Example
-
- ```
- bytrace.startTrace("myTestFunc", 1);
- bytrace.startTrace("myTestFunc", 1, 5); // The expected duration of the trace is 5 ms.
- ```
-
-
-## bytrace.finishTrace
-
-finishTrace\(name: string, taskId: number\): void
+
+## System Capabilities
+
+SystemCapability.Developtools.Bytrace
+
+
+## bytrace.startTrace
+
+startTrace(name: string, taskId: number, expectedTime?: number): void
+
+Starts a trace task. **expectedTime** is an optional parameter, which specifies the expected duration of the trace.
+
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| name | string | Yes| Name of the trace task to start.|
+| taskId | number | Yes| Task ID.|
+| expectedTime | number | No| Expected duration of the trace, in ms.|
+
+>  **NOTE**
+> If multiple trace tasks with the same name need to be performed at the same time or a trace task needs to be performed multiple times concurrently, different task IDs must be specified in **startTrace**. If the trace tasks with the same name are not performed at the same time, the same taskId can be used. For details, see the bytrace.finishTrace example.
+
+**Example**
+
+```
+bytrace.startTrace("myTestFunc", 1);
+bytrace.startTrace("myTestFunc", 1, 5); // The expected duration of the trace is 5 ms.
+```
+
+
+## bytrace.finishTrace
+
+finishTrace(name: string, taskId: number): void
Stops a trace task.
-- Parameters
-
-
-
Name
-
-
Type
-
-
Mandatory
-
-
Description
-
-
-
-
name
-
-
string
-
-
Yes
-
-
Name of the trace task to stop.
-
-
-
taskId
-
-
number
-
-
Yes
-
-
Task ID.
-
-
-
-
-
- > **NOTE:**
- >To stop a trace task, the values of **name** and **taskId** in **finishTrace** must be the same as those in **startTrace**.
-
-- Example
-
- ```
- bytrace.finishTrace("myTestFunc", 1);
- ```
-
- ```
- // Start track tasks with the same name concurrently.
- bytrace.startTrace("myTestFunc", 1);
- ...... // Service flow
- bytrace.startTrace ("myTestFunc", 2); // The second trace task starts while the first task is still running. The first and second tasks have the same name but different task IDs.
- ...... // Service flow
- bytrace.finishTrace("myTestFunc", 1);
- ...... // Service flow
- bytrace.finishTrace("myTestFunc", 2);
- ```
-
- ```
- // Start track tasks with the same name at different times.
- bytrace.startTrace("myTestFunc", 1);
- ...... // Service flow
- bytrace.finishTrace("myTestFunc", 1); // The first trace task ends.
- ...... // Service flow
- bytrace.startTrace("myTestFunc", 1); // The second trace task starts after the first task ends. The two tasks have the same name and task ID.
- ...... // Service flow
- bytrace.finishTrace("myTestFunc", 1);
- ```
-
-
-## bytrace.traceByValue
-
-traceByValue\(name: string, value: number\): void
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| name | string | Yes| Name of the trace task to start.|
+| taskId | number | Yes| Task ID.|
+
+>  **NOTE**
+> To stop a trace task, the values of name and task ID in **finishTrace** must be the same as those in **startTrace**.
+
+**Example**
+
+```
+bytrace.finishTrace("myTestFunc", 1);
+```
+
+```
+// Start track tasks with the same name concurrently.
+bytrace.startTrace("myTestFunc", 1);
+// Service flow
+bytrace.startTrace("myTestFunc", 2); // The second trace task starts while the first task is still running. The first and second tasks have the same name but different task IDs.
+// Service flow
+bytrace.finishTrace("myTestFunc", 1);
+// Service flow
+bytrace.finishTrace("myTestFunc", 2);
+```
+
+```
+// Start track tasks with the same name at different times.
+bytrace.startTrace("myTestFunc", 1);
+// Service flow
+bytrace.finishTrace("myTestFunc", 1); // The first trace task ends.
+// Service flow
+bytrace.startTrace("myTestFunc", 1); // The second trace task starts after the first task ends. The two tasks have the same name and task ID.
+// Service flow
+bytrace.finishTrace("myTestFunc", 1);
+```
+
+
+## bytrace.traceByValue
+
+traceByValue(name: string, value: number): void
Traces the value changes of a variable.
-- Parameters
-
-
-
Name
-
-
Type
-
-
Mandatory
-
-
Description
-
-
-
-
name
-
-
string
-
-
Yes
-
-
Name of the variable to trace.
-
-
-
value
-
-
number
-
-
Yes
-
-
Value of the variable to trace.
-
-
-
-
-
-- Example
-
- ```
- let traceCount = 3;
- bytrace.traceByValue("myTestCount", traceCount);
- ......
- traceCount = 5;
- bytrace.traceByValue("myTestCount", traceCount);
- ```
+**Parameters**
+| Name| Type| Mandatory| Description|
+| -------- | -------- | -------- | -------- |
+| name | string | Yes| Name of the variable.|
+| value | number | Yes| Value of the variable.|
+
+**Example**
+
+```
+let traceCount = 3;
+bytrace.traceByValue("myTestCount", traceCount);
+traceCount = 4;
+bytrace.traceByValue("myTestCount", traceCount);
+// Service flow
+```
diff --git a/en/application-dev/reference/apis/js-apis-call.md b/en/application-dev/reference/apis/js-apis-call.md
index 14584a1f0e3c2f9c700bb8afb0bee7168b867f24..dc54b14b351dc85a09abd394681bd1dd2d182568 100644
--- a/en/application-dev/reference/apis/js-apis-call.md
+++ b/en/application-dev/reference/apis/js-apis-call.md
@@ -1,6 +1,6 @@
# Call
->**Note:**
+>**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.
@@ -17,22 +17,24 @@ dial\(phoneNumber: string, callback: AsyncCallback\): void
Initiates a call. This function uses an asynchronous callback to return the execution result.
-Before using this API, you must declare the **ohos.permission.PLACE\_CALL** permission (a system permission).
+**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
-- Parameters
-
- | Name| Type| Mandatory| Description|
- | -------- | -------- | -------- | -------- |
- | phoneNumber | string | Yes|Phone number.|
- | callback |AsyncCallback<boolean>|Yes|Callback used to return the result. - **true**: success -**false**: failure|
-
-- Example
+**System capability**: SystemCapability.Telephony.CallManager
- ```
- call.dial("138xxxxxxxx", (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| ----------- | ---------------------------- | ---- | ------------------------------------------------- |
+| phoneNumber | string | Yes| Phone number.|
+| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. - **true**: success - **false**: failure|
+
+**Example**
+
+```
+call.dial("138xxxxxxxx", (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.dial
@@ -41,26 +43,27 @@ dial\(phoneNumber: string, options: DialOptions, callback: AsyncCallback - **true**: success -**false**: failure|
+**Parameters**
+| Name| Type| Mandatory| Description|
+| ----------- | ---------------------------- | ---- | ------------------------------------------------- |
+| phoneNumber | string | Yes| Phone number.|
+| options | DialOptions | Yes| Call options. For details, see [DialOptions](#DialOptions).|
+| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. - **true**: success - **false**: failure|
-- Example
+**Example**
- ```
- call.dial("138xxxxxxxx", {
- extras: false
- }, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+```
+call.dial("138xxxxxxxx", {
+ extras: false
+}, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.dial
@@ -69,33 +72,35 @@ dial\(phoneNumber: string, options?: DialOptions\): Promise
Initiates a call. You can set call options as needed. This function uses a promise to return the execution result.
-Before using this API, you must declare the **ohos.permission.PLACE\_CALL** permission (a system permission).
+**Required permission**: ohos.permission.PLACE\_CALL (a system permission)
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
- | Name| Type| Mandatory| Description|
- | ----------- | ----------- | ---- | ------------------------------------------- |
- | phoneNumber | string | Yes| Phone number.|
- | options | DialOptions | Yes| Call options. For details, see [DialOptions](#DialOptions).|
+**Parameters**
-- Return values
+| Name| Type| Mandatory| Description|
+| ----------- | ----------- | ---- | ------------------------------------------- |
+| phoneNumber | string | Yes| Phone number.|
+| options | DialOptions | Yes| Call options. For details, see [DialOptions](#DialOptions).|
+
+**Return value**
- | Type| Description|
- | ---------------------- | --------------------------------- |
- | Promise<boolean> | Promise used to return the result.|
+| Type| Description|
+| ---------------------- | --------------------------------- |
+| Promise<boolean> | Promise used to return the result.|
-- Example
+**Example**
- ```
- let promise = call.dial("138xxxxxxxx", {
- extras: false
- });
- promise.then(data => {
- console.log(`dial success, promise: data->${JSON.stringify(data)}`);
- }).catch(err => {
- console.error(`dial fail, promise: err->${JSON.stringify(err)}`);
- });
- ```
+```
+let promise = call.dial("138xxxxxxxx", {
+ extras: false
+});
+promise.then(data => {
+ console.log(`dial success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`dial fail, promise: err->${JSON.stringify(err)}`);
+});
+```
## call.hasCall
@@ -103,19 +108,21 @@ hasCall\(callback: AsyncCallback\): void
Checks whether a call is in progress. This function uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
- | Name| Type| Mandatory| Description|
- | -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
- | callback | AsyncCallback<boolean> | Yes| Callback used to return the result: - **true**: A call is in progress. - **false**: No call is in progress. |
+**Parameters**
-- Example
+| Name| Type| Mandatory| Description|
+| -------- | ---------------------------- | ---- | ------------------------------------------------------------ |
+| callback | AsyncCallback<boolean> | Yes| Callback used to return the result: - **true**: A call is in progress. - **false**: No call is in progress. |
+
+**Example**
- ```
- call.hasCall((err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+```
+call.hasCall((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.hasCall
@@ -124,22 +131,24 @@ hasCall\(\): Promise
Checks whether a call is in progress. This function uses a promise to return the result.
-- Return values
+**System capability**: SystemCapability.Telephony.CallManager
- | Type| Description|
- | ---------------------- | --------------------------------------- |
- | Promise<boolean> | Promise used to return the result.|
+**Return value**
-- Example
+| Type| Description|
+| ---------------------- | --------------------------------------- |
+| Promise<boolean> | Promise used to return the result.|
- ```
- let promise = call.hasCall();
- promise.then(data => {
- console.log(`hasCall success, promise: data->${JSON.stringify(data)}`);
- }).catch(err => {
- console.error(`hasCall fail, promise: err->${JSON.stringify(err)}`);
- });
- ```
+**Example**
+
+```
+let promise = call.hasCall();
+promise.then(data => {
+ console.log(`hasCall success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`hasCall fail, promise: err->${JSON.stringify(err)}`);
+});
+```
## call.getCallState
@@ -148,19 +157,21 @@ getCallState\(callback: AsyncCallback\): void
Obtains the call status. This function uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
- | Name| Type| Mandatory| Description|
- | -------- | -------------------------------------------- | ---- | ------------------------------------ |
- | callback | AsyncCallback<[CallState](#CallState)> | Yes| Callback used to return the result.|
+| Name| Type| Mandatory| Description|
+| -------- | -------------------------------------------- | ---- | ------------------------------------ |
+| callback | AsyncCallback<[CallState](#CallState)> | Yes| Callback used to return the result.|
-- Example
+**Example**
- ```
- call.getCallState((err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+```
+call.getCallState((err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.getCallState
@@ -169,118 +180,128 @@ getCallState\(\): Promise
Obtains the call status. This function uses a promise to return the result.
-- Return values
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Return value**
- | Type| Description|
- | -------------------------------------- | ----------------------------------------- |
- | Promise<[CallState](#CallState)> | Promise used to return the result.|
+| Type| Description|
+| -------------------------------------- | ----------------------------------------- |
+| Promise<[CallState](#CallState)> | Promise used to return the result.|
-- Example
+**Example**
- ```
- let promise = call.getCallState();
- promise.then(data => {
- console.log(`getCallState success, promise: data->${JSON.stringify(data)}`);
- }).catch(err => {
- console.error(`getCallState fail, promise: err->${JSON.stringify(err)}`);
- });
- ```
+```
+let promise = call.getCallState();
+promise.then(data => {
+ console.log(`getCallState success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`getCallState fail, promise: err->${JSON.stringify(err)}`);
+});
+```
## call.isEmergencyPhoneNumber7+
isEmergencyPhoneNumber\(phoneNumber: string, callback: AsyncCallback\): void
-Checks whether the call number is an emergency number. This function uses an asynchronous callback to return the result.
+Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
- | Name| Type| Mandatory| Description|
- | ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
- | phoneNumber | string | Yes| Phone number.|
- | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. - **true**: The called number is an emergency number. - **false**: The called number is not an emergency number.|
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
+| phoneNumber | string | Yes| Phone number.|
+| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. - **true**: The called number is an emergency number. - **false**: The called number is not an emergency number.|
-- Example
+**Example**
- ```
- call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+```
+call.isEmergencyPhoneNumber("138xxxxxxxx", (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.isEmergencyPhoneNumber7+
isEmergencyPhoneNumber\(phoneNumber: string, options: EmergencyNumberOptions, callback: AsyncCallback\): void
-Checks whether the call number is an emergency number. This function uses an asynchronous callback to return the result.
+Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
- | Name| Type| Mandatory| Description|
- | ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
- | phoneNumber | string | Yes| Phone number.|
- | options | EmergencyNumberOptions | Yes| Emergency number options defined in [EmergencyNumberOptions](#EmergencyNumberOptions).|
- | callback | AsyncCallback<boolean> | Yes| Callback used to return the result. - **true**: The called number is an emergency number. - **false**: The called number is not an emergency number.|
+**Parameters**
+
+| Name| Type| Mandatory| Description|
+| ----------- | ---------------------------- | ---- | ------------------------------------------------------------ |
+| phoneNumber | string | Yes| Phone number.|
+| options | EmergencyNumberOptions | Yes| Emergency number options defined in [EmergencyNumberOptions](#EmergencyNumberOptions).|
+| callback | AsyncCallback<boolean> | Yes| Callback used to return the result. - **true**: The called number is an emergency number. - **false**: The called number is not an emergency number.|
-- Example
+**Example**
- ```
- call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, value) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+```
+call.isEmergencyPhoneNumber("112", {slotId: 1}, (err, value) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.isEmergencyPhoneNumber7+
isEmergencyPhoneNumber\(phoneNumber: string, options?: EmergencyNumberOptions\): Promise
-Checks whether the call number is an emergency number. This function uses a promise to return the result.
+Checks whether the call number of the SIM card in the specified slot is an emergency number. This function uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
- | Name| Type| Mandatory| Description|
- | ----------- | ---------------------- | ---- | ------------------------------------------------------------ |
- | phoneNumber | string | Yes| Phone number.|
- | options | EmergencyNumberOptions | Yes| Emergency number options defined in [EmergencyNumberOptions](#EmergencyNumberOptions).|
+**Parameters**
-- Return values
+| Name| Type| Mandatory| Description|
+| ----------- | ---------------------- | ---- | ------------------------------------------------------------ |
+| phoneNumber | string | Yes| Phone number.|
+| options | EmergencyNumberOptions | Yes| Emergency number options defined in [EmergencyNumberOptions](#EmergencyNumberOptions).|
- | Type| Description|
- | ---------------------- | --------------------------------------------------- |
- | Promise<boolean> | Promise used to return the result.|
+**Return value**
-- Example
+| Type| Description|
+| ---------------------- | --------------------------------------------------- |
+| Promise<boolean> | Promise used to return the result.|
- ```
- let promise = call.isEmergencyPhoneNumber("138xxxxxxxx", {slotId: 1});
- promise.then(data => {
- console.log(`isEmergencyPhoneNumber success, promise: data->${JSON.stringify(data)}`);
- }).catch(err => {
- console.error(`isEmergencyPhoneNumber fail, promise: err->${JSON.stringify(err)}`);
- });
- ```
+**Example**
+
+```
+let promise = call.isEmergencyPhoneNumber("138xxxxxxxx", {slotId: 1});
+promise.then(data => {
+ console.log(`isEmergencyPhoneNumber success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`isEmergencyPhoneNumber fail, promise: err->${JSON.stringify(err)}`);
+});
+```
## call.formatPhoneNumber7+
formatPhoneNumber\(phoneNumber: string, callback: AsyncCallback\): void
-Formats a phone number. This function uses an asynchronous callback to return the result.
+Formats a phone number based on the specified ISO country code. This function uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
- | Name| Type| Mandatory| Description|
- | ----------- | --------------------------- | ---- | ------------------------------------ |
- | phoneNumber | string | Yes| Phone number.|
- | callback | AsyncCallback<string> | Yes| Callback used to return the result.|
+**Parameters**
-- Example
+| Name| Type| Mandatory| Description|
+| ----------- | --------------------------- | ---- | ------------------------------------ |
+| phoneNumber | string | Yes| Phone number.|
+| callback | AsyncCallback<string> | Yes| Callback used to return the result.|
- ```
- call.formatPhoneNumber("138xxxxxxxx", (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+**Example**
+
+```
+call.formatPhoneNumber("138xxxxxxxx", (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.formatPhoneNumber7+
@@ -289,23 +310,25 @@ formatPhoneNumber\(phoneNumber: string, options: NumberFormatOptions, callback:
Formats a phone number based on specified formatting options. This function uses an asynchronous callback to return the result.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
- | Name| Type| Mandatory| Description|
- | ----------- | --------------------------- | ---- | ------------------------------------------------------------ |
- | phoneNumber | string | Yes| Phone number.|
- | options | NumberFormatOptions | Yes| Number formatting options defined in [NumberFormatOptions](#NumberFormatOptions).|
- | callback | AsyncCallback<string> | Yes| Callback used to return the result.|
+| Name| Type| Mandatory| Description|
+| ----------- | --------------------------- | ---- | ------------------------------------------------------------ |
+| phoneNumber | string | Yes| Phone number.|
+| options | NumberFormatOptions | Yes| Number formatting options defined in [NumberFormatOptions](#NumberFormatOptions).|
+| callback | AsyncCallback<string> | Yes| Callback used to return the result.|
-- Example
+**Example**
- ```
- call.formatPhoneNumber("138xxxxxxxx",{
- countryCode: "CN"
- }, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+```
+call.formatPhoneNumber("138xxxxxxxx",{
+ countryCode: "CN"
+}, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.formatPhoneNumber7+
@@ -314,31 +337,33 @@ formatPhoneNumber\(phoneNumber: string, options?: NumberFormatOptions\): Promise
Formats a phone number based on specified formatting options. This function uses a promise to return the result.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
- | Name| Type| Mandatory| Description|
- | ----------- | ------------------- | ---- | ------------------------------------------------------------ |
- | phoneNumber | string | Yes| Phone number.|
- | options | NumberFormatOptions | Yes| Number formatting options defined in [NumberFormatOptions](#NumberFormatOptions).|
+**Parameters**
-- Return values
+| Name| Type| Mandatory| Description|
+| ----------- | ------------------- | ---- | ------------------------------------------------------------ |
+| phoneNumber | string | Yes| Phone number.|
+| options | NumberFormatOptions | Yes| Number formatting options defined in [NumberFormatOptions](#NumberFormatOptions).|
- | Type| Description|
- | --------------------- | ------------------------------------------- |
- | Promise<string> | Promise used to return the result.|
+**Return value**
-- Example
+| Type| Description|
+| --------------------- | ------------------------------------------- |
+| Promise<string> | Promise used to return the result.|
- ```
- let promise = call.formatPhoneNumber("138xxxxxxxx", {
- countryCode: "CN"
- });
- promise.then(data => {
- console.log(`formatPhoneNumber success, promise: data->${JSON.stringify(data)}`);
- }).catch(err => {
- console.error(`formatPhoneNumber fail, promise: err->${JSON.stringify(err)}`);
- });
- ```
+**Example**
+
+```
+let promise = call.formatPhoneNumber("138xxxxxxxx", {
+ countryCode: "CN"
+});
+promise.then(data => {
+ console.log(`formatPhoneNumber success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`formatPhoneNumber fail, promise: err->${JSON.stringify(err)}`);
+});
+```
## call.formatPhoneNumberToE1647+
@@ -350,23 +375,25 @@ The phone number must match the specified country code. For example, for a China
All country codes are supported.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
- | Name| Type| Mandatory| Description|
- | ----------- | --------------------------- | ---- | ----------------------------------------------------- |
- | phoneNumber | string | Yes| Phone number.|
- | countryCode | string | Yes| Country code, for example, **CN** (China). All country codes are supported.|
- | callback | AsyncCallback<string> | Yes| Callback used to return the result.|
+| Name| Type| Mandatory| Description|
+| ----------- | --------------------------- | ---- | ----------------------------------------------------- |
+| phoneNumber | string | Yes| Phone number.|
+| countryCode | string | Yes| Country code, for example, **CN** (China). All country codes are supported.|
+| callback | AsyncCallback<string> | Yes| Callback used to return the result.|
-- Example
+**Example**
- ```
- call.formatPhoneNumberToE164("138xxxxxxxx",{
- countryCode: "CN"
- }, (err, data) => {
- console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
- });
- ```
+```
+call.formatPhoneNumberToE164("138xxxxxxxx",{
+ countryCode: "CN"
+}, (err, data) => {
+ console.log(`callback: err->${JSON.stringify(err)}, data->${JSON.stringify(data)}`);
+});
+```
## call.formatPhoneNumberToE1647+
@@ -379,59 +406,71 @@ The phone number must match the specified country code. For example, for a China
All country codes are supported.
-- Parameters
+**System capability**: SystemCapability.Telephony.CallManager
+
+**Parameters**
- | Name| Type| Mandatory| Description|
- | ----------- | ------ | ---- | ---------------------------------------- |
- | phoneNumber | string | Yes| Phone number.|
- | countryCode | string | Yes| Country code, for example, **CN** (China). All country codes are supported.|
+| Name| Type| Mandatory| Description|
+| ----------- | ------ | ---- | ---------------------------------------- |
+| phoneNumber | string | Yes| Phone number.|
+| countryCode | string | Yes| Country code, for example, **CN** (China). All country codes are supported.|
-- Return values
+**Return value**
- | Type| Description|
- | --------------------- | ------------------------------------------------------------ |
- | Promise<string> | Promise used to return the result.|
+| Type| Description|
+| --------------------- | ------------------------------------------------------------ |
+| Promise<string> | Promise used to return the result.|
-- Example
+**Example**
- ```
- let promise = call.formatPhoneNumberToE164("138xxxxxxxx", {
- countryCode: "CN"
- });
- promise.then(data => {
- console.log(`formatPhoneNumberToE164 success, promise: data->${JSON.stringify(data)}`);
- }).catch(err => {
- console.error(`formatPhoneNumberToE164 fail, promise: err->${JSON.stringify(err)}`);
- });
- ```
+```
+let promise = call.formatPhoneNumberToE164("138xxxxxxxx", {
+ countryCode: "CN"
+});
+promise.then(data => {
+ console.log(`formatPhoneNumberToE164 success, promise: data->${JSON.stringify(data)}`);
+}).catch(err => {
+ console.error(`formatPhoneNumberToE164 fail, promise: err->${JSON.stringify(err)}`);
+});
+```
## DialOptions
Provides an option for determining whether a call is a video call.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| extras | boolean | No|Indication of a video call. The options are as follows: - **true**: video call - **false**: voice call|
+| ------ | ------- | ---- | ------------------------------------------------------------ |
+| extras | boolean | No| Indication of a video call. The options are as follows: - **true**: video call - **false**: voice call|
## CallState
Enumerates call states.
+
| Variable| Value| Description|
-| -------- | -------- | -------- |
-| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown.|
-| CALL_STATE_IDLE | 0 | No call is in progress.|
-| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state.|
-| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting.|
+| ------------------ | ---- | ------------------------------------------------------------ |
+| CALL_STATE_UNKNOWN | -1 | The call status fails to be obtained and is unknown. **System capability**: SystemCapability.Telephony.CallManager|
+| CALL_STATE_IDLE | 0 | No call is in progress. **System capability**: SystemCapability.Telephony.CallManager|
+| CALL_STATE_RINGING | 1 | The call is in the ringing or waiting state. **System capability**: SystemCapability.Telephony.CallManager|
+| CALL_STATE_OFFHOOK | 2 | At least one call is in dialing, active, or on hold, and no new incoming call is ringing or waiting. **System capability**: SystemCapability.Telephony.CallManager|
## EmergencyNumberOptions7+
Provides an option for determining whether a number is an emergency number for the SIM card in the specified slot.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| slotId | number | No|SIM card slot ID. - **0**: slot 1 - **1**: slot 2|
+| ------ | ------ | ---- | ------------------------------------------ |
+| slotId | number | No| SIM card slot ID. - **0**: slot 1 - **1**: slot 2|
## NumberFormatOptions7+
Provides an option for number formatting.
+
+**System capability**: SystemCapability.Telephony.CallManager
+
| Name| Type| Mandatory| Description|
-| -------- | -------- | -------- | -------- |
-| countryCode | string | No|Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.|
+| ----------- | ------ | ---- | ---------------------------------------------------------- |
+| countryCode | string | No| Country code, for example, **CN** (China). All country codes are supported. The default value is **CN**.|
diff --git a/en/application-dev/reference/apis/js-apis-camera.md b/en/application-dev/reference/apis/js-apis-camera.md
index 92aef3bc743bc5a1e0466fecbbefa94a274f5af3..c076a882942d2145b641555efd8ac2bd5a504fd4 100644
--- a/en/application-dev/reference/apis/js-apis-camera.md
+++ b/en/application-dev/reference/apis/js-apis-camera.md
@@ -1,5 +1,8 @@
# Camera
+>  **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
```
diff --git a/en/application-dev/reference/apis/js-apis-commonEvent.md b/en/application-dev/reference/apis/js-apis-commonEvent.md
index 31ee5df26f9396629e048888d2a7d4211e526586..32045b0f0c9ed3b12b105e154611456ced48c46b 100644
--- a/en/application-dev/reference/apis/js-apis-commonEvent.md
+++ b/en/application-dev/reference/apis/js-apis-commonEvent.md
@@ -113,7 +113,7 @@
## Modules to Import
```js
-import CommonEvent from '@ohos.commonevent';
+import CommonEvent from '@ohos.commonEvent';
```
## System Capabilities
@@ -169,9 +169,9 @@ Publishes a common event with given attributes. This method uses a callback to r
```js
// Attributes of a common event.
var options = {
- code: 0; // Result code of the common event
- data: "initial data";// Result data of the common event
- isOrdered: true; // The common event is an ordered one.
+ code: 0, // Result code of the common event
+ data: "initial data",// Result data of the common event
+ isOrdered: true // The common event is an ordered one.
}
// Callback for common event publication
function PublishCallBack(err) {
@@ -183,6 +183,79 @@ CommonEvent.publish("publish_event", options, PublishCallBack);
+## CommonEvent.publishAsUser
+
+publishAsUser(event: string, userId: number, callback: AsyncCallback\): void
+
+Publishes a common event to a specific user. This method uses a callback to return the result.
+
+**Parameters**
+
+| Name| Readable/Writable| Type| Mandatory| Description|
+| -------- | -------- | -------------------- | ---- | ---------------------------------- |
+| event | Read-only| string | Yes| Name of the common event to publish.|
+| userId | Read-only| number | Yes| User ID.|
+| callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+```js
+// Callback for common event publication
+function PublishAsUserCallBack(err) {
+ if (err.code) {
+ console.info("publishAsUser failed " + JSON.stringify(err));
+ } else {
+ console.info("publishAsUser");
+ }
+}
+// Specify the user to whom the common event will be published.
+var userId = 100;
+// Publish a common event.
+CommonEvent.publish("publish_event", userId, PublishAsUserCallBack);
+```
+
+
+
+## CommonEvent.publishAsUser
+
+publishAsUser(event: string, userId: number, options: CommonEventPublishData, callback: AsyncCallback\): void
+
+Publishes a common event with given attributes to a specific user. This method uses a callback to return the result.
+
+**Parameters**
+
+| Name| Readable/Writable| Type| Mandatory| Description|
+| -------- | -------- | ---------------------- | ---- | ---------------------- |
+| event | Read-only| string | Yes| Name of the common event to publish.|
+| userId | Read-only| number | Yes| User ID.|
+| options | Read-only| [CommonEventPublishData](#commoneventpublishdata) | Yes| Attributes of the common event to publish.|
+| callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+
+**Example**
+
+
+```js
+// Attributes of a common event.
+var options = {
+ code: 0; // Result code of the common event
+ data: "initial data";// Result data of the common event
+}
+// Callback for common event publication
+function PublishAsUserCallBack(err) {
+ if (err.code) {
+ console.info("publishAsUser failed " + JSON.stringify(err));
+ } else {
+ console.info("publishAsUser");
+ }
+}
+// Specify the user to whom the common event will be published.
+var userId = 100;
+// Publish a common event.
+CommonEvent.publish("publish_event", userId, options, PublishAsUserCallBack);
+```
+
+
+
## CommonEvent.createSubscriber
createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallback\): void
@@ -491,7 +564,7 @@ Sets the result code for this common event. This method uses a promise to return
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | ------------------ |
-| code | number | Yes| Result code of the common event.|
+| code | number | Yes| Callback used to return the result code.|
**Example**
@@ -584,7 +657,7 @@ Sets the result data for this common event. This method uses a promise to return
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | -------------------- |
-| data | string | Yes| Result data of the common event.|
+| data | string | Yes| Callback used to return the result data.|
**Example**
@@ -632,7 +705,7 @@ Sets the result code and result data for this common event. This method uses a p
| Name| Type| Mandatory| Description|
| ------ | ------ | ---- | -------------------- |
| code | number | Yes| Result code of the common event.|
-| data | string | Yes| Result data of the common event.|
+| data | string | Yes| Callback used to return the result data.|
**Example**
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 f91f7a53f00c1183e07f14014bfad6f489f241ca..4045752d3f6cd83bcb09f939fc1670bd1f766a05 100644
--- a/en/application-dev/reference/apis/js-apis-data-ability.md
+++ b/en/application-dev/reference/apis/js-apis-data-ability.md
@@ -1,6 +1,7 @@
# DataAbilityPredicates
-> **NOTE:**
+> **NOTE**
+>
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -9,11 +10,8 @@
import dataAbility from '@ohos.data.dataAbility'
```
## System Capabilities
-SystemCapability.DistributedDataManager.DataShare.Consumer
+SystemCapability.DistributedDataManager.DataShare.Core
-## Required Permissions
-
-None
## dataAbility.createRdbPredicates
@@ -1697,4 +1695,3 @@ Sets the **DataAbilityPredicates** to match the field with data type **Array<
predicates.notIn("NAME", ["Lisa", "Rose"])
```
-
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 e3fc6ff3f954b818b57c59366ebe98987cca9c6c..6d92a418fadd6d56ca0520fbc3b32026a82c037c 100644
--- a/en/application-dev/reference/apis/js-apis-data-rdb.md
+++ b/en/application-dev/reference/apis/js-apis-data-rdb.md
@@ -1,6 +1,7 @@
# Relational Database
->  **NOTE:**
+>  **NOTE**
+>
> The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
diff --git a/en/application-dev/reference/apis/js-apis-data-resultset.md b/en/application-dev/reference/apis/js-apis-data-resultset.md
index c672898f18348a1fcf2f7302e31b8168162c2968..654cff58ad2c45b1d809251a7db2059c82b8928b 100644
--- a/en/application-dev/reference/apis/js-apis-data-resultset.md
+++ b/en/application-dev/reference/apis/js-apis-data-resultset.md
@@ -1,6 +1,7 @@
# Result Set
-> **NOTE:**
+> **NOTE**
+>
>The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## System Capabilities
@@ -8,7 +9,7 @@ SystemCapability.DistributedDataManager.RelationalStore.Core
## Usage
-The **resultSet** object is obtained by using [**RdbStore.query\(\)**](js-apis-data-rdb.md#section6231155031814).
+The **resultSet** object is obtained by using [**RdbStore.query\(\)**](js-apis-data-rdb.md#query).
```
import dataRdb from '@ohos.data.rdb';
@@ -20,9 +21,6 @@ promise.then((resultSet) => {
console.log("resultSet columnCount:" + resultSet.columnCount);
```
-## Required Permissions
-
-None
## ResultSet
@@ -795,4 +793,3 @@ Closes the result set.
})
```
-
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 f58bf8d37324b73d3b9b143ecec10a538730bc59..b8dd0be285a7e325ee0f5a2e7483bdb5d04400f7 100644
--- a/en/application-dev/reference/apis/js-apis-data-storage.md
+++ b/en/application-dev/reference/apis/js-apis-data-storage.md
@@ -2,7 +2,8 @@
Lightweight storage provides applications with data processing capability and allows applications to perform lightweight data storage and query. Data is stored in key-value pairs. Keys are of the string type, and values can be of the numeric, string, or Boolean type.
-> **NOTE:**
+> **NOTE**
+>
>The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
## Modules to Import
@@ -12,11 +13,8 @@ import dataStorage from '@ohos.data.storage'
```
## System Capabilities
-SystemCapability.DistributedDataManager.Preference.Core
+SystemCapability.DistributedDataManager.Preferences.Core
-## Required Permissions
-
-None
## Attributes
@@ -119,7 +117,7 @@ Reads a specified file and loads the data to the **Storage** instance for data
storage.putSync('startup', 'auto')
storage.flushSync()
})()
- ```
+ ```
## dataStorage.getStorage
@@ -180,7 +178,7 @@ Reads a specified file and loads the data to the **Storage** instance for data
storage.flushSync()
})
})()
- ```
+ ```
## dataStorage.getStorage
@@ -248,7 +246,7 @@ Reads a specified file and loads the data to the **Storage** instance for data
console.info("Get the storage failed, path: " + path + '/mystore')
})
}()
- ```
+ ```
## dataStorage.deleteStorageSync
@@ -1614,4 +1612,3 @@ Unsubscribes from data changes.
-
diff --git a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
index dc09e186854d248a51cb7c1260de5db3febb3dee..49e61156a499d926620ecd0aa7bb6455c4aec9c7 100644
--- a/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
+++ b/en/application-dev/reference/apis/js-apis-dataAbilityHelper.md
@@ -1,6 +1,6 @@
# DataAbilityHelper Module (JavaScript SDK APIs)
-#### Modules to Import
+## Modules to Import
```
import featureAbility from '@ohos.ability.featureAbility'
@@ -8,26 +8,27 @@ import ohos_data_ability from '@ohos.data.dataability'
import ohos_data_rdb from '@ohos.data.rdb'
```
-#### DataAbilityHelper.openFile(uri: string, mode: string, callback: AsyncCallback\)
+## DataAbilityHelper
-- Functionality
+### openFile
- Opens a file with a specified URI. This method uses a callback to return the result.
+openFile(uri: string, mode: string, callback: AsyncCallback\): void
+Opens a file with a specified URI. This method uses a callback to return the result.
-* Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------- | -------- | -------------------- | ---- | ------------------------ |
- | uri | Read-only| string | Yes| URI of the file to open.|
- | mode | Read-only| string | Yes| Mode for opening the file. The value can be **rwt**.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-* Return values
+**Parameters**
- Returns a file descriptor.
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ---------------------------------- |
+| uri | string | Yes | URI of the file to open. |
+| mode | string | Yes | Mode for opening the file. The value can be **rwt**. |
+| callback | AsyncCallback\ | Yes | Callback used to return the file descriptor.|
-* Example
+**Example**
```javascript
import featureAbility from '@ohos.ability.featureAbility'
@@ -43,24 +44,29 @@ DAHelper.openFile(
});
```
-#### DataAbilityHelper.openFile(uri: string, mode: string)
+### openFile
-- Functionality
+openFile(uri: string, mode: string): Promise\
- Opens a file with a specified URI. This method uses a promise to return the result.
+Opens a file with a specified URI. This method uses a promise to return the result.
-* Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ---- | -------- | ------ | ---- | ------------------------ |
- | uri | Read-only| string | Yes| URI of the file to open.|
- | mode | Read-only| string | Yes| Mode for opening the file. The value can be **rwt**.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-* Return values
+**Parameters**
- Returns a file descriptor.
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ------------------------ |
+| uri | string | Yes | URI of the file to open.|
+| mode | string | Yes | Mode for opening the file. The value can be **rwt**. |
-* Example
+**Return value**
+| Type | Description |
+| ---------------- | ---------------- |
+| Promise\ | Promise used to return the file descriptor.|
+
+**Example**
```javascript
import featureAbility from '@ohos.ability.featureAbility'
@@ -70,30 +76,30 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
var mode = "rwt";
DAHelper.openFile(
"dataability:///com.example.DataAbility",
- mode).then((void) => {
+ mode).then((data) => {
console.info("==========================>openFileCallback=======================>");
});
```
-#### DataAbilityHelper.on(type: 'dataChange', uri: string, callback: AsyncCallback\)
+### on('dataChange')
-- Functionality
+on(type: 'dataChange', uri: string, callback: AsyncCallback\): void
- Registers an observer to observe data specified by a given URI. This method uses a callback to return the result.
+Registers an observer to observe data specified by a given URI. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------- | -------- | -------------------- | ---- | ------------------------ |
- | type | Read-only| string | Yes| Type of the event to observe. The value is **dataChange**.|
- | uri | Read-only| string | Yes| URI of the data.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback invoked when the data is changed.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- void
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| type | string | Yes | Type of the event to observe. The value is **dataChange**. |
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback\ | Yes | Callback invoked when the data is changed. |
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -110,25 +116,25 @@ helper.on(
)
```
-#### DataAbilityHelper.off(type: 'dataChange', uri: string, callback?: AsyncCallback\)
+### off('dataChange')
-- Functionality
+off(type: 'dataChange', uri: string, callback?: AsyncCallback\): void
- Unregisters the observer used to observe data specified by a given URI. This method uses a callback to return the result.
+Unregisters the observer used to observe data specified by a given URI. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------- | -------- | -------------------- | ---- | ------------------------ |
- | type | Read-only| string | Yes| Type of the event to observe. The value is **dataChange**.|
- | uri | Read-only| string | Yes| URI of the data.|
- | callback | Read-only| AsyncCallback\ | No| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- void
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| type | string | Yes | Type of the event to observe. The value is **dataChange**. |
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback\ | No | Callback used to return the result. |
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -149,24 +155,24 @@ helper.off(
)
```
-#### DataAbilityHelper.getType(uri: string, callback: AsyncCallback\)
+### getType
-- Functionality
+getType(uri: string, callback: AsyncCallback\): void
- Obtains the MIME type of the data specified by a given URI. This method uses a callback to return the result.
+Obtains the MIME type of the data specified by a given URI. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------- | -------- | ---------------------- | ---- | ------------------------ |
- | uri | Read-only| string | Yes| URI of the data.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the MIME type that matches the data specified by the URI.
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | --------------------------------------------- |
+| uri | string | Yes | URI of the data. |
+| callback | AsyncCallback\ | Yes | Callback used to return the MIME type.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -180,23 +186,28 @@ DAHelper.getType(
});
```
-#### DataAbilityHelper.getType(uri: string)
+### getType
+
+getType(uri: string): Promise\
-- Functionality
+Obtains the MIME type of the data specified by a given URI. This method uses a promise to return the result.
- Obtains the MIME type of the data specified by a given URI. This method uses a promise to return the result.
+**System capabilities**
-- Parameters
+SystemCapability.Ability.AbilityRuntime.FAModel
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ---- | -------- | ------ | ---- | ------------------------ |
- | uri | Read-only| string | Yes| URI of the data.|
+**Parameters**
-- Return value
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ------------------------ |
+| uri | string | Yes | URI of the data.|
- Returns the MIME type that matches the data specified by the URI.
+**Return value**
+| Type | Description |
+| ---------------- | ----------------------------------- |
+| Promise\ | Promise used to return the MIME type.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -210,25 +221,25 @@ DAHelper.getType(
});
```
-#### DataAbilityHelper.getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>)
+### getFileTypes
-- Functionality
+getFileTypes(uri: string, mimeTypeFilter: string, callback: AsyncCallback>): void
- Obtains the supported MIME types of a specified file. This method uses a callback to return the result.
+Obtains the supported MIME types of a specified file. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------------- | -------- | ------------------------------ | ---- | ---------------------------- |
- | uri | Read-only| string | Yes| URI of the file.|
- | mimeTypeFilter | Read-only| string | Yes| MIME type of the file.|
- | callback | Read-only| AsyncCallback\> | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns a MIME type array.
+| Name | Type | Mandatory| Description |
+| -------------- | ------------------------------ | ---- | ---------------------------------- |
+| uri | string | Yes | URI of the file. |
+| mimeTypeFilter | string | Yes | MIME type of the file. |
+| callback | AsyncCallback\> | Yes | Callback used to return the supported MIME types.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -243,24 +254,31 @@ DAHelper.getFileTypes(
});
```
-#### DataAbilityHelper.getFileTypes(uri: string, mimeTypeFilter: string)
-- Functionality
- Obtains the supported MIME types of a specified file. This method uses a promise to return the result.
+### getFileTypes
+
+getFileTypes(uri: string, mimeTypeFilter: string): Promise\>
+
+Obtains the supported MIME types of a specified file. This method uses a promise to return the result.
+
+**System capabilities**
-- Parameters
+SystemCapability.Ability.AbilityRuntime.FAModel
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------------- | -------- | ------ | ---- | ---------------------------- |
- | uri | Read-only| string | Yes| URI of the file.|
- | mimeTypeFilter | Read-only| string | Yes| MIME type of the file.|
+**Parameters**
-- Return value
+| Name | Type | Mandatory| Description |
+| -------------- | ------ | ---- | ---------------------------- |
+| uri | string | Yes | URI of the file. |
+| mimeTypeFilter | string | Yes | MIME type of the file.|
- Returns a MIME type array.
+**Return value**
+| Type | Description |
+| ------------------------ | ------------------------ |
+| Promise\> | Promise used to return the supported MIME types.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -275,24 +293,24 @@ DAHelper.getFileTypes(
});
```
-#### DataAbilityHelper.normalizeUri(uri: string, callback: AsyncCallback\)
+### normalizeUri
-- Functionality
+normalizeUri(uri: string, callback: AsyncCallback\): void
- Converts the URI that refers to a Data ability into a normalized URI. This method uses a callback to return the result.
+Converts the URI that refers to a Data ability into a normalized URI. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------- | -------- | ---------------------- | ---- | ----------------------- |
- | uri | Read-only| string | Yes| URI object to normalize.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the normalized URI object if the Data ability supports URI normalization; returns **null** otherwise.
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | ------------------------------------------------------------ |
+| uri | string | Yes | URI object to normalize. |
+| callback | AsyncCallback\ | Yes | Callback used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -306,23 +324,28 @@ DAHelper.normalizeUri(
});
```
-#### DataAbilityHelper.normalizeUri(uri: string)
+### normalizeUri
-- Functionality
+normalizeUri(uri: string): Promise\
- Converts the URI that refers to a Data ability into a normalized URI. This method uses a promise to return the result.
+Converts the URI that refers to a Data ability into a normalized URI. This method uses a promise to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ---- | -------- | ------ | ---- | ----------------------- |
- | uri | Read-only| string | Yes| URI object to normalize.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the normalized URI object if the Data ability supports URI normalization; returns **null** otherwise.
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ----------------------- |
+| uri | string | Yes | URI object to normalize.|
-- Example
+**Return value**
+| Type | Description |
+| ---------------- | ------------------------------------------------------ |
+| Promise\ | Promise used to return the normalized URI object if the Data ability supports URI normalization. If the Data ability does not support URI normalization, **null** is returned.|
+
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -336,24 +359,24 @@ DAHelper.normalizeUri(
});
```
-#### DataAbilityHelper.denormalizeUri(uri: string, callback: AsyncCallback\)
+### denormalizeUri
-- Functionality
+denormalizeUri(uri: string, callback: AsyncCallback\): void
- Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: string, callback: AsyncCallback\)** to a denormalized one. This method uses a callback to return the result.
+Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: string, callback: AsyncCallback\)** to a denormalized one. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------- | -------- | ---------------------- | ---- | ----------------------- |
- | uri | Read-only| string | Yes| URI object to denormalize.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the denormalized URI object.
+| Name | Type | Mandatory| Description |
+| -------- | ---------------------- | ---- | --------------------------------------------------- |
+| uri | string | Yes | URI object to normalize. |
+| callback | AsyncCallback\ | Yes | Callback used to return the denormalized URI object.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -361,29 +384,36 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
DAHelper.denormalizeUri(
- "dataability:///com.example.DataAbility",,
+ "dataability:///com.example.DataAbility",
(err, data) => {
console.info("==========================>Called=======================>");
});
```
-#### DataAbilityHelper.denormalizeUri(uri: string)
-- Functionality
- Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: string)** to a denormalized one. This method uses a promise to return the result.
+### denormalizeUri
+
+denormalizeUri(uri: string): Promise\
+
+Converts a normalized URI generated by **DataAbilityHelper.normalizeUri(uri: string)** to a denormalized one. This method uses a promise to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ---- | -------- | ------ | ---- | ----------------------- |
- | uri | Read-only| string | Yes| URI object to denormalize.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the denormalized URI object.
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ----------------------- |
+| uri | string | Yes | URI object to normalize.|
-- Example
+**Return value**
+| Type | Description |
+| ---------------- | ----------------------------------------- |
+| Promise\ | Promise used to return the denormalized URI object.|
+
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -397,24 +427,24 @@ DAHelper.denormalizeUri(
});
```
-#### DataAbilityHelper.notifyChange(uri: string, callback: AsyncCallback\)
+### notifyChange
-- Functionality
+notifyChange(uri: string, callback: AsyncCallback\): void
- Notifies the registered observer of a change to the data specified by the URI. This method uses a callback to return the result.
+Notifies the registered observer of a change to the data specified by the URI. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | -------- | -------- | -------------------- | ---- | ------------------------ |
- | uri | Read-only| string | Yes| URI of the data.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- void
+| Name | Type | Mandatory| Description |
+| -------- | -------------------- | ---- | ------------------------ |
+| uri | string | Yes | URI of the data.|
+| callback | AsyncCallback\ | Yes | Callback used to return the result. |
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -422,29 +452,34 @@ var helper = featureAbility.acquireDataAbilityHelper(
"dataability:///com.example.DataAbility"
);
helper.notifyChange(
- "dataability:///com.example.DataAbility",,
+ "dataability:///com.example.DataAbility",
(err) => {
console.info("==========================>Called=======================>");
});
```
-#### DataAbilityHelper.notifyChange(uri: string)
+### notifyChange
-- Functionality
+notifyChange(uri: string): Promise\
- Notifies the registered observer of a change to the data specified by the URI. This method uses a promise to return the result.
+Notifies the registered observer of a change to the data specified by the URI. This method uses a promise to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ---- | -------- | ------ | ---- | ------------------------ |
- | uri | Read-only| string | Yes| URI of the data.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- void
+| Name| Type | Mandatory| Description |
+| ---- | ------ | ---- | ------------------------ |
+| uri | string | Yes | URI of the data.|
-- Example
+**Return value**
+| Type | Description |
+| -------------- | --------------------- |
+| Promise\ | Promise used to return the result.|
+
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -453,30 +488,30 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
);
DAHelper.notifyChange(
"dataability:///com.example.DataAbility",
- ).then((void) => {
+ ).then(() => {
console.info("==========================>notifyChangeCallback=======================>");
});
```
-#### DataAbilityHelper.insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback\)
+### insert
-- Functionality
+insert(uri: string, valuesBucket: rdb.ValuesBucket, callback: AsyncCallback\): void
- Inserts a single data record into the database. This method uses a callback to return the result.
+Inserts a single data record into the database. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ------------ | -------- | ---------------------- | ---- | ------------------------------------------------------ |
- | uri | Read-only| string | Yes| URI of the data to insert.|
- | valuesBucket | Read-only| rdb.ValuesBucket | Yes| Data record to insert. If this parameter is **null**, a blank row will be inserted.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the index of the inserted data record.
+| Name | Type | Mandatory| Description |
+| ------------ | ---------------------- | ---- | ------------------------------------------------------ |
+| uri | string | Yes | URI of the data to insert. |
+| valuesBucket | rdb.ValuesBucket | Yes | Data record to insert. If this parameter is **null**, a blank row will be inserted.|
+| callback | AsyncCallback\ | Yes | Callback used to return the index of the inserted data record. |
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -497,24 +532,29 @@ DAHelper.insert(
});
```
-#### DataAbilityHelper.insert(uri: string, valuesBucket: rdb.ValuesBucket)
+### insert
+
+insert(uri: string, valuesBucket: rdb.ValuesBucket): Promise\
-- Functionality
+Inserts a single data record into the database. This method uses a promise to return the result.
- Inserts a single data record into the database. This method uses a promise to return the result.
+**System capabilities**
-- Parameters
+SystemCapability.Ability.AbilityRuntime.FAModel
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ------------ | -------- | ---------------- | ---- | ------------------------------------------------------ |
- | uri | Read-only| string | Yes| URI of the data to insert.|
- | valuesBucket | Read-only| rdb.ValuesBucket | Yes| Data record to insert. If this parameter is **null**, a blank row will be inserted.|
+**Parameters**
-- Return value
+| Name | Type | Mandatory| Description |
+| ------------ | ---------------- | ---- | ------------------------------------------------------ |
+| uri | string | Yes | URI of the data to insert. |
+| valuesBucket | rdb.ValuesBucket | Yes | Data record to insert. If this parameter is **null**, a blank row will be inserted.|
- Returns the index of the inserted data record.
+**Return value**
+| Type | Description |
+| ---------------- | ------------------------ |
+| Promise\ | Promise used to return the index of the inserted data record.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -535,25 +575,25 @@ DAHelper.insert(
});
```
-#### DataAbilityHelper.batchInsert(uri: string, valuesBuckets: Array, callback: AsyncCallback\)
+### batchInsert
-- Functionality
+batchInsert(uri: string, valuesBuckets: Array, callback: AsyncCallback\): void
- Inserts multiple data records into the database. This method uses a callback to return the result.
+Inserts multiple data records into the database. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ------------ | -------- | ----------------------- | ---- | ------------------------ |
- | uri | Read-only| string | Yes| URI of the data to insert.|
- | valuesBucket | Read-only| Array | Yes| Data records to insert.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the number of inserted data records.
+| Name | Type | Mandatory| Description |
+| ------------ | ----------------------- | ---- | -------------------------------- |
+| uri | string | Yes | URI of the data to insert. |
+| valuesBucket | Array | Yes | Data records to insert. |
+| callback | AsyncCallback\ | Yes | Callback used to return the number of inserted data records.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -571,24 +611,29 @@ DAHelper.batchInsert(
});
```
-#### DataAbilityHelper.batchInsert(uri: string, valuesBuckets: Array)
+### batchInsert
-- Functionality
+batchInsert(uri: string, valuesBuckets: Array): Promise\
- Inserts multiple data records into the database. This method uses a promise to return the result.
+Inserts multiple data records into the database. This method uses a promise to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ------------ | -------- | ----------------------- | ---- | ------------------------ |
- | uri | Read-only| string | Yes| URI of the data to insert.|
- | valuesBucket | Read-only| Array | Yes| Data records to insert.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the number of inserted data records.
+| Name | Type | Mandatory| Description |
+| ------------ | ----------------------- | ---- | ------------------------ |
+| uri | string | Yes | URI of the data to insert.|
+| valuesBucket | Array | Yes | Data record to insert. |
-- Example
+**Return value**
+| Type | Description |
+| ---------------- | ---------------------- |
+| Promise\ | Promise used to return the number of inserted data records.|
+
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -606,25 +651,25 @@ DAHelper.batchInsert(
});
```
-#### DataAbilityHelper.delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\)
+### delete
-- Functionality
+delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\): void
- Deletes one or more data records from the database. This method uses a callback to return the result.
+Deletes one or more data records from the database. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ------------ | -------- | --------------------------------- | ---- | ------------------------------------------------ |
- | uri | Read-only| string | Yes| URI of the data to delete.|
- | valuesBucket | Read-only| dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the number of deleted data records.
+| Name | Type | Mandatory| Description |
+| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
+| uri | string | Yes | URI of the data to delete. |
+| valuesBucket | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
+| callback | AsyncCallback\ | Yes | Callback used to return the number of deleted data records. |
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -641,24 +686,29 @@ DAHelper.delete(
});
```
-#### DataAbilityHelper.delete(uri: string, predicates: dataAbility.DataAbilityPredicates)
+### delete
+
+delete(uri: string, predicates: dataAbility.DataAbilityPredicates): Promise\
-- Functionality
+Deletes one or more data records from the database. This method uses a promise to return the result.
- Deletes one or more data records from the database. This method uses a promise to return the result.
+**System capabilities**
-- Parameters
+SystemCapability.Ability.AbilityRuntime.FAModel
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ------------ | -------- | --------------------------------- | ---- | ------------------------------------------------ |
- | uri | Read-only| string | Yes| URI of the data to delete.|
- | valuesBucket | Read-only| dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
+**Parameters**
-- Return value
+| Name | Type | Mandatory| Description |
+| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
+| uri | string | Yes | URI of the data to delete. |
+| valuesBucket | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
- Returns the number of deleted data records.
+**Return value**
+| Type | Description |
+| ---------------- | ------------------------ |
+| Promise\ | Promise used to return the number of deleted data records.|
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -674,26 +724,26 @@ DAHelper.delete(
});
```
-#### DataAbilityHelper.update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\)
+### update
-- Functionality
+update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\): void
- Updates data records in the database. This method uses a callback to return the result.
+Updates data records in the database. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ------------ | -------- | --------------------------------- | ---- | ------------------------------------------------ |
- | uri | Read-only| string | Yes| URI of the data to update.|
- | valuesBucket | Read-only| rdb.ValuesBucket | Yes| New values.|
- | predicates | Read-only| dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the number of updated data records.
+| Name | Type | Mandatory| Description |
+| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
+| uri | string | Yes | URI of the data to update. |
+| valuesBucket | rdb.ValuesBucket | Yes | New values. |
+| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
+| callback | AsyncCallback\ | Yes | Callback used to return the number of updated data records. |
-- Example
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -717,25 +767,30 @@ DAHelper.update(
});
```
-#### DataAbilityHelper.update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates)
+### update
-- Functionality
+update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.DataAbilityPredicates): Promise\
- Updates data records in the database. This method uses a promise to return the result.
+Updates data records in the database. This method uses a promise to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ------------ | -------- | --------------------------------- | ---- | ------------------------------------------------ |
- | uri | Read-only| string | Yes| URI of the data to update.|
- | valuesBucket | Read-only| rdb.ValuesBucket | Yes| New values.|
- | predicates | Read-only| dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the number of updated data records.
+| Name | Type | Mandatory| Description |
+| ------------ | --------------------------------- | ---- | ------------------------------------------------ |
+| uri | string | Yes | URI of the data to update. |
+| valuesBucket | rdb.ValuesBucket | Yes | New values. |
+| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
-- Example
+**Return value**
+| Type | Description |
+| ---------------- | -------------------------------------------- |
+| Promise\ | Promise used to return the number of updated data records.|
+
+**Example**
```js
import featureAbility from '@ohos.ability.featureAbility'
@@ -759,26 +814,26 @@ DAHelper.update(
});
```
-#### DataAbilityHelper.query(uri: string, columns: Array\, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\)
+### query
-- Functionality
+query(uri: string, columns: Array\, predicates: dataAbility.DataAbilityPredicates, callback: AsyncCallback\): void
- Queries data in the database. This method uses a callback to return the result.
+Queries data in the database. This method uses a callback to return the result.
-- Parameters
+**System capabilities**
- | Name| Readable/Writable| Type| Mandatory| Description|
- | ---------- | -------- | --------------------------------- | ---- | ------------------------------------------------ |
- | uri | Read-only| string | Yes| URI of the data to query.|
- | columns | Read-only| rdb.ValuesBucket | Yes| Columns to query. If this parameter is **null**, all columns will be queried.|
- | predicates | Read-only| dataAbility.DataAbilityPredicates | Yes| Filter criteria. You should define the processing logic when this parameter is **null**.|
- | callback | Read-only| AsyncCallback\ | Yes| Callback used to return the result.|
+SystemCapability.Ability.AbilityRuntime.FAModel
-- Return value
+**Parameters**
- Returns the data queried.
+| Name | Type | Mandatory| Description |
+| ---------- | --------------------------------- | ---- | ------------------------------------------------ |
+| uri | string | Yes | URI of the data to query. |
+| columns | rdb.ValuesBucket | Yes | Columns to query. If this parameter is **null**, all columns will be queried. |
+| predicates | dataAbility.DataAbilityPredicates | Yes | Filter criteria. You should define the processing logic when this parameter is **null**.|
+| callback | AsyncCallback\