```
+```css
+/* xxx.css */
+.container {
+ display: flex;
+ flex-direction: column;
+ background-color: #F1F3F5;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+}
+
+canvas {
+ width: 600px;
+ height: 600px;
+ background-color: #fdfdfd;
+ border: none;
+}
+
+.textsize {
+ font-size: 40px;
+}
+```
+
```js
// xxx.js
export default {
@@ -181,12 +229,36 @@ resetTransform(): void
**Example**
```html
-
-
In path:{{textValue}}
-
+
+ In path:{{textValue}}
+
```
+```css
+/* xxx.css */
+.container {
+ display: flex;
+ flex-direction: column;
+ background-color: #F1F3F5;
+ align-items: center;
+ justify-content: center;
+ width: 100%;
+ height: 100%;
+}
+
+canvas {
+ width: 600px;
+ height: 600px;
+ background-color: #fdfdfd;
+ border: none;
+}
+
+.textsize {
+ font-size: 40px;
+}
+```
+
```js
// xxx.js
export default {
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png
index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644
Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777774.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png
index 60f430b646b45a3e3b16a9bb024e4a14e48bf4d3..24edbed60b52947c5effbba951a6523582603f30 100644
Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777775.png differ
diff --git a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png
index 4558b332925757d97d70ee57182c260804629346..24edbed60b52947c5effbba951a6523582603f30 100644
Binary files a/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png and b/en/application-dev/reference/arkui-ts/figures/en-us_image_000000127777779.png differ
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
index bc16a8dd1638b0ad7e1538891707422c60d7ad2b..e4b6ba1ad47c9e06f3f26e6b47f4afd505b6aa36 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textarea.md
@@ -36,7 +36,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| textAlign | [TextAlign](ts-appendix-enums.md#textalign) | Horizontal alignment of the text.
Default value: **TextAlign.Start**|
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. |
| inputFilter
8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.|
-| copyOption
9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.|
+| copyOption
9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.|
## Events
diff --git a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
index 8b4448a11cd29d2cc44f9b70a650f8a195e18bdd..aef50da2fed1f32ad0ceb82aecbf7006fcbae009 100644
--- a/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
+++ b/en/application-dev/reference/arkui-ts/ts-basic-components-textinput.md
@@ -38,7 +38,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| caretColor | [ResourceColor](ts-types.md#resourcecolor) | Color of the caret in the text box. |
| maxLength | number | Maximum number of characters in the text input. |
| inputFilter
8+ | {
value: [ResourceStr](ts-types.md#resourcestr),
error?: (value: string) => void
} | Regular expression for input filtering. Only inputs that comply with the regular expression can be displayed. Other inputs are filtered out. The specified regular expression can match single characters, but not strings.
- **value**: regular expression to set.
- **error**: filtered-out content to return when regular expression matching fails.|
-| copyOption
9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.|
+| copyOption
9+ | [CopyOptions](ts-appendix-enums.md#copyoptions9) | Whether copy and paste is allowed.
If this attribute is set to **CopyOptions.None**, the paste operation is allowed, but not the copy or cut operation.|
| showPasswordIcon
9+ | boolean | Whether to display the show password icon at the end of the password text box.
Default value: **true**|
| style
9+ | TextInputStyle | Text input style.
Default value: **TextInputStyle.Default**|
| textAlign
9+ | [TextAlign](ts-appendix-enums.md#textalign) | Alignment mode of the text in the text box.
Default value: **TextAlign.Start** |
@@ -53,7 +53,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Next | The Enter key is labeled "Next."|
| Done | The Enter key is labeled "Done." |
-## InputType enums
+## InputType
| Name | Description |
| ------------------ | ------------- |
@@ -70,7 +70,7 @@ In addition to the [universal attributes](ts-universal-attributes-size.md), the
| Default | Default style. The caret width is fixed at 1.5 vp, and the caret height is subject to the background height and font size of the selected text. |
| Inline | Inline input style. The background height of the selected text is the same as the height of the text box. |
-## Event
+## Events
In addition to the [universal events](ts-universal-events-click.md), the following events are supported.
diff --git a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
index b198676b1136bc19ff1c4bb0b266162478180339..f0fa614ed3781273928998927cf1bccd4c965efc 100644
--- a/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
+++ b/en/application-dev/reference/arkui-ts/ts-canvasrenderingcontext2d.md
@@ -683,7 +683,7 @@ Fills a rectangle on the canvas.
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
- this.context.fillRect(0,30,100,100)
+ this.context.fillRect(30,30,100,100)
})
}
.width('100%')
@@ -769,7 +769,7 @@ Clears the content in a rectangle on the canvas.
Canvas(this.context)
.width('100%')
.height('100%')
- .backgroundColor('#ffffff')
+ .backgroundColor('#ffff00')
.onReady(() =>{
this.context.fillStyle = 'rgb(0,0,255)'
this.context.fillRect(20,20,200,200)
@@ -1579,7 +1579,7 @@ struct Fill {
region.lineTo(270, 90)
region.closePath()
// Fill path
- this.context.fillStyle = 'green'
+ this.context.fillStyle = '#00ff00'
this.context.fill(region, "evenodd")
})
}
@@ -1666,10 +1666,15 @@ struct Clip {
.backgroundColor('#ffff00')
.onReady(() =>{
let region = new Path2D()
- region.rect(80,10,20,130)
- region.rect(40,50,100,50)
+ region.moveTo(30, 90)
+ region.lineTo(110, 20)
+ region.lineTo(240, 130)
+ region.lineTo(60, 130)
+ region.lineTo(190, 20)
+ region.lineTo(270, 90)
+ region.closePath()
this.context.clip(region,"evenodd")
- this.context.fillStyle = "rgb(255,0,0)"
+ this.context.fillStyle = "rgb(0,255,0)"
this.context.fillRect(0, 0, this.context.width, this.context.height)
})
}
@@ -1745,7 +1750,7 @@ Rotates a canvas clockwise around its coordinate axes.
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
- this.context.rotate(45 * Math.PI / 180) // Rotate the rectangle 45 degrees
+ this.context.rotate(45 * Math.PI / 180)
this.context.fillRect(70, 20, 50, 50)
})
}
@@ -1918,6 +1923,8 @@ setTransform(transform?: Matrix2D): void
Resets the current transformation to the identity matrix, and then creates a new transformation matrix based on the specified **Matrix2D** object. This API is a void API.
+Since API version 9, this API can be used for ArkTS widgets.
+
### translate
@@ -2413,7 +2420,7 @@ Restores the saved drawing context.
.backgroundColor('#ffff00')
.onReady(() =>{
this.context.save() // save the default state
- this.context.fillStyle = "green"
+ this.context.fillStyle = "#00ff00"
this.context.fillRect(20, 20, 100, 100)
this.context.restore() // restore to the default state
this.context.fillRect(150, 75, 100, 100)
@@ -2451,7 +2458,7 @@ Saves all states of the canvas in the stack. This API is usually called when the
.backgroundColor('#ffff00')
.onReady(() =>{
this.context.save() // save the default state
- this.context.fillStyle = "green"
+ this.context.fillStyle = "#00ff00"
this.context.fillRect(20, 20, 100, 100)
this.context.restore() // restore to the default state
this.context.fillRect(150, 75, 100, 100)
@@ -2498,9 +2505,9 @@ Creates a linear gradient.
.backgroundColor('#ffff00')
.onReady(() =>{
var grad = this.context.createLinearGradient(50,0, 300,100)
- grad.addColorStop(0.0, 'red')
- grad.addColorStop(0.5, 'white')
- grad.addColorStop(1.0, 'green')
+ grad.addColorStop(0.0, '#ff0000')
+ grad.addColorStop(0.5, '#ffffff')
+ grad.addColorStop(1.0, '#00ff00')
this.context.fillStyle = grad
this.context.fillRect(0, 0, 500, 500)
})
@@ -2549,9 +2556,9 @@ Creates a linear gradient.
.backgroundColor('#ffff00')
.onReady(() =>{
var grad = this.context.createRadialGradient(200,200,50, 200,200,200)
- grad.addColorStop(0.0, 'red')
- grad.addColorStop(0.5, 'white')
- grad.addColorStop(1.0, 'green')
+ grad.addColorStop(0.0, '#ff0000')
+ grad.addColorStop(0.5, '#ffffff')
+ grad.addColorStop(1.0, '#00ff00')
this.context.fillStyle = grad
this.context.fillRect(0, 0, 500, 500)
})
diff --git a/en/application-dev/reference/arkui-ts/ts-container-navigator.md b/en/application-dev/reference/arkui-ts/ts-container-navigator.md
index e1d2c00f81527d3303b45031d858b76f9537099b..f5c24ce3043f17193050c767bcd8a55ee647779b 100644
--- a/en/application-dev/reference/arkui-ts/ts-container-navigator.md
+++ b/en/application-dev/reference/arkui-ts/ts-container-navigator.md
@@ -27,9 +27,9 @@ Navigator(value?: {target: string, type?: NavigationType})
| Name | Description |
| ------- | -------------------------- |
-| Push | Navigates to a specified page in the application. |
+| Push | Navigates to the specified page in the application. |
| Replace | Replaces the current page with another one in the application and destroys the current page.|
-| Back | Returns to the previous page or a specified page. |
+| Back | Returns to the specified page. If the specified page does not exist in the stack, no response is returned. If no page is specified, the previous page is returned to.|
## Attributes
diff --git a/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md b/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
index 0f7d462061595e1d78647dd6e93dbd0b18f6585e..452637137c4c6794b019eec436bf686af72394b1 100644
--- a/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
+++ b/en/application-dev/reference/arkui-ts/ts-offscreencanvasrenderingcontext2d.md
@@ -727,7 +727,7 @@ Fills a rectangle on the canvas.
.height('100%')
.backgroundColor('#ffff00')
.onReady(() =>{
- this.offContext.fillRect(0,30,100,100)
+ this.offContext.fillRect(30,30,100,100)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
})
@@ -1767,10 +1767,15 @@ struct Clip {
.backgroundColor('#ffff00')
.onReady(() =>{
let region = new Path2D()
- region.rect(80,10,20,130)
- region.rect(40,50,100,50)
+ region.moveTo(30, 90)
+ region.lineTo(110, 20)
+ region.lineTo(240, 130)
+ region.lineTo(60, 130)
+ region.lineTo(190, 20)
+ region.lineTo(270, 90)
+ region.closePath()
this.offContext.clip(region,"evenodd")
- this.offContext.fillStyle = "rgb(255,0,0)"
+ this.offContext.fillStyle = "rgb(0,255,0)"
this.offContext.fillRect(0, 0, 600, 600)
var image = this.offContext.transferToImageBitmap()
this.context.transferFromImageBitmap(image)
diff --git a/en/application-dev/ui/ui-js-components-path2d.md b/en/application-dev/ui/ui-js-components-path2d.md
index 1684f70db7739dbfc6cfe68344a8b3972fad2d37..b6455c4ff2905c2a93e6ba6efffd7360a3872010 100644
--- a/en/application-dev/ui/ui-js-components-path2d.md
+++ b/en/application-dev/ui/ui-js-components-path2d.md
@@ -36,8 +36,6 @@ canvas {
```js
// xxx.js
-import promptAction from '@ohos.promptAction';
-
export default {
onShow() {
let ctx = this.$refs.canvas.getContext('2d', {
@@ -60,7 +58,7 @@ export default {
path.closePath();
// Door
path.moveTo(250, 450);
- path.rect(250, 450, 350, 600);
+ path.rect(250, 450, 100, 600);
path.closePath();
// Chimney
path.moveTo(365, 250);
@@ -139,8 +137,6 @@ text {
```js
// xxx.js
-import promptAction from '@ohos.promptAction';
-
export default {
data: {
ctx: null,
diff --git a/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md b/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md
index 625cdf71496ca71147a8501130de051f315416ce..cc4fd0d13fd0a7177018194c994dd376b50d2272 100644
--- a/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md
+++ b/zh-cn/application-dev/key-features/multi-device-app-dev/responsive-layout.md
@@ -596,7 +596,7 @@ struct GridRowSample6 {
**示例7:**
-通过order属性,控制GridCol的顺序。在sm和md断点下,按照至6的顺序排列显示;在lg断点下,按照6至1的顺序排列显示。
+通过order属性,控制GridCol的顺序。在sm和md断点下,按照1至6的顺序排列显示;在lg断点下,按照6至1的顺序排列显示。
| sm | md | lg |
diff --git a/zh-cn/application-dev/media/audio-capturer.md b/zh-cn/application-dev/media/audio-capturer.md
index 74e09bf19f2d5e75acab07a2132bdf11a87556a6..451362be0bc16f24039f8aabea0c1bc7e12eb15f 100644
--- a/zh-cn/application-dev/media/audio-capturer.md
+++ b/zh-cn/application-dev/media/audio-capturer.md
@@ -21,38 +21,48 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
## 约束与限制
-开发者在进行音频数据采集功能开发前,需要先对所开发的应用配置麦克风权限(ohos.permission.MICROPHONE),权限配置相关内容可参考:[访问控制授权申请指导](../security/accesstoken-guidelines.md)
+开发者在进行音频数据采集功能开发前,需要先对所开发的应用配置麦克风权限(ohos.permission.MICROPHONE),配置方式请参见[访问控制授权申请](../security/accesstoken-guidelines.md#配置文件权限声明)。
## 开发指导
详细API含义可参考:[音频管理API文档AudioCapturer](../reference/apis/js-apis-audio.md#audiocapturer8)
-1. 使用createAudioCapturer()创建一个AudioCapturer实例。
+1. 使用createAudioCapturer()创建一个全局的AudioCapturer实例。
在audioCapturerOptions中设置音频采集器的相关参数。该实例可用于音频采集、控制和获取采集状态,以及注册通知回调。
```js
- import audio from '@ohos.multimedia.audio';
-
- let audioStreamInfo = {
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
- channels: audio.AudioChannel.CHANNEL_1,
- sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
- encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
- }
-
- let audioCapturerInfo = {
- source: audio.SourceType.SOURCE_TYPE_MIC,
- capturerFlags: 0 // 0是音频采集器的扩展标志位,默认为0
- }
-
- let audioCapturerOptions = {
- streamInfo: audioStreamInfo,
- capturerInfo: audioCapturerInfo
- }
-
- let audioCapturer = await audio.createAudioCapturer(audioCapturerOptions);
- console.log('AudioRecLog: Create audio capturer success.');
+ import audio from '@ohos.multimedia.audio';
+ import fs from '@ohos.file.fs'; //便于步骤3 read函数调用
+
+ //音频渲染相关接口自测试
+ @Entry
+ @Component
+ struct AudioRenderer {
+ @State message: string = 'Hello World'
+ private audioCapturer : audio.AudioCapturer; //供全局调用
+
+ async initAudioCapturer(){
+ let audioStreamInfo = {
+ samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
+ channels: audio.AudioChannel.CHANNEL_1,
+ sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
+ encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
+ }
+
+ let audioCapturerInfo = {
+ source: audio.SourceType.SOURCE_TYPE_MIC,
+ capturerFlags: 0 // 0是音频采集器的扩展标志位,默认为0
+ }
+
+ let audioCapturerOptions = {
+ streamInfo: audioStreamInfo,
+ capturerInfo: audioCapturerInfo
+ }
+
+ this.audioCapturer = await audio.createAudioCapturer(audioCapturerOptions);
+ console.log('AudioRecLog: Create audio capturer success.');
+ }
```
2. 调用start()方法来启动/恢复采集任务。
@@ -60,23 +70,18 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
启动完成后,采集器状态将变更为STATE_RUNNING,然后应用可以开始读取缓冲区。
```js
- import audio from '@ohos.multimedia.audio';
-
- async function startCapturer() {
- let state = audioCapturer.state;
+ async startCapturer() {
+ let state = this.audioCapturer.state;
// Capturer start时的状态应该是STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一.
- if (state != audio.AudioState.STATE_PREPARED || state != audio.AudioState.STATE_PAUSED ||
- state != audio.AudioState.STATE_STOPPED) {
- console.info('Capturer is not in a correct state to start');
- return;
- }
- await audioCapturer.start();
-
- state = audioCapturer.state;
- if (state == audio.AudioState.STATE_RUNNING) {
- console.info('AudioRecLog: Capturer started');
- } else {
- console.error('AudioRecLog: Capturer start failed');
+ if (state == audio.AudioState.STATE_PREPARED || state == audio.AudioState.STATE_PAUSED ||
+ state == audio.AudioState.STATE_STOPPED) {
+ await this.audioCapturer.start();
+ state = this.audioCapturer.state;
+ if (state == audio.AudioState.STATE_RUNNING) {
+ console.info('AudioRecLog: Capturer started');
+ } else {
+ console.error('AudioRecLog: Capturer start failed');
+ }
}
}
```
@@ -86,91 +91,88 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
参考以下示例,将采集到的数据写入文件。
```js
- import fs from '@ohos.file.fs';
-
- let state = audioCapturer.state;
- // 只有状态为STATE_RUNNING的时候才可以read.
- if (state != audio.AudioState.STATE_RUNNING) {
- console.info('Capturer is not in a correct state to read');
- return;
- }
-
- const path = '/data/data/.pulse_dir/capture_js.wav'; // 采集到的音频文件存储路径
- let file = fs.openSync(filePath, 0o2);
- let fd = file.fd;
- if (file !== null) {
- console.info('AudioRecLog: file created');
- } else {
- console.info('AudioRecLog: file create : FAILED');
- return;
- }
-
- if (fd !== null) {
- console.info('AudioRecLog: file fd opened in append mode');
- }
-
- let numBuffersToCapture = 150; // 循环写入150次
- let count = 0;
- while (numBuffersToCapture) {
- let bufferSize = await audioCapturer.getBufferSize();
- let buffer = await audioCapturer.read(bufferSize, true);
- let options = {
- offset: count * this.bufferSize,
- length: this.bufferSize
+ async readData(){
+ let state = this.audioCapturer.state;
+ // 只有状态为STATE_RUNNING的时候才可以read.
+ if (state != audio.AudioState.STATE_RUNNING) {
+ console.info('Capturer is not in a correct state to read');
+ return;
}
- if (typeof(buffer) == undefined) {
- console.info('AudioRecLog: read buffer failed');
+ const path = '/data/data/.pulse_dir/capture_js.wav'; // 采集到的音频文件存储路径
+ let file = fs.openSync(path, 0o2);
+ let fd = file.fd;
+ if (file !== null) {
+ console.info('AudioRecLog: file created');
} else {
- let number = fs.writeSync(fd, buffer, options);
- console.info(`AudioRecLog: data written: ${number}`);
- }
- numBuffersToCapture--;
- count++;
+ console.info('AudioRecLog: file create : FAILED');
+ return;
+ }
+ if (fd !== null) {
+ console.info('AudioRecLog: file fd opened in append mode');
+ }
+ let numBuffersToCapture = 150; // 循环写入150次
+ let count = 0;
+ while (numBuffersToCapture) {
+ this.bufferSize = await this.audioCapturer.getBufferSize();
+ let buffer = await this.audioCapturer.read(this.bufferSize, true);
+ let options = {
+ offset: count * this.bufferSize,
+ length: this.bufferSize
+ }
+ if (typeof(buffer) == undefined) {
+ console.info('AudioRecLog: read buffer failed');
+ } else {
+ let number = fs.writeSync(fd, buffer, options);
+ console.info(`AudioRecLog: data written: ${number}`);
+ }
+ numBuffersToCapture--;
+ count++;
+ }
}
```
4. 采集完成后,调用stop方法,停止录制。
```js
- async function StopCapturer() {
- let state = audioCapturer.state;
- // 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止
- if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) {
- console.info('AudioRecLog: Capturer is not running or paused');
- return;
- }
-
- await audioCapturer.stop();
-
- state = audioCapturer.state;
- if (state == audio.AudioState.STATE_STOPPED) {
- console.info('AudioRecLog: Capturer stopped');
- } else {
- console.error('AudioRecLog: Capturer stop failed');
- }
- }
+ async StopCapturer() {
+ let state = this.audioCapturer.state;
+ // 只有采集器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止
+ if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) {
+ console.info('AudioRecLog: Capturer is not running or paused');
+ return;
+ }
+
+ await this.audioCapturer.stop();
+
+ state = this.audioCapturer.state;
+ if (state == audio.AudioState.STATE_STOPPED) {
+ console.info('AudioRecLog: Capturer stopped');
+ } else {
+ console.error('AudioRecLog: Capturer stop failed');
+ }
+ }
```
5. 任务结束,调用release()方法释放相关资源。
```js
- async function releaseCapturer() {
- let state = audioCapturer.state;
- // 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release
- if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) {
- console.info('AudioRecLog: Capturer already released');
- return;
- }
-
- await audioCapturer.release();
-
- state = audioCapturer.state;
- if (state == audio.AudioState.STATE_RELEASED) {
- console.info('AudioRecLog: Capturer released');
- } else {
- console.info('AudioRecLog: Capturer release failed');
- }
- }
+ async releaseCapturer() {
+ let state = this.audioCapturer.state;
+ // 采集器状态不是STATE_RELEASED或STATE_NEW状态,才能release
+ if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) {
+ console.info('AudioRecLog: Capturer already released');
+ return;
+ }
+
+ await this.audioCapturer.release();
+
+ state = this.audioCapturer.state;
+ if (state == audio.AudioState.STATE_RELEASED) {
+ console.info('AudioRecLog: Capturer released');
+ } else {
+ console.info('AudioRecLog: Capturer release failed');
+ }
+ }
```
6. (可选)获取采集器相关信息
@@ -178,23 +180,20 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
通过以下代码,可以获取采集器的相关信息。
```js
- // 获取当前采集器状态
- let state = audioCapturer.state;
-
- // 获取采集器信息
- let audioCapturerInfo : audio.AuduioCapturerInfo = await audioCapturer.getCapturerInfo();
-
- // 获取音频流信息
- let audioStreamInfo : audio.AudioStreamInfo = await audioCapturer.getStreamInfo();
-
- // 获取音频流ID
- let audioStreamId : number = await audioCapturer.getAudioStreamId();
-
- // 获取纳秒形式的Unix时间戳
- let audioTime : number = await audioCapturer.getAudioTime();
-
- // 获取合理的最小缓冲区大小
- let bufferSize : number = await audioCapturer.getBufferSize();
+ async getAudioCapturerInfo(){
+ // 获取当前采集器状态
+ let state = this.audioCapturer.state;
+ // 获取采集器信息
+ let audioCapturerInfo : audio.AudioCapturerInfo = await this.audioCapturer.getCapturerInfo();
+ // 获取音频流信息
+ let audioStreamInfo : audio.AudioStreamInfo = await this.audioCapturer.getStreamInfo();
+ // 获取音频流ID
+ let audioStreamId : number = await this.audioCapturer.getAudioStreamId();
+ // 获取纳秒形式的Unix时间戳
+ let audioTime : number = await this.audioCapturer.getAudioTime();
+ // 获取合理的最小缓冲区大小
+ let bufferSize : number = await this.audioCapturer.getBufferSize();
+ }
```
7. (可选)使用on('markReach')方法订阅采集器标记到达事件,使用off('markReach')取消订阅事件。
@@ -202,12 +201,13 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
注册markReach监听后,当采集器采集的帧数到达设定值时,会触发回调并返回设定的值。
```js
- audioCapturer.on('markReach', (reachNumber) => {
- console.info('Mark reach event Received');
- console.info(`The Capturer reached frame: ${reachNumber}`);
- });
-
- audioCapturer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件
+ async markReach(){
+ this.audioCapturer.on('markReach', 10, (reachNumber) => {
+ console.info('Mark reach event Received');
+ console.info(`The Capturer reached frame: ${reachNumber}`);
+ });
+ this.audioCapturer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件
+ }
```
8. (可选)使用on('periodReach')方法订阅采集器区间标记到达事件,使用off('periodReach')取消订阅事件。
@@ -215,40 +215,43 @@ AudioCapturer提供了用于获取原始音频文件的方法。开发者可以
注册periodReach监听后,**每当**采集器采集的帧数到达设定值时,会触发回调并返回设定的值。
```js
- audioCapturer.on('periodReach', (reachNumber) => {
- console.info('Period reach event Received');
- console.info(`In this period, the Capturer reached frame: ${reachNumber}`);
- });
-
- audioCapturer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件
+ async periodReach(){
+ this.audioCapturer.on('periodReach', 10, (reachNumber) => {
+ console.info('Period reach event Received');
+ console.info(`In this period, the Capturer reached frame: ${reachNumber}`);
+ });
+ this.audioCapturer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件
+ }
```
9. 如果应用需要在采集器状态更新时进行一些操作,可以订阅该事件,当采集器状态更新时,会受到一个包含有事件类型的回调。
```js
- audioCapturer.on('stateChange', (state) => {
- console.info(`AudioCapturerLog: Changed State to : ${state}`)
- switch (state) {
- case audio.AudioState.STATE_PREPARED:
- console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------');
- console.info('Audio State is : Prepared');
- break;
- case audio.AudioState.STATE_RUNNING:
- console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------');
- console.info('Audio State is : Running');
- break;
- case audio.AudioState.STATE_STOPPED:
- console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------');
- console.info('Audio State is : stopped');
- break;
- case audio.AudioState.STATE_RELEASED:
- console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------');
- console.info('Audio State is : released');
- break;
- default:
- console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------');
- console.info('Audio State is : invalid');
- break;
- }
- });
+ async stateChange(){
+ this.audioCapturer.on('stateChange', (state) => {
+ console.info(`AudioCapturerLog: Changed State to : ${state}`)
+ switch (state) {
+ case audio.AudioState.STATE_PREPARED:
+ console.info('--------CHANGE IN AUDIO STATE----------PREPARED--------------');
+ console.info('Audio State is : Prepared');
+ break;
+ case audio.AudioState.STATE_RUNNING:
+ console.info('--------CHANGE IN AUDIO STATE----------RUNNING--------------');
+ console.info('Audio State is : Running');
+ break;
+ case audio.AudioState.STATE_STOPPED:
+ console.info('--------CHANGE IN AUDIO STATE----------STOPPED--------------');
+ console.info('Audio State is : stopped');
+ break;
+ case audio.AudioState.STATE_RELEASED:
+ console.info('--------CHANGE IN AUDIO STATE----------RELEASED--------------');
+ console.info('Audio State is : released');
+ break;
+ default:
+ console.info('--------CHANGE IN AUDIO STATE----------INVALID--------------');
+ console.info('Audio State is : invalid');
+ break;
+ }
+ });
+ }
```
\ No newline at end of file
diff --git a/zh-cn/application-dev/media/audio-renderer.md b/zh-cn/application-dev/media/audio-renderer.md
index 0599b33ab787febb7bfb7f3a38c0312d6cb35ba7..0f9436fc3b7d9e015d71869dc9739e7f5124e154 100644
--- a/zh-cn/application-dev/media/audio-renderer.md
+++ b/zh-cn/application-dev/media/audio-renderer.md
@@ -28,47 +28,59 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
详细API含义可参考:[音频管理API文档AudioRenderer](../reference/apis/js-apis-audio.md#audiorenderer8)
-1. 使用createAudioRenderer()创建一个AudioRenderer实例。
+1. 使用createAudioRenderer()创建一个全局的AudioRenderer实例,以便后续步骤使用。
在audioRendererOptions中设置相关参数。该实例可用于音频渲染、控制和获取渲染状态,以及注册通知回调。
```js
- import audio from '@ohos.multimedia.audio';
-
- let audioStreamInfo = {
- samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
- channels: audio.AudioChannel.CHANNEL_1,
- sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
- encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
- }
- let audioRendererInfo = {
- content: audio.ContentType.CONTENT_TYPE_SPEECH,
- usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
- rendererFlags: 0 // 0是音频渲染器的扩展标志位,默认为0
- }
- let audioRendererOptions = {
- streamInfo: audioStreamInfo,
- rendererInfo: audioRendererInfo
- }
-
- let audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
- console.log("Create audio renderer success.");
+ import audio from '@ohos.multimedia.audio';
+ import fs from '@ohos.file.fs';
+
+ //音频渲染相关接口自测试
+ @Entry
+ @Component
+ struct AudioRenderer1129 {
+ private audioRenderer: audio.AudioRenderer;
+ private bufferSize;//便于步骤3 write函数调用使用
+ private audioRenderer1: audio.AudioRenderer; //便于步骤14 完整示例调用使用
+ private audioRenderer2: audio.AudioRenderer; //便于步骤14 完整示例调用使用
+
+ async initAudioRender(){
+ let audioStreamInfo = {
+ samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_44100,
+ channels: audio.AudioChannel.CHANNEL_1,
+ sampleFormat: audio.AudioSampleFormat.SAMPLE_FORMAT_S16LE,
+ encodingType: audio.AudioEncodingType.ENCODING_TYPE_RAW
+ }
+ let audioRendererInfo = {
+ content: audio.ContentType.CONTENT_TYPE_SPEECH,
+ usage: audio.StreamUsage.STREAM_USAGE_VOICE_COMMUNICATION,
+ rendererFlags: 0 // 0是音频渲染器的扩展标志位,默认为0
+ }
+ let audioRendererOptions = {
+ streamInfo: audioStreamInfo,
+ rendererInfo: audioRendererInfo
+ }
+ this.audioRenderer = await audio.createAudioRenderer(audioRendererOptions);
+ console.log("Create audio renderer success.");
+ }
+ }
```
2. 调用start()方法来启动/恢复播放任务。
```js
- async function startRenderer() {
- let state = audioRenderer.state;
+ async startRenderer() {
+ let state = this.audioRenderer.state;
// Renderer start时的状态应该是STATE_PREPARED、STATE_PAUSED和STATE_STOPPED之一.
if (state != audio.AudioState.STATE_PREPARED && state != audio.AudioState.STATE_PAUSED &&
- state != audio.AudioState.STATE_STOPPED) {
+ state != audio.AudioState.STATE_STOPPED) {
console.info('Renderer is not in a correct state to start');
return;
}
-
- await audioRenderer.start();
-
- state = audioRenderer.state;
+
+ await this.audioRenderer.start();
+
+ state = this.audioRenderer.state;
if (state == audio.AudioState.STATE_RUNNING) {
console.info('Renderer started');
} else {
@@ -81,112 +93,97 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
3. 调用write()方法向缓冲区写入数据。
- 将需要播放的音频数据读入缓冲区,重复调用write()方法写入。
+ 将需要播放的音频数据读入缓冲区,重复调用write()方法写入。请注意引入“import fs from '@ohos.file.fs';”,具体请参考步骤1。
```js
- import fs from '@ohos.file.fs';
- import audio from '@ohos.multimedia.audio';
-
- async function writeBuffer(buf) {
- // 写入数据时,渲染器的状态必须为STATE_RUNNING
- if (audioRenderer.state != audio.AudioState.STATE_RUNNING) {
- console.error('Renderer is not running, do not write');
- return;
- }
- let writtenbytes = await audioRenderer.write(buf);
- console.info(`Actual written bytes: ${writtenbytes} `);
- if (writtenbytes < 0) {
- console.error('Write buffer failed. check the state of renderer');
- }
- }
-
- // 此处是渲染器的合理的最小缓冲区大小(也可以选择其它大小的缓冲区)
- const bufferSize = await audioRenderer.getBufferSize();
- let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径
- const filePath = dir + '/file_example_WAV_2MG.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/file_example_WAV_2MG.wav
- console.info(`file filePath: ${ filePath}`);
-
- let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
- let stat = await fs.stat(filePath); //音乐文件信息
- let buf = new ArrayBuffer(bufferSize);
- let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1);
- for (let i = 0;i < len; i++) {
- let options = {
- offset: i * this.bufferSize,
- length: this.bufferSize
- }
- let readsize = await fs.read(file.fd, buf, options)
- let writeSize = await new Promise((resolve,reject)=>{
- this.audioRenderer.write(buf,(err,writeSize)=>{
- if(err){
- reject(err)
- }else{
- resolve(writeSize)
- }
+ async writeData(){
+ // 此处是渲染器的合理的最小缓冲区大小(也可以选择其它大小的缓冲区)
+ this.bufferSize = await this.audioRenderer.getBufferSize();
+ let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径
+ const filePath = dir + '/file_example_WAV_2MG.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/file_example_WAV_2MG.wav
+ console.info(`file filePath: ${ filePath}`);
+
+ let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
+ let stat = await fs.stat(filePath); //音乐文件信息
+ let buf = new ArrayBuffer(this.bufferSize);
+ let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1);
+ for (let i = 0;i < len; i++) {
+ let options = {
+ offset: i * this.bufferSize,
+ length: this.bufferSize
+ }
+ let readsize = await fs.read(file.fd, buf, options)
+ let writeSize = await new Promise((resolve,reject)=>{
+ this.audioRenderer.write(buf,(err,writeSize)=>{
+ if(err){
+ reject(err)
+ }else{
+ resolve(writeSize)
+ }
+ })
})
- })
+ }
+
+ fs.close(file)
+ await this.audioRenderer.stop(); //停止渲染
+ await this.audioRenderer.release(); //释放资源
}
-
- fs.close(file)
- await audioRenderer.stop(); //停止渲染
- await audioRenderer.release(); //释放资源
```
4. (可选)调用pause()方法或stop()方法暂停/停止渲染音频数据。
```js
- async function pauseRenderer() {
- let state = audioRenderer.state;
- // 只有渲染器状态为STATE_RUNNING的时候才能暂停
- if (state != audio.AudioState.STATE_RUNNING) {
- console.info('Renderer is not running');
- return;
- }
-
- await audioRenderer.pause();
-
- state = audioRenderer.state;
- if (state == audio.AudioState.STATE_PAUSED) {
- console.info('Renderer paused');
- } else {
- console.error('Renderer pause failed');
- }
- }
-
- async function stopRenderer() {
- let state = audioRenderer.state;
- // 只有渲染器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止
- if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) {
- console.info('Renderer is not running or paused');
- return;
- }
-
- await audioRenderer.stop();
-
- state = audioRenderer.state;
- if (state == audio.AudioState.STATE_STOPPED) {
- console.info('Renderer stopped');
- } else {
- console.error('Renderer stop failed');
- }
- }
+ async pauseRenderer() {
+ let state = this.audioRenderer.state;
+ // 只有渲染器状态为STATE_RUNNING的时候才能暂停
+ if (state != audio.AudioState.STATE_RUNNING) {
+ console.info('Renderer is not running');
+ return;
+ }
+
+ await this.audioRenderer.pause();
+
+ state = this.audioRenderer.state;
+ if (state == audio.AudioState.STATE_PAUSED) {
+ console.info('Renderer paused');
+ } else {
+ console.error('Renderer pause failed');
+ }
+ }
+
+ async stopRenderer() {
+ let state = this.audioRenderer.state;
+ // 只有渲染器状态为STATE_RUNNING或STATE_PAUSED的时候才可以停止
+ if (state != audio.AudioState.STATE_RUNNING && state != audio.AudioState.STATE_PAUSED) {
+ console.info('Renderer is not running or paused');
+ return;
+ }
+
+ await this.audioRenderer.stop();
+
+ state = this.audioRenderer.state;
+ if (state == audio.AudioState.STATE_STOPPED) {
+ console.info('Renderer stopped');
+ } else {
+ console.error('Renderer stop failed');
+ }
+ }
```
5. (可选)调用drain()方法清空缓冲区。
```js
- async function drainRenderer() {
- let state = audioRenderer.state;
- // 只有渲染器状态为STATE_RUNNING的时候才能使用drain()
- if (state != audio.AudioState.STATE_RUNNING) {
- console.info('Renderer is not running');
- return;
- }
-
- await audioRenderer.drain();
-
- state = audioRenderer.state;
+ async drainRenderer() {
+ let state = this.audioRenderer.state;
+ // 只有渲染器状态为STATE_RUNNING的时候才能使用drain()
+ if (state != audio.AudioState.STATE_RUNNING) {
+ console.info('Renderer is not running');
+ return;
}
+
+ await this.audioRenderer.drain();
+ state = this.audioRenderer.state;
+ }
```
6. 任务完成,调用release()方法释放相关资源。
@@ -194,23 +191,22 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
AudioRenderer会使用大量的系统资源,所以请确保完成相关任务后,进行资源释放。
```js
- async function releaseRenderer() {
- let state = audioRenderer.state;
- // 渲染器状态不是STATE_RELEASED或STATE_NEW状态,才能release
- if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) {
- console.info('Renderer already released');
- return;
- }
-
- await audioRenderer.release();
+ async releaseRenderer() {
+ let state = this.audioRenderer.state;
+ // 渲染器状态不是STATE_RELEASED或STATE_NEW状态,才能release
+ if (state == audio.AudioState.STATE_RELEASED || state == audio.AudioState.STATE_NEW) {
+ console.info('Renderer already released');
+ return;
+ }
+ await this.audioRenderer.release();
- state = audioRenderer.state;
- if (state == audio.AudioState.STATE_RELEASED) {
- console.info('Renderer released');
- } else {
- console.info('Renderer release failed');
- }
+ state = this.audioRenderer.state;
+ if (state == audio.AudioState.STATE_RELEASED) {
+ console.info('Renderer released');
+ } else {
+ console.info('Renderer release failed');
}
+ }
```
7. (可选)获取渲染器相关信息
@@ -218,26 +214,22 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
通过以下代码,可以获取渲染器的相关信息。
```js
- // 获取当前渲染器状态
- let state = audioRenderer.state;
-
- // 获取渲染器信息
- let audioRendererInfo : audio.AudioRendererInfo = await audioRenderer.getRendererInfo();
-
- // 获取音频流信息
- let audioStreamInfo : audio.AudioStreamInfo = await audioRenderer.getStreamInfo();
-
- // 获取音频流ID
- let audioStreamId : number = await audioRenderer.getAudioStreamId();
-
- // 获取纳秒形式的Unix时间戳
- let audioTime : number = await audioRenderer.getAudioTime();
-
- // 获取合理的最小缓冲区大小
- let bufferSize : number = await audioRenderer.getBufferSize();
-
- // 获取渲染速率
- let renderRate : audio.AudioRendererRate = await audioRenderer.getRenderRate();
+ async getRenderInfo(){
+ // 获取当前渲染器状态
+ let state = this.audioRenderer.state;
+ // 获取渲染器信息
+ let audioRendererInfo : audio.AudioRendererInfo = await this.audioRenderer.getRendererInfo();
+ // 获取音频流信息
+ let audioStreamInfo : audio.AudioStreamInfo = await this.audioRenderer.getStreamInfo();
+ // 获取音频流ID
+ let audioStreamId : number = await this.audioRenderer.getAudioStreamId();
+ // 获取纳秒形式的Unix时间戳
+ let audioTime : number = await this.audioRenderer.getAudioTime();
+ // 获取合理的最小缓冲区大小
+ let bufferSize : number = await this.audioRenderer.getBufferSize();
+ // 获取渲染速率
+ let renderRate : audio.AudioRendererRate = await this.audioRenderer.getRenderRate();
+ }
```
8. (可选)设置渲染器相关信息
@@ -245,17 +237,17 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
通过以下代码,可以设置渲染器的相关信息。
```js
- // 设置渲染速率为正常速度
- let renderRate : audio.AudioRendererRate = audio.AudioRendererRate.RENDER_RATE_NORMAL;
- await audioRenderer.setRenderRate(renderRate);
-
- // 设置渲染器音频中断模式为SHARE_MODE
- let interruptMode : audio.InterruptMode = audio.InterruptMode.SHARE_MODE;
- await audioRenderer.setInterruptMode(interruptMode);
-
- // 设置一个流的音量为0.5
- let volume : number = 0.5;
- await audioRenderer.setVolume(volume);
+ async setAudioRenderInfo(){
+ // 设置渲染速率为正常速度
+ let renderRate : audio.AudioRendererRate = audio.AudioRendererRate.RENDER_RATE_NORMAL;
+ await this.audioRenderer.setRenderRate(renderRate);
+ // 设置渲染器音频中断模式为SHARE_MODE
+ let interruptMode : audio.InterruptMode = audio.InterruptMode.SHARE_MODE;
+ await this.audioRenderer.setInterruptMode(interruptMode);
+ // 设置一个流的音量为0.5
+ let volume : number = 0.5;
+ await this.audioRenderer.setVolume(volume);
+ }
```
9. (可选)使用on('audioInterrupt')方法订阅渲染器音频中断事件,使用off('audioInterrupt')取消订阅事件。
@@ -269,45 +261,45 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
需要说明的是,本模块的订阅音频中断事件与[AudioManager](../reference/apis/js-apis-audio.md#audiomanager)模块中的on('interrupt')稍有不同。自api9以来,on('interrupt')和off('interrupt')均被废弃。在AudioRenderer模块,当开发者需要监听焦点变化事件时,只需要调用on('audioInterrupt')函数,当应用内部的AudioRenderer对象在start\stop\pause等动作发生时,会主动请求焦点,从而发生焦点转移,相关的AudioRenderer对象即可获取到对应的回调信息。但对除AudioRenderer的其他对象,例如FM、语音唤醒等,应用不会创建对象,此时可调用AudioManager中的on('interrupt')获取焦点变化通知。
```js
- audioRenderer.on('audioInterrupt', (interruptEvent) => {
- console.info('InterruptEvent Received');
- console.info(`InterruptType: ${interruptEvent.eventType}`);
- console.info(`InterruptForceType: ${interruptEvent.forceType}`);
- console.info(`AInterruptHint: ${interruptEvent.hintType}`);
-
- if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) {
- switch (interruptEvent.hintType) {
+ async subscribeAudioRender(){
+ this.audioRenderer.on('audioInterrupt', (interruptEvent) => {
+ console.info('InterruptEvent Received');
+ console.info(`InterruptType: ${interruptEvent.eventType}`);
+ console.info(`InterruptForceType: ${interruptEvent.forceType}`);
+ console.info(`AInterruptHint: ${interruptEvent.hintType}`);
+
+ if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_FORCE) {
+ switch (interruptEvent.hintType) {
// 音频框架发起的强制暂停操作,为防止数据丢失,此时应该停止数据的写操作
- case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
- isPlay = false;
- break;
+ case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
+ console.info('isPlay is false');
+ break;
// 音频框架发起的强制停止操作,为防止数据丢失,此时应该停止数据的写操作
- case audio.InterruptHint.INTERRUPT_HINT_STOP:
- isPlay = false;
- break;
+ case audio.InterruptHint.INTERRUPT_HINT_STOP:
+ console.info('isPlay is false');
+ break;
// 音频框架发起的强制降低音量操作
- case audio.InterruptHint.INTERRUPT_HINT_DUCK:
- break;
+ case audio.InterruptHint.INTERRUPT_HINT_DUCK:
+ break;
// 音频框架发起的恢复音量操作
- case audio.InterruptHint.INTERRUPT_HINT_UNDUCK:
- break;
- }
- } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) {
- switch (interruptEvent.hintType) {
+ case audio.InterruptHint.INTERRUPT_HINT_UNDUCK:
+ break;
+ }
+ } else if (interruptEvent.forceType == audio.InterruptForceType.INTERRUPT_SHARE) {
+ switch (interruptEvent.hintType) {
// 提醒App开始渲染
- case audio.InterruptHint.INTERRUPT_HINT_RESUME:
- startRenderer();
- break;
+ case audio.InterruptHint.INTERRUPT_HINT_RESUME:
+ this.startRenderer();
+ break;
// 提醒App音频流被中断,由App自主决定是否继续(此处选择暂停)
- case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
- isPlay = false;
- pauseRenderer();
- break;
+ case audio.InterruptHint.INTERRUPT_HINT_PAUSE:
+ console.info('isPlay is false');
+ this.pauseRenderer();
+ break;
+ }
}
- }
- });
-
- audioRenderer.off('audioInterrupt'); // 取消音频中断事件的订阅,后续将无法监听到音频中断事件
+ });
+ }
```
10. (可选)使用on('markReach')方法订阅渲染器标记到达事件,使用off('markReach')取消订阅事件。
@@ -315,12 +307,14 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
注册markReach监听后,当渲染器渲染的帧数到达设定值时,会触发回调并返回设定的值。
```js
- audioRenderer.on('markReach', (reachNumber) => {
- console.info('Mark reach event Received');
- console.info(`The renderer reached frame: ${reachNumber}`);
- });
-
- audioRenderer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件
+ async markReach(){
+ this.audioRenderer.on('markReach', 50, (position) => {
+ if (position == 50) {
+ console.info('ON Triggered successfully');
+ }
+ });
+ this.audioRenderer.off('markReach'); // 取消markReach事件的订阅,后续将无法监听到“标记到达”事件
+ }
```
11. (可选)使用on('periodReach')方法订阅渲染器区间标记到达事件,使用off('periodReach')取消订阅事件。
@@ -328,12 +322,13 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
注册periodReach监听后,**每当**渲染器渲染的帧数到达设定值时,会触发回调并返回设定的值。
```js
- audioRenderer.on('periodReach', (reachNumber) => {
- console.info('Period reach event Received');
- console.info(`In this period, the renderer reached frame: ${reachNumber} `);
- });
-
- audioRenderer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件
+ async periodReach(){
+ this.audioRenderer.on('periodReach',10, (reachNumber) => {
+ console.info(`In this period, the renderer reached frame: ${reachNumber} `);
+ });
+
+ this.audioRenderer.off('periodReach'); // 取消periodReach事件的订阅,后续将无法监听到“区间标记到达”事件
+ }
```
12. (可选)使用on('stateChange')方法订阅渲染器音频状态变化事件。
@@ -341,10 +336,12 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
注册stateChange监听后,当渲染器的状态发生改变时,会触发回调并返回当前渲染器的状态。
```js
- audioRenderer.on('stateChange', (audioState) => {
- console.info('State change event Received');
- console.info(`Current renderer state is: ${audioState}`);
- });
+ async stateChange(){
+ this.audioRenderer.on('stateChange', (audioState) => {
+ console.info('State change event Received');
+ console.info(`Current renderer state is: ${audioState}`);
+ });
+ }
```
13. (可选)对on()方法的异常处理。
@@ -352,21 +349,24 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
在使用on()方法时,如果传入的字符串错误或传入的参数类型错误,程序会抛出异常,需要用try catch来捕获。
```js
- try {
- audioRenderer.on('invalidInput', () => { // 字符串不匹配
- })
- } catch (err) {
- console.info(`Call on function error, ${err}`); // 程序抛出401异常
- }
- try {
- audioRenderer.on(1, () => { // 入参类型错误
- })
- } catch (err) {
- console.info(`Call on function error, ${err}`); // 程序抛出6800101异常
+ async errorCall(){
+ try {
+ this.audioRenderer.on('invalidInput', () => { // 字符串不匹配
+ })
+ } catch (err) {
+ console.info(`Call on function error, ${err}`); // 程序抛出401异常
+ }
+ try {
+ this.audioRenderer.on(1, () => { // 入参类型错误
+ })
+ } catch (err) {
+ console.info(`Call on function error, ${err}`); // 程序抛出6800101异常
+ }
}
```
14. (可选)on('audioInterrupt')方法完整示例。
+ 请注意:在调用前声明audioRenderer1与audioRenderer2对象,具体请参考步骤1。
同一个应用中的AudioRender1和AudioRender2在创建时均设置了焦点模式为独立,并且调用on('audioInterrupt')监听焦点变化。刚开始AudioRender1拥有焦点,当AudioRender2获取到焦点时,audioRenderer1将收到焦点转移的通知,打印相关日志。如果AudioRender1和AudioRender2不将焦点模式设置为独立,则监听处理中的日志在应用运行过程中永远不会被打印。
```js
async runningAudioRender1(){
@@ -385,31 +385,31 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
-
+
//1.1 创建对象
- audioRenderer1 = await audio.createAudioRenderer(audioRendererOptions);
+ this.audioRenderer1 = await audio.createAudioRenderer(audioRendererOptions);
console.info("Create audio renderer 1 success.");
-
+
//1.2 设置焦点模式为独立模式 :1
- audioRenderer1.setInterruptMode(1).then( data => {
+ this.audioRenderer1.setInterruptMode(1).then( data => {
console.info('audioRenderer1 setInterruptMode Success!');
}).catch((err) => {
console.error(`audioRenderer1 setInterruptMode Fail: ${err}`);
});
-
+
//1.3 设置监听
- audioRenderer1.on('audioInterrupt', async(interruptEvent) => {
+ this.audioRenderer1.on('audioInterrupt', async(interruptEvent) => {
console.info(`audioRenderer1 on audioInterrupt : ${JSON.stringify(interruptEvent)}`)
});
-
+
//1.4 启动渲染
- await audioRenderer1.start();
+ await this.audioRenderer1.start();
console.info('startAudioRender1 success');
-
+
//1.5 获取缓存区大小,此处是渲染器的合理的最小缓冲区大小(也可以选择其它大小的缓冲区)
- const bufferSize = await audioRenderer1.getBufferSize();
+ const bufferSize = await this.audioRenderer1.getBufferSize();
console.info(`audio bufferSize: ${bufferSize}`);
-
+
//1.6 获取原始音频数据文件
let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径
const path1 = dir + '/music001_48000_32_1.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/music001_48000_32_1.wav
@@ -418,14 +418,14 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
let stat = await fs.stat(path1); //音乐文件信息
let buf = new ArrayBuffer(bufferSize);
let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1);
-
+
//1.7 通过audioRender对缓存区的原始音频数据进行渲染
for (let i = 0;i < len; i++) {
let options = {
offset: i * this.bufferSize,
length: this.bufferSize
}
- let readsize = await fs.read(file.fd, buf, options)
+ let readsize = await fs.read(file1.fd, buf, options)
let writeSize = await new Promise((resolve,reject)=>{
this.audioRenderer1.write(buf,(err,writeSize)=>{
if(err){
@@ -434,13 +434,13 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
resolve(writeSize)
}
})
- })
+ })
}
fs.close(file1)
- await audioRenderer1.stop(); //停止渲染
- await audioRenderer1.release(); //释放资源
+ await this.audioRenderer1.stop(); //停止渲染
+ await this.audioRenderer1.release(); //释放资源
}
-
+
async runningAudioRender2(){
let audioStreamInfo = {
samplingRate: audio.AudioSamplingRate.SAMPLE_RATE_48000,
@@ -457,31 +457,31 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
streamInfo: audioStreamInfo,
rendererInfo: audioRendererInfo
}
-
+
//2.1 创建对象
- audioRenderer2 = await audio.createAudioRenderer(audioRendererOptions);
+ this.audioRenderer2 = await audio.createAudioRenderer(audioRendererOptions);
console.info("Create audio renderer 2 success.");
-
+
//2.2 设置焦点模式为独立模式 :1
- audioRenderer2.setInterruptMode(1).then( data => {
+ this.audioRenderer2.setInterruptMode(1).then( data => {
console.info('audioRenderer2 setInterruptMode Success!');
}).catch((err) => {
console.error(`audioRenderer2 setInterruptMode Fail: ${err}`);
});
-
+
//2.3 设置监听
- audioRenderer2.on('audioInterrupt', async(interruptEvent) => {
+ this.audioRenderer2.on('audioInterrupt', async(interruptEvent) => {
console.info(`audioRenderer2 on audioInterrupt : ${JSON.stringify(interruptEvent)}`)
});
-
+
//2.4 启动渲染
- await audioRenderer2.start();
+ await this.audioRenderer2.start();
console.info('startAudioRender2 success');
-
+
//2.5 获取缓存区大小
- const bufferSize = await audioRenderer2.getBufferSize();
+ const bufferSize = await this.audioRenderer2.getBufferSize();
console.info(`audio bufferSize: ${bufferSize}`);
-
+
//2.6 获取原始音频数据文件
let dir = globalThis.fileDir; //不可直接访问,没权限,切记!!!一定要使用沙箱路径
const path2 = dir + '/music002_48000_32_1.wav'; // 需要渲染的音乐文件 实际路径为:/data/storage/el2/base/haps/entry/files/music002_48000_32_1.wav
@@ -490,14 +490,14 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
let stat = await fs.stat(path2); //音乐文件信息
let buf = new ArrayBuffer(bufferSize);
let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1);
-
+
//2.7 通过audioRender对缓存区的原始音频数据进行渲染
for (let i = 0;i < len; i++) {
let options = {
offset: i * this.bufferSize,
length: this.bufferSize
}
- let readsize = await fs.read(file.fd, buf, options)
+ let readsize = await fs.read(file2.fd, buf, options)
let writeSize = await new Promise((resolve,reject)=>{
this.audioRenderer2.write(buf,(err,writeSize)=>{
if(err){
@@ -506,28 +506,17 @@ AudioRenderer提供了渲染音频文件和控制播放的接口,开发者可
resolve(writeSize)
}
})
- })
+ })
}
fs.close(file2)
- await audioRenderer2.stop(); //停止渲染
- await audioRenderer2.release(); //释放资源
+ await this.audioRenderer2.stop(); //停止渲染
+ await this.audioRenderer2.release(); //释放资源
}
-
- async writeBuffer(buf, audioRender) {
- let writtenbytes;
- await audioRender.write(buf).then((value) => {
- writtenbytes = value;
- console.info(`Actual written bytes: ${writtenbytes} `);
- });
- if (typeof(writtenbytes) != 'number' || writtenbytes < 0) {
- console.error('get Write buffer failed. check the state of renderer');
- }
- }
-
+
//综合调用入口
async test(){
- await runningAudioRender1();
- await runningAudioRender2();
+ await this.runningAudioRender1();
+ await this.runningAudioRender2();
}
-
+
```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/Readme-CN.md b/zh-cn/application-dev/reference/apis/Readme-CN.md
index d32b9130b137ef42bedee53ba4bd476e1c5e0c9e..1be5984acb3886e647ebf709c03f2e3824dcdabb 100755
--- a/zh-cn/application-dev/reference/apis/Readme-CN.md
+++ b/zh-cn/application-dev/reference/apis/Readme-CN.md
@@ -126,7 +126,11 @@
- [@ohos.notification (Notification模块)(待停用)](js-apis-notification.md)
- application
- [EventHub](js-apis-inner-application-eventHub.md)
-
+ - commonEvent
+ - [CommonEventData](js-apis-inner-commonEvent-commonEventData.md)
+ - [CommonEventPublishData](js-apis-inner-commonEvent-commonEventPublishData.md)
+ - [CommonEventSubscriber](js-apis-inner-commonEvent-commonEventSubscriber.md)
+ - [CommonEventSubscribeInfo](js-apis-inner-commonEvent-commonEventSubscribeInfo.md)
- 包管理
- [@ohos.bundle.appControl (appControl模块)](js-apis-appControl.md)
- [@ohos.bundle.bundleManager (bundleManager模块)](js-apis-bundleManager.md)
diff --git a/zh-cn/application-dev/reference/apis/js-apis-audio.md b/zh-cn/application-dev/reference/apis/js-apis-audio.md
index a147cdf9888d5fb9f2a864fc3745302c8bc04beb..da9ebd7910c30838f31cfa03dd995549846759cb 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-audio.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-audio.md
@@ -4533,15 +4533,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let stat = await fs.stat(path);
let buf = new ArrayBuffer(bufferSize);
-let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1);
+let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
for (let i = 0;i < len; i++) {
let options = {
- offset: i * this.bufferSize,
- length: this.bufferSize
+ offset: i * bufferSize,
+ length: bufferSize
}
let readsize = await fs.read(file.fd, buf, options)
let writeSize = await new Promise((resolve,reject)=>{
- this.audioRenderer.write(buf,(err,writeSize)=>{
+ audioRenderer.write(buf,(err,writeSize)=>{
if(err){
reject(err)
}else{
@@ -4586,15 +4586,15 @@ let filePath = path + '/StarWars10s-2C-48000-4SW.wav';
let file = fs.openSync(filePath, fs.OpenMode.READ_ONLY);
let stat = await fs.stat(path);
let buf = new ArrayBuffer(bufferSize);
-let len = stat.size % this.bufferSize == 0 ? Math.floor(stat.size / this.bufferSize) : Math.floor(stat.size / this.bufferSize + 1);
+let len = stat.size % bufferSize == 0 ? Math.floor(stat.size / bufferSize) : Math.floor(stat.size / bufferSize + 1);
for (let i = 0;i < len; i++) {
let options = {
- offset: i * this.bufferSize,
- length: this.bufferSize
+ offset: i * bufferSize,
+ length: bufferSize
}
let readsize = await fs.read(file.fd, buf, options)
try{
- let writeSize = await this.audioRenderer.write(buf);
+ let writeSize = await audioRenderer.write(buf);
} catch(err) {
console.error(`audioRenderer.write err: ${err}`);
}
diff --git a/zh-cn/application-dev/reference/apis/js-apis-avsession.md b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
index 2c34a0244668b9b6bd9df550d095a47218f93f2d..c66da322f6c62a2e6746b440a60f29d18d80bfdc 100755
--- a/zh-cn/application-dev/reference/apis/js-apis-avsession.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-avsession.md
@@ -24,6 +24,8 @@ createAVSession(context: Context, tag: string, type: AVSessionType): Promise\
void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -531,6 +537,8 @@ off(type: 'sessionServiceDie', callback?: () => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -763,6 +771,8 @@ avSession.sendSystemControlCommand(avcommand, function (err) {
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 类型 | 可读 | 可写 | 说明 |
| :-------- | :----- | :--- | :--- | :---------------------------- |
@@ -782,6 +792,8 @@ setAVMetadata(data: AVMetadata): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -836,6 +848,8 @@ setAVMetadata(data: AVMetadata, callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -887,6 +901,8 @@ setAVPlaybackState(state: AVPlaybackState): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -933,6 +949,8 @@ setAVPlaybackState(state: AVPlaybackState, callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -976,6 +994,8 @@ setLaunchAbility(ability: WantAgent): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1046,6 +1066,8 @@ setLaunchAbility(ability: WantAgent, callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1113,6 +1135,8 @@ getController(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -1147,6 +1171,8 @@ getController(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1183,6 +1209,8 @@ getOutputDevice(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -1215,6 +1243,8 @@ getOutputDevice(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1249,6 +1279,8 @@ activate(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -1281,6 +1313,8 @@ activate(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1315,6 +1349,8 @@ deactivate(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -1349,6 +1385,8 @@ deactivate(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1383,6 +1421,8 @@ destroy(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -1413,9 +1453,10 @@ destroy(callback: AsyncCallback\): void
销毁当前会话,使当前会话完全失效。结果通过callback异步回调方式返回。
-
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1450,6 +1491,8 @@ on(type: 'play'|'pause'|'stop'|'playNext'|'playPrevious'|'fastForward'|'rewind',
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1499,6 +1542,8 @@ on(type: 'seek', callback: (time: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1530,6 +1575,8 @@ on(type: 'setSpeed', callback: (speed: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1561,6 +1608,8 @@ on(type: 'setLoopMode', callback: (mode: LoopMode) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1592,6 +1641,8 @@ on(type: 'toggleFavorite', callback: (assetId: string) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1623,6 +1674,8 @@ on(type: 'handleKeyEvent', callback: (event: KeyEvent) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1654,6 +1707,8 @@ on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): vo
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1685,6 +1740,8 @@ off(type: 'play' | 'pause' | 'stop' | 'playNext' | 'playPrevious' | 'fastForward
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1720,6 +1777,8 @@ off(type: 'seek', callback?: (time: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1749,6 +1808,8 @@ off(type: 'setSpeed', callback?: (speed: number) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1778,6 +1839,8 @@ off(type: 'setLoopMode', callback?: (mode: LoopMode) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1807,6 +1870,8 @@ off(type: 'toggleFavorite', callback?: (assetId: string) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1836,6 +1901,8 @@ off(type: 'handleKeyEvent', callback?: (event: KeyEvent) => void): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1865,6 +1932,8 @@ off(type: 'outputDeviceChange', callback?: (device: OutputDeviceInfo) => void):
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1896,6 +1965,7 @@ session.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
| 名称 | 类型 | 可读 | 可写 | 说明 |
| :-------- | :----- | :--- | :--- | :-------------------------------------- |
@@ -1920,6 +1990,8 @@ getAVPlaybackState(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -1952,6 +2024,8 @@ getAVPlaybackState(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -1986,6 +2060,8 @@ getAVMetadata(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -2018,6 +2094,8 @@ getAVMetadata(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2052,6 +2130,8 @@ getOutputDevice(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -2083,6 +2163,8 @@ getOutputDevice(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2117,6 +2199,8 @@ sendAVKeyEvent(event: KeyEvent): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2161,6 +2245,8 @@ sendAVKeyEvent(event: KeyEvent, callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2202,6 +2288,8 @@ getLaunchAbility(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -2237,6 +2325,8 @@ getLaunchAbility(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2274,6 +2364,8 @@ getRealPlaybackPositionSync(): number
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -2302,6 +2394,8 @@ isActive(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -2335,6 +2429,8 @@ isActive(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2370,6 +2466,8 @@ destroy(): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -2402,6 +2500,8 @@ destroy(callback: AsyncCallback\): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2436,6 +2536,8 @@ getValidCommands(): Promise\>
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**返回值:**
| 类型 | 说明 |
@@ -2469,6 +2571,8 @@ getValidCommands(callback: AsyncCallback\>): void
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2504,6 +2608,8 @@ sendControlCommand(command: AVControlCommand): Promise\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2557,6 +2663,8 @@ sendControlCommand(command: AVControlCommand, callback: AsyncCallback\): v
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2607,6 +2715,8 @@ on(type: 'metadataChange', filter: Array\ | 'all', callback: (
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2644,6 +2754,8 @@ on(type: 'playbackStateChange', filter: Array\ | 'all', c
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2681,6 +2793,8 @@ on(type: 'sessionDestroy', callback: () => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2712,6 +2826,8 @@ on(type: 'activeStateChange', callback: (isActive: boolean) => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2743,6 +2859,8 @@ on(type: 'validCommandChange', callback: (commands: Array\
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2775,6 +2893,8 @@ on(type: 'outputDeviceChange', callback: (device: OutputDeviceInfo) => void): vo
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2806,6 +2926,8 @@ off(type: 'metadataChange', callback?: (data: AVMetadata) => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2834,6 +2956,8 @@ off(type: 'playbackStateChange', callback?: (state: AVPlaybackState) => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2862,6 +2986,8 @@ off(type: 'sessionDestroy', callback?: () => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2890,6 +3016,8 @@ off(type: 'activeStateChange', callback?: (isActive: boolean) => void)
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2918,6 +3046,8 @@ off(type: 'validCommandChange', callback?: (commands: Array\ void):
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
@@ -2987,6 +3119,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口。
+
| 名称 | 类型 | 说明 |
| ----- | ------ | ---- |
| audio | string | 音频 |
@@ -3016,6 +3150,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 类型 | 说明 |
| -------------- | ------ | ------------ |
| play | string | 播放 |
@@ -3036,6 +3172,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 类型 | 必填 | 说明 |
| --------- | ------------------------------------------------- | ---- | -------------- |
| command | [AVControlCommandType](#avcontrolcommandtype) | 是 | 命令 |
@@ -3047,6 +3185,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 类型 | 必填 | 说明 |
| --------------- |-------------------------| ---- |---------------------------------------------------------------------|
| assetId | string | 是 | 媒体ID。 |
@@ -3071,6 +3211,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 类型 | 必填 | 说明 |
| ------------ | ------------------------------------- | ---- | ------- |
| state | [PlaybackState](#playbackstate) | 否 | 播放状态 |
@@ -3086,6 +3228,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 类型 | 必填 | 说明 |
| ----------- | ------ | ---- | ------------------ |
| elapsedTime | number | 是 | 已用时间,单位毫秒(ms)。 |
@@ -3097,6 +3241,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 类型 | 必填 | 说明 |
| ---------- | -------------- | ---- | ---------------------- |
| isRemote | boolean | 是 | 设备是否连接。 |
@@ -3109,6 +3255,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 值 | 说明 |
| --------------------------- | ---- | ----------- |
| PLAYBACK_STATE_INITIAL | 0 | 初始状态 |
@@ -3126,6 +3274,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 值 | 说明 |
| ------------------ | ---- | -------- |
| LOOP_MODE_SEQUENCE | 0 | 顺序播放 |
@@ -3139,6 +3289,8 @@ controller.off('outputDeviceChange');
**系统能力:** SystemCapability.Multimedia.AVSession.Core
+**系统接口:** 该接口为系统接口
+
| 名称 | 值 | 说明 |
| ------------------------------ | ------- | ------------------------------- |
| ERR_CODE_SERVICE_EXCEPTION | 6600101 | Session service exception. |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md
index c0d953dfd155000f859be1ad24b5d2fc1ecf1a5b..15103ae6cd763d2b54bb4c11955df34ad1be5325 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-bundle-BundleInstaller.md
@@ -188,8 +188,8 @@ bundle.getBundleInstaller().then(installer => {
**示例:**
``` ts
// Stage模型
-import Ability from '@ohos.application.Ability';
-class MainAbility extends Ability {
+import UIAbility from '@ohos.app.ability.UIAbility';
+export default class EntryAbility extends UIAbility {
onWindowStageCreate(windowStage) {
let context = this.context;
let pathDir = context.filesDir;
diff --git a/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md b/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md
index 55635168340b262a37f109b58395a2280ea42293..e6f45e0b61932ac8decda26b0537c33b5f8724b4 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-cardEmulation.md
@@ -16,31 +16,37 @@ import cardEmulation from '@ohos.nfc.cardEmulation';
定义不同的NFC卡模拟类型。
+> **说明:**
+> 从 API version 6 开始支持,从 API version 9 开始废弃,建议使用[hasHceCapability](#hashcecapability9)替代。
+
**系统能力:** SystemCapability.Communication.NFC.CardEmulation
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| HCE | 0 | HCE 卡模拟。 |
| UICC | 1 | SIM 卡模拟。 |
-| ESE | 2 | ESE卡模拟。 |
+| ESE | 2 | ESE卡模拟。 |
-## CardType
+## CardType9+
-定义卡模拟应用是支付类型,还是非支付类型。
+定义卡模拟应用所使用的业务类型,是支付类型,还是其他类型。
**系统能力:** SystemCapability.Communication.NFC.CardEmulation
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
-| PAYMENT | "payment" | 卡模拟应用是支付类型。 |
-| OTHER | "other" | 卡模拟应用是非支付类型。 |
+| PAYMENT | "payment" | 卡模拟应用所使用的业务是支付类型。 |
+| OTHER | "other" | 卡模拟应用所使用的业务是其他类型。 |
-## cardEmulation.isSupported
+## isSupported
isSupported(feature: number): boolean
是否支持某种类型的卡模拟。
+> **说明:**
+> 从 API version 6 开始支持,从 API version 9 开始废弃,建议使用[hasHceCapability](#hashcecapability9)替代。
+
**系统能力:** SystemCapability.Communication.NFC.CardEmulation
**参数:**
@@ -55,89 +61,44 @@ isSupported(feature: number): boolean
| -------- | -------- |
| boolean | true: 支持该类型卡模拟, false: 不支持该类型卡模拟。|
-## cardEmulation.isDefaultService
+## hasHceCapability9+
-isDefaultService(elementName: ElementName, type: CardType): boolean
+hasHceCapability(): boolean
-判断指定的应用是否为默认支付应用。
+判断是否支持HCE功能。
**系统能力:** SystemCapability.Communication.NFC.CardEmulation
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| ------- | -------- | ---- | ----------------------- |
-| elementName | [ElementName](js-apis-bundleManager-elementName.md#elementname) | 是 | 应用的描述,由包名和组件名组成。 |
-| type | [CardType](#cardtype) | 是 | 应用的描述,由包名和组件名组成。 |
+**需要权限:** ohos.permission.NFC_CARD_EMULATION
**返回值:**
| **类型** | **说明** |
| -------- | -------- |
-| boolean | true: 是默认支付应用, false: 不是默认支付应用。|
-
-## HceService8+
+| boolean | true: 支持HCE, false: 不支持HCE。|
-提供HCE卡模拟的实现,主要包括接收对端读卡设备的APDU数据,并响应APDU数据到对端读卡设备。使用HCE相关接口前,必须先判断设备是否支持HCE卡模拟能力。
+## isDefaultService9+
-### startHCE8+
+isDefaultService(elementName: ElementName, type: CardType): boolean
-startHCE(aidList: string[]): boolean
+判断指定的应用是否为指定业务类型的默认应用。
-启动HCE业务功能。包括设置当前应用为前台优先,动态注册AID列表。
+**系统能力:** SystemCapability.Communication.NFC.CardEmulation
**需要权限:** ohos.permission.NFC_CARD_EMULATION
-**系统能力:** SystemCapability.Communication.NFC.CardEmulation
-
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------- | ---- | ----------------------- |
-| aidList | string[] | 是 | 动态注册卡模拟的AID列表。 |
-
-### stopHCE8+
-
-stopHCE(): boolean
-
-停止HCE业务功能。包括退出当前应用前台优先,释放动态注册的AID列表。
-
-**需要权限:** ohos.permission.NFC_CARD_EMULATION
-
-**系统能力:** SystemCapability.Communication.NFC.CardEmulation
-
-### on8+
-
-on(type: "hceCmd", callback: AsyncCallback): void;
+| elementName | [ElementName](js-apis-bundleManager-elementName.md#elementname) | 是 | 应用的描述,由Bundle名称和组件名称组成。 |
+| type | [CardType](#cardtype9) | 是 | 卡模拟业务类型。 |
-订阅回调,用于接收对端读卡设备发送的APDU数据。
-
-**需要权限:** ohos.permission.NFC_CARD_EMULATION
-
-**系统能力:** SystemCapability.Communication.NFC.CardEmulation
-
-**参数:**
-
-| 参数名 | 类型 | 必填 | 说明 |
-| -------- | ----------------------- | ---- | -------------------------------------------- |
-| type | string | 是 | 固定填"hceCmd"字符串。 |
-| callback | AsyncCallback | 是 | 订阅的事件回调,入参是符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 |
-
-### sendResponse8+
-
-sendResponse(responseApdu: number[]): void;
-
-发送APDU数据到对端读卡设备。
-
-**需要权限:** ohos.permission.NFC_CARD_EMULATION
-
-**系统能力:** SystemCapability.Communication.NFC.CardEmulation
-
-**参数:**
+**返回值:**
-| 参数名 | 类型 | 必填 | 说明 |
-| ------------ | -------- | ---- | -------------------------------------------------- |
-| responseApdu | number[] | 是 | 发送到对端读卡设备的符合APDU协议的数据,每个number十六进制表示,范围是0x00~0xFF。 |
+| **类型** | **说明** |
+| -------- | -------- |
+| boolean | true: 是默认支付应用, false: 不是默认支付应用。|
**示例:**
@@ -150,31 +111,17 @@ if (!isHceSupported) {
return;
}
+var hasHceCap = cardEmulation.hasHceCapability();
+if (!hasHceCap) {
+ console.log('this device hasHceCapability false, ignore it.');
+ return;
+}
+
var elementName = {
"bundleName": "com.test.cardemulation",
"abilityName": "com.test.cardemulation.MainAbility",
};
var isDefaultService = cardEmulation.isDefaultService(elementName, cardEmulation.CardType.PAYMENT);
console.log('is the app is default service for this card type: ' + isDefaultService);
-
-// device supports HCE, transimit APDU with remote nfc reader.
-var hceService = new cardEmulation.HceService();
-hceService.startHCE([
- "F0010203040506", "A0000000041010"
-]);
-
-hceService.on("hceCmd", (err, res) => {
- if(err.data === 0) {
- console.log('callback => Operation hceCmd succeeded. Data: ' + JSON.stringify(res));
- hceService.sendResponse([0x00,0xa4,0x04,0x00,
- 0x0e,0x32,0x50,0x41,0x59,0x2e,0x53,0x59,0x53,0x2e,0x44,0x44,
- 0x46,0x30,0x31,0x00]);
- } else {
- console.log('callback => Operation hceCmd failed. Cause: ' + err.data);
- }
-})
-
-// stop HCE when the application exit the nfc card emulation.
-hceService.stopHCE();
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md
index 9941ef38f7e3690cb0d898a136b76c9227411708..0f40c6b4470077461507bc03429f739432627ca6 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-commonEvent.md
@@ -171,7 +171,7 @@ CommonEvent模块支持的事件类型。名称指的是系统公共事件宏;
| COMMON_EVENT_SLOT_CHANGE9+ | usual.event.SLOT_CHANGE | ohos.permission.NOTIFICATION_CONTROLLER | 表示通知通道更新的动作。 |
| COMMON_EVENT_SPN_INFO_CHANGED 9+ | usual.event.SPN_INFO_CHANGED | 无 | 表示spn显示信息已更新的公共事件的动作。 |
| COMMON_EVENT_QUICK_FIX_APPLY_RESULT 9+ | usual.event.QUICK_FIX_APPLY_RESULT | 无 | 指示快速修复应用的动作。 |
-
+| COMMON_EVENT_USER_INFO_UPDATED9+ | usual.event.USER_INFO_UPDATED | 无 | 表示用户信息已更新。|
## CommonEvent.publish
@@ -219,7 +219,7 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---------------------- |
| event | string | 是 | 表示要发布的公共事件。 |
-| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 |
+| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 |
| callback | syncCallback\ | 是 | 表示被指定的回调方法。 |
**示例:**
@@ -303,7 +303,7 @@ publishAsUser(event: string, userId: number, options: CommonEventPublishData, ca
| -------- | ---------------------- | ---- | ---------------------- |
| event | string | 是 | 表示要发布的公共事件。 |
| userId | number | 是 | 表示指定向该用户ID发送此公共事件。 |
-| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 |
+| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 |
| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 |
**示例:**
@@ -346,8 +346,8 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallbac
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ------------------------------------------------------------ | ---- | -------------------------- |
-| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 |
-| callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | 是 | 表示创建订阅者的回调方法。 |
+| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 |
+| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 是 | 表示创建订阅者的回调方法。 |
**示例:**
@@ -388,12 +388,12 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\ | 返回订阅者对象。 |
+| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 返回订阅者对象。 |
**示例:**
@@ -428,8 +428,8 @@ subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\ | 是 | 表示接收公共事件数据的回调函数。 |
+| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 |
+| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | 是 | 表示接收公共事件数据的回调函数。 |
**示例:**
@@ -480,7 +480,7 @@ unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\):
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------------------------------- | ---- | ------------------------ |
-| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | 是 | 表示订阅者对象。 |
+| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 |
| callback | AsyncCallback\ | 否 | 表示取消订阅的回调方法。 |
**示例:**
@@ -526,6 +526,7 @@ function unsubscribeCallBack(err) {
//创建订阅者
CommonEvent.createSubscriber(subscribeInfo, createSubscriberCallBack);
+<<<<<<< HEAD
//取消订阅公共事件
CommonEvent.unsubscribe(subscriber, unsubscribeCallBack);
```
@@ -1278,4 +1279,9 @@ subscriber.finishCommonEvent().then(() => {
| publisherPermission | string | 是 | 否 | 表示发布者的权限。 |
| publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 |
| userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 |
-| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 |
\ No newline at end of file
+| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 |
+=======
+// 取消订阅公共事件
+CommonEvent.unsubscribe(subscriber, unsubscribeCB);
+```
+>>>>>>> a6c9265cd... common event docs fix
diff --git a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md
index dd47e484e156504cf2e276cdfa7dbc0590f31621..c7059bfaab20ed3baa1d049f7e98329e2e4fc088 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-commonEventManager.md
@@ -235,7 +235,7 @@ publish(event: string, options: CommonEventPublishData, callback: AsyncCallback\
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ---------------------- |
| event | string | 是 | 表示要发布的公共事件。 |
-| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 |
+| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 |
| callback | syncCallback\ | 是 | 表示被指定的回调方法。 |
**错误码:**
@@ -344,7 +344,7 @@ publishAsUser(event: string, userId: number, options: CommonEventPublishData, ca
| -------- | ---------------------- | ---- | ---------------------- |
| event | string | 是 | 表示要发布的公共事件。 |
| userId | number | 是 | 表示指定向该用户ID发送此公共事件。 |
-| options | [CommonEventPublishData](#commoneventpublishdata) | 是 | 表示发布公共事件的属性。 |
+| options | [CommonEventPublishData](./js-apis-inner-commonEvent-commonEventPublishData.md) | 是 | 表示发布公共事件的属性。 |
| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 |
**错误码:**
@@ -399,8 +399,8 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo, callback: AsyncCallbac
| 参数名 | 类型 | 必填 | 说明 |
| ------------- | ------------------------------------------------------------ | ---- | -------------------------- |
-| subscribeInfo | [CommonEventSubscribeInfo](#commoneventsubscribeinfo) | 是 | 表示订阅信息。 |
-| callback | AsyncCallback\<[CommonEventSubscriber](#commoneventsubscriber)> | 是 | 表示创建订阅者的回调方法。 |
+| subscribeInfo | [CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md) | 是 | 表示订阅信息。 |
+| callback | AsyncCallback\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 是 | 表示创建订阅者的回调方法。 |
**示例:**
@@ -445,12 +445,12 @@ createSubscriber(subscribeInfo: CommonEventSubscribeInfo): Promise\ | 返回订阅者对象。 |
+| Promise\<[CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md)> | 返回订阅者对象。 |
**示例:**
@@ -490,8 +490,8 @@ subscribe(subscriber: CommonEventSubscriber, callback: AsyncCallback\ | 是 | 表示接收公共事件数据的回调函数。 |
+| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 |
+| callback | AsyncCallback\<[CommonEventData](./js-apis-inner-commonEvent-commonEventData.md)> | 是 | 表示接收公共事件数据的回调函数。 |
**示例:**
@@ -551,7 +551,7 @@ unsubscribe(subscriber: CommonEventSubscriber, callback?: AsyncCallback\):
| 参数名 | 类型 | 必填 | 说明 |
| ---------- | ----------------------------------------------- | ---- | ------------------------ |
-| subscriber | [CommonEventSubscriber](#commoneventsubscriber) | 是 | 表示订阅者对象。 |
+| subscriber | [CommonEventSubscriber](./js-apis-inner-commonEvent-commonEventSubscriber.md) | 是 | 表示订阅者对象。 |
| callback | AsyncCallback\ | 否 | 表示取消订阅的回调方法。 |
**示例:**
@@ -606,6 +606,7 @@ try {
} catch (err) {
console.info("unsubscribe failed " + JSON.stringify(err));
}
+<<<<<<< HEAD
```
## CommonEventSubscriber
@@ -1350,4 +1351,7 @@ subscriber.finishCommonEvent().then(() => {
| publisherPermission | string | 是 | 否 | 表示发布者的权限。 |
| publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 |
| userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 |
-| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 |
\ No newline at end of file
+| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 |
+=======
+```
+>>>>>>> a6c9265cd... common event docs fix
diff --git a/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md b/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
index bb8dd19192f6374d0f7026f3071d9db408386b5c..810e9c33f1153ef408bd1a5a1d21ddde10161503 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-data-relationalStore.md
@@ -30,7 +30,7 @@ getRdbStore(context: Context, config: StoreConfig, callback: AsyncCallback<Rd
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 |
+| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 |
| config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 |
| callback | AsyncCallback<[RdbStore](#rdbstore)> | 是 | 指定callback回调函数,返回RdbStore对象。 |
@@ -108,7 +108,7 @@ getRdbStore(context: Context, config: StoreConfig): Promise<RdbStore>
| 参数名 | 类型 | 必填 | 说明 |
| ------- | -------------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 |
+| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 |
| config | [StoreConfig](#storeconfig) | 是 | 与此RDB存储相关的数据库配置。 |
**返回值**:
@@ -188,7 +188,7 @@ deleteRdbStore(context: Context, name: string, callback: AsyncCallback<void&g
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------------------------------------------ |
-| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 |
+| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 |
| name | string | 是 | 数据库名称。 |
| callback | AsyncCallback<void> | 是 | 指定callback回调函数。 |
@@ -249,7 +249,7 @@ deleteRdbStore(context: Context, name: string): Promise<void>
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------- | ---- | ------------------------------------------------------------ |
-| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 |
+| context | Context | 是 | 应用的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-inner-application-uiAbilityContext.md)。 |
| name | string | 是 | 数据库名称。 |
**返回值**:
@@ -363,6 +363,8 @@ class EntryAbility extends UIAbility {
描述订阅类型。
+**需要权限:** ohos.permission.DISTRIBUTED_DATASYNC
+
**系统能力:** SystemCapability.DistributedDataManager.RelationalStore.Core
| 名称 | 值 | 说明 |
@@ -2430,9 +2432,9 @@ store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates, function (err, r
let predicates = new relationalStore.RdbPredicates('EMPLOYEE');
predicates.inDevices(['12345678abcde']);
let promise = store.sync(relationalStore.SyncMode.SYNC_MODE_PUSH, predicates);
-promise.then((resultSet) =>{
+promise.then((result) =>{
console.info(`Sync done.`);
- for (let i = 0; i < resultSet.length; i++) {
+ for (let i = 0; i < result.length; i++) {
console.info(`device= ${result[i][0]}, status= ${result[i][1]}`);
}
}).catch((err) => {
@@ -2511,10 +2513,12 @@ try {
首先需要获取resultSet对象。
```js
+let resultSet = null;
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
predicates.equalTo("AGE", 18);
let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
-promise.then((resultSet) => {
+promise.then((result) => {
+ resultSet = result;
console.info(`resultSet columnNames: ${resultSet.columnNames}`);
console.info(`resultSet columnCount: ${resultSet.columnCount}`);
});
@@ -2685,7 +2689,7 @@ goToRow(position: number): boolean
let predicates = new relationalStore.RdbPredicates("EMPLOYEE");
let promise = store.query(predicates, ["ID", "NAME", "AGE", "SALARY", "CODES"]);
promise.then((resultSet) => {
- resultSet.(5);
+ resultSet.goToRow(5);
resultSet.close();
}).catch((err) => {
console.error(`query failed, err: ${err}`);
diff --git a/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md b/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md
index 2f66868a47a28345d007b1320abbd349800f41d8..5c4b961d21119ad1d1870403730be3619a6d48fe 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-fileAccess.md
@@ -6,6 +6,7 @@ fileAccess模块是基于extension机制实现的一个对公共文件访问和
>
>- 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
>- 本模块接口为系统接口,三方应用不支持调用,当前只支持filepicker、文件管理器调用。
+>- 本模块支持对错误码进行处理,错误码及其适配方式[参考文档](../errorcodes/errorcode-filemanagement.md#错误码适配指导)。
## 导入模块
diff --git a/zh-cn/application-dev/reference/apis/js-apis-i18n.md b/zh-cn/application-dev/reference/apis/js-apis-i18n.md
index 44256b9542e9a4ce38a6b11475e6dcba71bb4f71..027ec927950fbb6f3193140966935dffdf41373e 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-i18n.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-i18n.md
@@ -1059,7 +1059,7 @@ constructor(country: string, options?: PhoneNumberFormatOptions)
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ---------------------------------------- | ---- | ---------------- |
| country | string | 是 | 表示电话号码所属国家或地区代码。 |
-| options | [PhoneNumberFormatOptions](#phonenumberformatoptions8) | 否 | 电话号码格式化对象的相关选项。 |
+| options | [PhoneNumberFormatOptions](#phonenumberformatoptions9) | 否 | 电话号码格式化对象的相关选项。 |
**示例:**
```js
@@ -1149,7 +1149,7 @@ getLocationName(number: string, locale: string): string
```
-## PhoneNumberFormatOptions8+
+## PhoneNumberFormatOptions9+
表示电话号码格式化对象可设置的属性。
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md
new file mode 100644
index 0000000000000000000000000000000000000000..e84f3b4abffbb032a8a79c489a780ad252158737
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventData.md
@@ -0,0 +1,11 @@
+# CommonEventData
+
+**系统能力:** `SystemCapability.Notification.CommonEvent`
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ---------- |-------------------- | ---- | ---- | ------------------------------------------------------- |
+| event | string | 是 | 否 | 表示当前接收的公共事件名称。 |
+| bundleName | string | 是 | 否 | 表示包名称。 |
+| code | number | 是 | 否 | 表示公共事件的结果代码,用于传递int类型的数据。 |
+| data | string | 是 | 否 | 表示公共事件的自定义结果数据,用于传递string类型的数据。 |
+| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 |
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md
new file mode 100644
index 0000000000000000000000000000000000000000..9d5fe786465e99ce4e85c49310943df600ccb8e6
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventPublishData.md
@@ -0,0 +1,13 @@
+# CommonEventPublishData
+
+**系统能力:** `SystemCapability.Notification.CommonEvent`
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| --------------------- | -------------------- | ---- | ---- | ---------------------------- |
+| bundleName | string | 是 | 否 | 表示包名称。 |
+| code | number | 是 | 否 | 表示公共事件的结果代码。 |
+| data | string | 是 | 否 | 表示公共事件的自定义结果数据。 |
+| subscriberPermissions | Array\ | 是 | 否 | 表示订阅者的权限。 |
+| isOrdered | boolean | 是 | 否 | 表示是否是有序事件。 |
+| isSticky | boolean | 是 | 否 | 表示是否是粘性事件。仅系统应用或系统服务允许发送粘性事件。 |
+| parameters | {[key: string]: any} | 是 | 否 | 表示公共事件的附加信息。 |
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md
new file mode 100644
index 0000000000000000000000000000000000000000..6938b5351b61ab96cf8d87cc78fc3333af21cfa6
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscribeInfo.md
@@ -0,0 +1,11 @@
+# CommonEventSubscribeInfo
+
+**系统能力:** `SystemCapability.Notification.CommonEvent`
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ------------------- | -------------- | ---- | ---- | ------------------------------------------------------------ |
+| events | Array\ | 是 | 否 | 表示要发送的公共事件。 |
+| publisherPermission | string | 是 | 否 | 表示发布者的权限。 |
+| publisherDeviceId | string | 是 | 否 | 表示设备ID,该值必须是同一ohos网络上的现有设备ID。 |
+| userId | number | 是 | 否 | 表示用户ID。此参数是可选的,默认值当前用户的ID。如果指定了此参数,则该值必须是系统中现有的用户ID。 |
+| priority | number | 是 | 否 | 表示订阅者的优先级。值的范围是-100到1000。 |
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md
new file mode 100644
index 0000000000000000000000000000000000000000..411b63e250403b1f5ee916d273f5306c88cda65c
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-commonEvent-commonEventSubscriber.md
@@ -0,0 +1,750 @@
+# CommonEventSubscriber
+
+## getCode
+
+```ts
+getCode(callback: AsyncCallback): void
+```
+
+以回调形式获取公共事件代码。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------- | ---- | ------------------ |
+| callback | AsyncCallback\ | 是 | 公共事件代码。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//获取有序公共事件代码回调
+function getCodeCB(err, code) {
+ if (err.code) {
+ console.error(`getCode failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("getCode " + JSON.stringify(code));
+ }
+}
+subscriber.getCode(getCodeCB);
+```
+
+## getCode
+
+```ts
+getCode(): Promise
+```
+
+以Promise形式获取公共事件代码。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------- | -------------------- |
+| Promise\ | 公共事件代码。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.getCode().then((code) => {
+ console.info("getCode " + JSON.stringify(code));
+}).catch((err) => {
+ console.error(`getCode failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## setCode
+
+```ts
+setCode(code: number, callback: AsyncCallback): void
+```
+
+以回调形式设置公共事件的代码。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------------------- | ---- | ---------------------- |
+| code | number | 是 | 公共事件的代码。 |
+| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//设置有序公共事件的代码回调
+function setCodeCB(err) {
+ if (err.code) {
+ console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("setCode");
+ }
+}
+subscriber.setCode(1, setCodeCB);
+```
+
+## setCode
+
+```ts
+setCode(code: number): Promise
+```
+
+以Promise形式设置公共事件的代码。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | ------------------ |
+| code | number | 是 | 公共事件的代码。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------- | -------------------- |
+| Promise\ | 返回一个Promise的结果。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.setCode(1).then(() => {
+ console.info("setCode");
+}).catch((err) => {
+ console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## getData
+
+```ts
+getData(callback: AsyncCallback): void
+```
+
+以回调形式获取公共事件的数据。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ---------------------- | ---- | -------------------- |
+| callback | AsyncCallback\ | 是 | 公共事件的数据。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//获取有序公共事件代码数据回调
+function getDataCB(err, data) {
+ if (err.code) {
+ console.error(`getData failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("getData " + JSON.stringify(data));
+ }
+}
+subscriber.getData(getDataCB);
+```
+
+## getData
+
+```ts
+getData(): Promise
+```
+
+以Promise形式获取公共事件的数据。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------- | ------------------ |
+| Promise\ | 公共事件的数据。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.getData().then((data) => {
+ console.info("getData " + JSON.stringify(data));
+}).catch((err) => {
+ console.error(`getData failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## setData
+
+setData(data: string, callback: AsyncCallback\): void
+
+以回调形式设置公共事件的数据。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------------------- | ---- | -------------------- |
+| data | string | 是 | 公共事件的数据。 |
+| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//设置有序公共事件的结果数据回调
+function setDataCB(err) {
+ if (err.code) {
+ console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("setData");
+ }
+}
+subscriber.setData("publish_data_changed", setDataCB);
+```
+
+## setData
+
+```ts
+setData(data: string): Promise
+```
+
+以Promise形式设置公共事件的果数据。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | -------------------- |
+| data | string | 是 | 公共事件的数据。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------- | -------------------- |
+| Promise\ | 返回一个Promise的结果。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.setData("publish_data_changed").then(() => {
+ console.info("setData");
+}).catch((err) => {
+ console.error(`setCode failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## setCodeAndData
+
+```ts
+setCodeAndData(code: number, data: string, callback:AsyncCallback): void
+```
+
+以回调形式设置公共事件代码和数据。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------------------- | ---- | ---------------------- |
+| code | number | 是 | 公共事件的代码。 |
+| data | string | 是 | 公共事件的数据。 |
+| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//设置有序公共事件的代码和数据回调
+function setCodeDataCB(err) {
+ if (err.code) {
+ console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("setCodeDataCallback");
+ }
+}
+subscriber.setCodeAndData(1, "publish_data_changed", setCodeDataCB);
+```
+
+## setCodeAndData
+
+```ts
+setCodeAndData(code: number, data: string): Promise
+```
+
+以Promise形式设置公共事件的代码和数据。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| ------ | ------ | ---- | -------------------- |
+| code | number | 是 | 公共事件的代码。 |
+| data | string | 是 | 公共事件的数据。 |
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------- | -------------------- |
+| Promise\ | 返回一个Promise。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.setCodeAndData(1, "publish_data_changed").then(() => {
+ console.info("setCodeAndData");
+}).catch((err) => {
+ console.error(`setCodeAndData failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## isOrderedCommonEvent
+
+```ts
+isOrderedCommonEvent(callback: AsyncCallback): void
+```
+
+以回调形式查询当前公共事件的是否为有序公共事件。
+
+返回true代表是有序公共事件,false代表不是有序公共事件。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------- | ---- | ---------------------------------- |
+| callback | AsyncCallback\ | 是 | 当前公共事件的是否为有序公共事件。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//获取当前公共事件是否为有序事件的回调
+function isOrderedCB(err, isOrdered) {
+ if (err.code) {
+ console.error(`isOrderedCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("isOrdered " + JSON.stringify(isOrdered));
+ }
+}
+subscriber.isOrderedCommonEvent(isOrderedCB);
+```
+
+## isOrderedCommonEvent
+
+```ts
+isOrderedCommonEvent(): Promise
+```
+
+以Promise形式查询当前公共事件的是否为有序公共事件。
+
+返回true代表是有序公共事件,false代表不是有序公共事件。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ----------------- | -------------------------------- |
+| Promise\ | 当前公共事件的是否为有序公共事件。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.isOrderedCommonEvent().then((isOrdered) => {
+ console.info("isOrdered " + JSON.stringify(isOrdered));
+}).catch((err) => {
+ console.error(`isOrdered failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## isStickyCommonEvent
+
+```ts
+isStickyCommonEvent(callback: AsyncCallback): void
+```
+
+以回调形式检查当前公共事件是否为一个粘性事件。
+
+返回true代表是粘性公共事件,false代表不是粘性公共事件。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------- | ---- | ---------------------------------- |
+| callback | AsyncCallback\ | 是 | 当前公共事件的是否为粘性公共事件。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//获取当前公共事件是否为粘性事件的回调
+function isStickyCB(err, isSticky) {
+ if (err.code) {
+ console.error(`isStickyCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("isSticky " + JSON.stringify(isSticky));
+ }
+}
+subscriber.isStickyCommonEvent(isStickyCB);
+```
+
+## isStickyCommonEvent
+
+```ts
+isStickyCommonEvent(): Promise
+```
+
+以Promise形式检查当前公共事件是否为一个粘性事件。
+
+返回true代表是粘性公共事件,false代表不是粘性公共事件。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ----------------- | -------------------------------- |
+| Promise\ | 当前公共事件的是否为粘性公共事件。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.isStickyCommonEvent().then((isSticky) => {
+ console.info("isSticky " + JSON.stringify(isSticky));
+}).catch((err) => {
+ console.error(`isSticky failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## abortCommonEvent
+
+```ts
+abortCommonEvent(callback: AsyncCallback): void
+```
+
+以回调形式取消当前的有序公共事件,取消后,有序公共事件不再向下一个订阅者传递。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------------------- | ---- | -------------------- |
+| callback | AsyncCallback\ | 是 | 取消当前的有序公共事件。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//取消当前有序公共事件的回调
+function abortCB(err) {
+ if (err.code) {
+ console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("abortCommonEvent");
+ }
+}
+subscriber.abortCommonEvent(abortCB);
+```
+
+## abortCommonEvent
+
+```ts
+abortCommonEvent(): Promise
+```
+
+以Promise形式取消当前的有序公共事件,取消后,公共事件不再向下一个订阅者传递。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------- | -------------------- |
+| Promise\ | 返回一个Promise的结果。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.abortCommonEvent().then(() => {
+ console.info("abortCommonEvent");
+}).catch((err) => {
+ console.error(`abortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## clearAbortCommonEvent
+
+```ts
+clearAbortCommonEvent(callback: AsyncCallback): void
+```
+
+以回调形式清除当前有序公共事件。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------------------- | ---- | -------------------- |
+| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//清除当前公共事件取消状态的回调
+function clearAbortCB(err) {
+ if (err.code) {
+ console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("clearAbortCommonEvent");
+ }
+}
+subscriber.clearAbortCommonEvent(clearAbortCB);
+```
+
+## clearAbortCommonEvent
+
+```ts
+clearAbortCommonEvent(): Promise
+```
+
+以Promise形式清除当前有序公共事件。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------- | -------------------- |
+| Promise\ | 返回一个Promise的结果。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.clearAbortCommonEvent().then(() => {
+ console.info("clearAbortCommonEvent");
+}).catch((err) => {
+ console.error(`clearAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## getAbortCommonEvent
+
+```ts
+getAbortCommonEvent(callback: AsyncCallback): void
+```
+
+以回调形式获取当前有序公共事件是否取消的状态。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ----------------------- | ---- | ---------------------------------- |
+| callback | AsyncCallback\ | 是 | 表示当前有序公共事件是否取消的状态。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//获取当前有序公共事件是否取消的回调
+function getAbortCB(err, abortEvent) {
+ if (err.code) {
+ console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("abortCommonEvent " + abortEvent)
+ }
+}
+subscriber.getAbortCommonEvent(getAbortCB);
+```
+
+## getAbortCommonEvent
+
+```ts
+getAbortCommonEvent(): Promise
+```
+
+以Promise形式获取当前有序公共事件是否取消的状态。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ----------------- | ---------------------------------- |
+| Promise\ | 表示当前有序公共事件是否取消的状态。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.getAbortCommonEvent().then((abortEvent) => {
+ console.info("abortCommonEvent " + JSON.stringify(abortEvent));
+}).catch((err) => {
+ console.error(`getAbortCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## getSubscribeInfo
+
+```ts
+getSubscribeInfo(callback: AsyncCallback): void
+```
+
+以回调形式获取订阅者的订阅信息。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | ------------------------------------------------------------ | ---- | ---------------------- |
+| callback | AsyncCallback\<[CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md)> | 是 | 表示订阅者的订阅信息。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//获取订阅者信息回调
+function getCB(err, subscribeInfo) {
+ if (err.code) {
+ console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`);
+ } else {
+ console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
+ }
+}
+subscriber.getSubscribeInfo(getCB);
+```
+
+## getSubscribeInfo
+
+```ts
+getSubscribeInfo(): Promise
+```
+
+以Promise形式获取订阅者的订阅信息。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ------------------------------------------------------------ | ---------------------- |
+| Promise\<[CommonEventSubscribeInfo](./js-apis-inner-commonEvent-commonEventSubscribeInfo.md)> | 表示订阅者的订阅信息。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.getSubscribeInfo().then((subscribeInfo) => {
+ console.info("subscribeInfo " + JSON.stringify(subscribeInfo));
+}).catch((err) => {
+ console.error(`getSubscribeInfo failed, code is ${err.code}, message is ${err.message}`);
+});
+```
+
+## finishCommonEvent9+
+
+```ts
+finishCommonEvent(callback: AsyncCallback): void
+```
+
+以回调形式结束当前有序公共事件。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| -------- | -------------------- | ---- | -------------------------------- |
+| callback | AsyncCallback\ | 是 | 表示有序公共事件结束后的回调函数。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+//结束当前有序公共事件的回调
+function finishCB(err) {
+ if (err.code) {
+ console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+} else {
+ console.info("FinishCommonEvent");
+}
+
+subscriber.finishCommonEvent(finishCB);
+```
+
+## finishCommonEvent9+
+
+```ts
+finishCommonEvent(): Promise
+```
+
+以Promise形式结束当前有序公共事件。
+
+**系统能力**:`SystemCapability.Notification.CommonEvent`
+
+**返回值:**
+
+| 类型 | 说明 |
+| ---------------- | -------------------- |
+| Promise\ | 返回一个Promise的结果。 |
+
+**示例:**
+
+```ts
+let subscriber; //创建成功的订阅者对象
+
+subscriber.finishCommonEvent().then(() => {
+ console.info("FinishCommonEvent");
+}).catch((err) => {
+ console.error(`finishCommonEvent failed, code is ${err.code}, message is ${err.message}`);
+});
+```
\ No newline at end of file
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-bundleOption.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-bundleOption.md
new file mode 100644
index 0000000000000000000000000000000000000000..960e0e6957fbfb931ce0628c9c808041b045bc46
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-bundleOption.md
@@ -0,0 +1,14 @@
+# BundleOption
+
+BundleOption模块为指定应用的包信息。
+
+> **说明:**
+>
+> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 必填 | 说明 |
+| ------ | ------ |---- | ------ |
+| bundle | string | 是 | 应用的包信息。 |
+| uid | number | 否 | 用户ID。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md
new file mode 100644
index 0000000000000000000000000000000000000000..d822600d6939bf2c981a1ddbd611d2d6672816ca
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationActionButton.md
@@ -0,0 +1,16 @@
+# NotificationActionButton
+
+描述通知中显示的操作按钮。
+
+> **说明:**
+>
+> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| --------- | ----------------------------------------------- | --- | ---- | ------------------------- |
+| title | string | 是 | 是 | 按钮标题。 |
+| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 点击按钮时触发的WantAgent。 |
+| extras | { [key: string]: any } | 是 | 是 | 按钮扩展信息。 |
+| userInput8+ | [NotificationUserInput](js-apis-inner-notification-notificationUserInput.md) | 是 | 是 | 用户输入对象实例。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md
new file mode 100644
index 0000000000000000000000000000000000000000..be8496b25a4909e2c7f2796e7e98c1381b50dfe1
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationContent.md
@@ -0,0 +1,77 @@
+# NotificationContent
+
+描述通知类型。
+
+> **说明:**
+>
+> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ----------- | ------------------------------------------------------------ | ---- | --- | ------------------ |
+| contentType | [ContentType](./js-apis-notificationManager.md#contenttype) | 是 | 是 | 通知内容类型。 |
+| normal | [NotificationBasicContent](#notificationbasiccontent) | 是 | 是 | 基本类型通知内容。 |
+| longText | [NotificationLongTextContent](#notificationlongtextcontent) | 是 | 是 | 长文本类型通知内容。 |
+| multiLine | [NotificationMultiLineContent](#notificationmultilinecontent) | 是 | 是 | 多行类型通知内容。 |
+| picture | [NotificationPictureContent](#notificationpicturecontent) | 是 | 是 | 图片类型通知内容。 |
+
+## NotificationBasicContent
+
+描述普通文本通知。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------------- | ------ | ---- | ---- | ---------------------------------- |
+| title | string | 是 | 是 | 通知标题。 |
+| text | string | 是 | 是 | 通知内容。 |
+| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 |
+
+
+## NotificationLongTextContent
+
+描述长文本通知。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------------- | ------ | ---- | --- | -------------------------------- |
+| title | string | 是 | 是 | 通知标题。 |
+| text | string | 是 | 是 | 通知内容。 |
+| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 |
+| longText | string | 是 | 是 | 通知的长文本。 |
+| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
+| expandedTitle | string | 是 | 是 | 通知展开时的标题。 |
+
+
+## NotificationMultiLineContent
+
+描述多行文本通知。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------------- | --------------- | --- | --- | -------------------------------- |
+| title | string | 是 | 是 | 通知标题。 |
+| text | string | 是 | 是 | 通知内容。 |
+| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 |
+| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
+| longTitle | string | 是 | 是 | 通知展开时的标题。 |
+| lines | Array\ | 是 | 是 | 通知的多行文本。 |
+
+
+## NotificationPictureContent
+
+描述附有图片的通知。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------------- | -------------- | ---- | --- | -------------------------------- |
+| title | string | 是 | 是 | 通知标题。 |
+| text | string | 是 | 是 | 通知内容。 |
+| additionalText | string | 是 | 是 | 通知附加内容,是对通知内容的补充。 |
+| briefText | string | 是 | 是 | 通知概要内容,是对通知内容的总结。 |
+| expandedTitle | string | 是 | 是 | 通知展开时的标题。 |
+| picture | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知的图片内容。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md
new file mode 100644
index 0000000000000000000000000000000000000000..1dfc0990395386c786064be441c7c413d2fc744c
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationFlags.md
@@ -0,0 +1,29 @@
+# NotificationFlags
+
+描述通知标志的实例。
+
+> **说明:**
+>
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ---------------- | ---------------------- | ---- | ---- | --------------------------------- |
+| soundEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用声音提示。 |
+| vibrationEnabled | [NotificationFlagStatus](#notificationflagstatus) | 是 | 否 | 是否启用振动提醒功能。 |
+
+
+## NotificationFlagStatus
+
+描述通知标志状态。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+**系统接口**:此接口为系统接口,三方应用不支持调用。
+
+| 名称 | 值 | 说明 |
+| -------------- | --- | --------------------------------- |
+| TYPE_NONE | 0 | 默认标志。 |
+| TYPE_OPEN | 1 | 通知标志打开。 |
+| TYPE_CLOSE | 2 | 通知标志关闭。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md
new file mode 100644
index 0000000000000000000000000000000000000000..9c37ecd7a7fa595eb456796051157c62cf30ae68
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationRequest.md
@@ -0,0 +1,63 @@
+# NotificationRequest
+
+描述通知的请求。
+
+> **说明:**
+>
+> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| --------------------- | --------------------------------------------- | ---- | --- | -------------------------- |
+| content | [NotificationContent](js-apis-inner-notification-notificationContent.md#notificationcontent) | 是 | 是 | 通知内容。 |
+| id | number | 是 | 是 | 通知ID。 |
+| slotType | [SlotType](js-apis-notificationManager.md#slottype) | 是 | 是 | 通道类型。 |
+| isOngoing | boolean | 是 | 是 | 是否进行时通知。 |
+| isUnremovable | boolean | 是 | 是 | 是否可移除。 |
+| deliveryTime | number | 是 | 是 | 通知发送时间。 |
+| tapDismissed | boolean | 是 | 是 | 通知是否自动清除。 |
+| autoDeletedTime | number | 是 | 是 | 自动清除的时间。 |
+| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | WantAgent封装了应用的行为意图,点击通知时触发该行为。 |
+| extraInfo | {[key: string]: any} | 是 | 是 | 扩展参数。 |
+| color | number | 是 | 是 | 通知背景颜色。预留能力,暂未支持。 |
+| colorEnabled | boolean | 是 | 是 | 通知背景颜色是否使能。预留能力,暂未支持。 |
+| isAlertOnce | boolean | 是 | 是 | 设置是否仅有一次此通知提醒。 |
+| isStopwatch | boolean | 是 | 是 | 是否显示已用时间。 |
+| isCountDown | boolean | 是 | 是 | 是否显示倒计时时间。 |
+| isFloatingIcon | boolean | 是 | 是 | 是否显示状态栏图标。 |
+| label | string | 是 | 是 | 通知标签。 |
+| badgeIconStyle | number | 是 | 是 | 通知角标类型。 |
+| showDeliveryTime | boolean | 是 | 是 | 是否显示分发时间。 |
+| actionButtons | Array\<[NotificationActionButton](js-apis-inner-notification-notificationActionButton.md)\> | 是 | 是 | 通知按钮,最多三个按钮。 |
+| smallIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知小图标。可选字段,大小不超过30KB。 |
+| largeIcon | [image.PixelMap](js-apis-image.md#pixelmap7) | 是 | 是 | 通知大图标。可选字段,大小不超过30KB。 |
+| creatorBundleName | string | 是 | 否 | 创建通知的包名。 |
+| creatorUid8+ | number | 是 | 否 | 创建通知的UID。 |
+| creatorPid | number | 是 | 否 | 创建通知的PID。 |
+| creatorUserId| number | 是 | 否 | 创建通知的UserId。 |
+| hashCode | string | 是 | 否 | 通知唯一标识。 |
+| classification | string | 是 | 是 | 通知分类。
**系统API**: 此接口为系统接口,三方应用不支持调用。 |
+| groupName8+ | string | 是 | 是 | 组通知名称。 |
+| template8+ | [NotificationTemplate](./js-apis-inner-notification-notificationTemplate.md) | 是 | 是 | 通知模板。 |
+| isRemoveAllowed8+ | boolean | 是 | 否 | 通知是否能被移除。
**系统API**: 此接口为系统接口,三方应用不支持调用。 |
+| source8+ | number | 是 | 否 | 通知源。
**系统API**: 此接口为系统接口,三方应用不支持调用。 |
+| distributedOption8+ | [DistributedOptions](#distributedoptions) | 是 | 是 | 分布式通知的选项。 |
+| deviceId8+ | string | 是 | 否 | 通知源的deviceId。
**系统API**: 此接口为系统接口,三方应用不支持调用。 |
+| notificationFlags8+ | [NotificationFlags](js-apis-inner-notification-notificationflags#notificationFlags) | 是 | 否 | 获取NotificationFlags。 |
+| removalWantAgent9+ | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 是 | 当移除通知时,通知将被重定向到的WantAgent实例。 |
+| badgeNumber9+ | number | 是 | 是 | 应用程序图标上显示的通知数。 |
+
+
+## DistributedOptions
+
+描述分布式选项。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ---------------------- | -------------- | ---- | ---- | ---------------------------------- |
+| isDistributed8+ | boolean | 是 | 是 | 是否为分布式通知。 |
+| supportDisplayDevices8+ | Array\ | 是 | 是 | 可以同步通知到的设备列表。 |
+| supportOperateDevices8+ | Array\ | 是 | 是 | 可以打开通知的设备列表。 |
+| remindType8+ | number | 是 | 否 | 通知的提醒方式。
**系统API**: 此接口为系统接口,三方应用不支持调用。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md
new file mode 100644
index 0000000000000000000000000000000000000000..27d5aec3672ee7caa0eefd640153f3ee70514a3a
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationSlot.md
@@ -0,0 +1,24 @@
+# NotificationSlot
+
+描述通知槽
+
+> **说明:**
+>
+> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------------------- | --------------------- | ---- | --- | ------------------------------------------ |
+| type | [SlotType](js-apis-notificationManager.md#slottype) | 是 | 是 | 通道类型。 |
+| level | number | 是 | 是 | 通知级别,不设置则根据通知渠道类型有默认值。 |
+| desc | string | 是 | 是 | 通知渠道描述信息。 |
+| badgeFlag | boolean | 是 | 是 | 是否显示角标。 |
+| bypassDnd | boolean | 是 | 是 | 置是否在系统中绕过免打扰模式。 |
+| lockscreenVisibility | number | 是 | 是 | 在锁定屏幕上显示通知的模式。 |
+| vibrationEnabled | boolean | 是 | 是 | 是否可振动。 |
+| sound | string | 是 | 是 | 通知提示音。 |
+| lightEnabled | boolean | 是 | 是 | 是否闪灯。 |
+| lightColor | number | 是 | 是 | 通知灯颜色。 |
+| vibrationValues | Array\ | 是 | 是 | 通知振动样式。 |
+| enabled9+ | boolean | 是 | 否 | 此通知插槽中的启停状态。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md
new file mode 100644
index 0000000000000000000000000000000000000000..58e9d4442712e965f56d6837de8d9cbfef010544
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationTemplate.md
@@ -0,0 +1,14 @@
+# NotificationTemplate
+
+通知模板。
+
+> **说明:**
+>
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+**系统能力**:以下各项对应的系统能力均为SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| ---- | ---------------------- | ---- | ---- | ---------- |
+| name | string | 是 | 是 | 模板名称。 |
+| data | {[key:string]: Object} | 是 | 是 | 模板数据。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md
new file mode 100644
index 0000000000000000000000000000000000000000..bc60f868ba6d787cbacf2b79e50102b7f06cb103
--- /dev/null
+++ b/zh-cn/application-dev/reference/apis/js-apis-inner-notification-notificationUserInput.md
@@ -0,0 +1,13 @@
+# NotificationUserInput
+
+保存用户输入的通知消息。
+
+> **说明:**
+>
+> 本模块首批接口从API version 8开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
+
+**系统能力**:SystemCapability.Notification.Notification
+
+| 名称 | 类型 | 可读 | 可写 | 说明 |
+| -------- | ------ | --- | ---- | ----------------------------- |
+| inputKey | string | 是 | 是 | 用户输入时用于标识此输入的key。 |
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
index 3172154aacf3db947647566612a1d5e6736f1af0..a309cd10dc40f03482b744b2ee54b0df710d9be5 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod-extension-context.md
@@ -51,7 +51,7 @@ this.context.destroy((err) => {
## InputMethodExtensionContext.destroy
-destroy(): Promise;
停止输入法应用自身。通过Promise异步回调。
@@ -61,7 +61,7 @@ destroy(): Promise; | 无返回结果的Promise对象。 |
**示例:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
index 6a36a1ef096a9c61f584a3dec9e6838a8971b1a2..2d4b2df2972a032f88224b7c96ded371fc3e843f 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethod.md
@@ -1149,8 +1149,6 @@ showOptionalInputMethods(callback: AsyncCallback<boolean>): void
显示输入法选择对话框。使用callback异步回调。
-**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
-
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**参数:**
@@ -1189,8 +1187,6 @@ showOptionalInputMethods(): Promise<boolean>
显示输入法选择对话框。使用promise异步回调。
-**需要权限:** ohos.permission.CONNECT_IME_ABILITY,仅系统应用可用。
-
**系统能力:** SystemCapability.MiscServices.InputMethodFramework
**返回值:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
index 72f116c900e3921315385e2dab0d54dd277e6bec..2e1eab7f697c4dcb9a987819e88332fd0afabc80 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-inputmethodengine.md
@@ -708,7 +708,7 @@ hide(callback: AsyncCallback<void>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -742,7 +742,7 @@ hide(): Promise<void>
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -837,7 +837,7 @@ sendKeyFunction(action:number, callback: AsyncCallback<boolean>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -886,7 +886,7 @@ sendKeyFunction(action: number): Promise<boolean>
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -928,7 +928,7 @@ getForward(length:number, callback: AsyncCallback<string>): void
| 错误码ID | 错误信息 |
| -------- | ------------------------------ |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
| 12800006 | Input method controller error. |
**示例:**
@@ -974,7 +974,7 @@ getForward(length:number): Promise<string>
| 错误码ID | 错误信息 |
| -------- | ------------------------------ |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
| 12800006 | Input method controller error. |
**示例:**
@@ -1013,7 +1013,7 @@ getBackward(length:number, callback: AsyncCallback<string>): void
| 错误码ID | 错误信息 |
| -------- | ------------------------------ |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
| 12800006 | Input method controller error. |
**示例:**
@@ -1059,7 +1059,7 @@ getBackward(length:number): Promise<string>
| 错误码ID | 错误信息 |
| -------- | ------------------------------ |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
| 12800006 | Input method controller error. |
**示例:**
@@ -1099,7 +1099,7 @@ deleteForward(length:number, callback: AsyncCallback<boolean>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
| 12800002 | Input method engine error. |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1149,7 +1149,7 @@ deleteForward(length:number): Promise<boolean>
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
| 12800002 | Input method engine error. |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1192,7 +1192,7 @@ deleteBackward(length:number, callback: AsyncCallback<boolean>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
| 12800002 | Input method engine error. |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1242,7 +1242,7 @@ deleteBackward(length:number): Promise<boolean>
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
| 12800002 | Input method engine error. |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1281,7 +1281,7 @@ insertText(text:string, callback: AsyncCallback<boolean>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
| 12800002 | Input method engine error. |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1326,7 +1326,7 @@ insertText(text:string): Promise<boolean>
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
| 12800002 | Input method engine error. |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1366,7 +1366,7 @@ getEditorAttribute(callback: AsyncCallback<EditorAttribute>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1401,7 +1401,7 @@ getEditorAttribute(): Promise<EditorAttribute>
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1435,7 +1435,7 @@ moveCursor(direction: number, callback: AsyncCallback<void>): void
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
@@ -1479,7 +1479,7 @@ moveCursor(direction: number): Promise<void>
| 错误码ID | 错误信息 |
| -------- | -------------------------- |
-| 12800003 | Input method client error. |
+| 12800003 | input method client error. |
**示例:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-intl.md b/zh-cn/application-dev/reference/apis/js-apis-intl.md
index 584bd5b433ad8435b4c5067b4ec71823219bad56..1065a275779112f4950ce0c8316c02699444c798 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-intl.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-intl.md
@@ -67,7 +67,7 @@ constructor(locale: string, options?: LocaleOptions)
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale | string | 是 | 包含区域信息的字符串,包括语言以、脚本、国家或地区。语言、脚本、国家或地区的国际标准及组合方式请见[Intl开发指导](../../internationalization/intl-guidelines.md#设置区域信息) |
-| options9+ | [LocaleOptions](#localeoptions6) | 否 | 用于创建区域对象的选项。 |
+| options9+ | [LocaleOptions](#localeoptions9) | 否 | 用于创建区域对象的选项。 |
**示例:**
```js
@@ -159,7 +159,7 @@ minimize(): Locale
```
-## LocaleOptions6+
+## LocaleOptions9+
表示区域初始化选项。
@@ -206,7 +206,7 @@ constructor(locale: string | Array<string>, options?: DateTimeOptions)
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 |
-| options9+ | [DateTimeOptions](#datetimeoptions6) | 否 | 用于创建时间日期格式化的选项。 |
+| options9+ | [DateTimeOptions](#datetimeoptions9) | 否 | 用于创建时间日期格式化的选项。 |
**示例:**
```js
@@ -298,7 +298,7 @@ resolvedOptions(): DateTimeOptions
| 类型 | 说明 |
| ------------------------------------ | ----------------------------- |
-| [DateTimeOptions](#datetimeoptions6) | DateTimeFormat 对象的格式化选项。 |
+| [DateTimeOptions](#datetimeoptions9) | DateTimeFormat 对象的格式化选项。 |
**示例:**
```js
@@ -310,7 +310,7 @@ resolvedOptions(): DateTimeOptions
```
-## DateTimeOptions6+
+## DateTimeOptions9+
表示时间日期格式化选项。
@@ -370,7 +370,7 @@ constructor(locale: string | Array<string>, options?: NumberOptions)
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | -------------------------------- | ---- | ---------------------------- |
| locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 |
-| options9+ | [NumberOptions](#numberoptions6) | 否 | 用于创建数字格式化的选项。 |
+| options9+ | [NumberOptions](#numberoptions9) | 否 | 用于创建数字格式化的选项。 |
**示例:**
```js
@@ -420,7 +420,7 @@ resolvedOptions(): NumberOptions
| 类型 | 说明 |
| -------------------------------- | --------------------------- |
-| [NumberOptions](#numberoptions6) | NumberFormat 对象的格式化选项。 |
+| [NumberOptions](#numberoptions9) | NumberFormat 对象的格式化选项。 |
**示例:**
@@ -433,7 +433,7 @@ resolvedOptions(): NumberOptions
```
-## NumberOptions6+
+## NumberOptions9+
表示设备支持的能力。
@@ -493,7 +493,7 @@ constructor(locale: string | Array<string>, options?: CollatorOptions)
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ------------------------------------ | ---- | ---------------------------- |
| locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 |
-| options9+ | [CollatorOptions](#collatoroptions8) | 否 | 用于创建排序对象的选项。 |
+| options9+ | [CollatorOptions](#collatoroptions9) | 否 | 用于创建排序对象的选项。 |
**示例:**
```js
@@ -544,7 +544,7 @@ resolvedOptions(): CollatorOptions
| 类型 | 说明 |
| ------------------------------------ | ----------------- |
-| [CollatorOptions](#collatoroptions8) | 返回的Collator对象的属性。 |
+| [CollatorOptions](#collatoroptions9) | 返回的Collator对象的属性。 |
**示例:**
```js
@@ -556,7 +556,7 @@ resolvedOptions(): CollatorOptions
```
-## CollatorOptions8+
+## CollatorOptions9+
表示Collator可设置的属性。
@@ -604,7 +604,7 @@ constructor(locale: string | Array<string>, options?: PluralRulesOptions)
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 |
-| options9+ | [PluralRulesOptions](#pluralrulesoptions8) | 否 | 用于创建单复数对象的选项。 |
+| options9+ | [PluralRulesOptions](#pluralrulesoptions9) | 否 | 用于创建单复数对象的选项。 |
**示例:**
```js
@@ -647,7 +647,7 @@ select(n: number): string
```
-## PluralRulesOptions8+
+## PluralRulesOptions9+
表示PluralRules对象可设置的属性。
@@ -695,7 +695,7 @@ constructor(locale: string | Array<string>, options?: RelativeTimeFormatIn
| 参数名 | 类型 | 必填 | 说明 |
| -------------------- | ---------------------------------------- | ---- | ---------------------------- |
| locale | string \| Array<string> | 是 | 包含区域设置信息的字符串,包括语言以及可选的脚本和区域。 |
-| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions8) | 否 | 用于创建相对时间格式化对象的选项。 |
+| options9+ | [RelativeTimeFormatInputOptions](#relativetimeformatinputoptions9) | 否 | 用于创建相对时间格式化对象的选项。 |
**示例:**
```js
@@ -787,7 +787,7 @@ resolvedOptions(): RelativeTimeFormatResolvedOptions
```
-## RelativeTimeFormatInputOptions8+
+## RelativeTimeFormatInputOptions9+
表示RelativeTimeFormat对象可设置的属性。
diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfcController.md b/zh-cn/application-dev/reference/apis/js-apis-nfcController.md
index a82e48c76e80342f10ce9ee42bfcd2852fc09d34..b46c3e52c46c256fad4ca33851398ed62e7aad52 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-nfcController.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-nfcController.md
@@ -31,6 +31,9 @@ isNfcAvailable(): boolean
查询设备是否有NFC能力。
+> **说明:**
+> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用canIUse("SystemCapability.Communication.NFC.Core")替代。
+
**系统能力:** SystemCapability.Communication.NFC.Core
**返回值:**
@@ -46,6 +49,9 @@ openNfc(): boolean
打开NFC开关。
+> **说明:**
+> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[enableNfc](#controllerenablenfc9)替代。
+
**需要权限:** ohos.permission.MANAGE_SECURE_SETTINGS
**系统能力:** SystemCapability.Communication.NFC.Core
@@ -56,12 +62,33 @@ openNfc(): boolean
| -------- | -------- |
| boolean | true: 打开NFC成功, false: 打开NFC失败。 |
+## controller.enableNfc9+
+
+enableNfc(): boolean
+
+打开NFC开关。
+
+**需要权限:** ohos.permission.MANAGE_SECURE_SETTINGS
+
+**系统能力:** SystemCapability.Communication.NFC.Core
+
+**错误码:**
+
+以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。
+
+| 错误码ID | 错误信息|
+| ------- | -------|
+| 3100101 | NFC state is abnormal in service. |
+
## controller.closeNfc
closeNfc(): boolean
关闭NFC开关。
+> **说明:**
+> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[disableNfc](#controllerdisablenfc9)替代。
+
**需要权限:** ohos.permission.MANAGE_SECURE_SETTINGS
**系统能力:** SystemCapability.Communication.NFC.Core
@@ -72,6 +99,24 @@ closeNfc(): boolean
| -------- | ------------------------------------------- |
| boolean | true: 关闭NFC成功, false: 关闭NFC失败。 |
+## controller.disableNfc9+
+
+disableNfc(): boolean
+
+关闭NFC开关。
+
+**需要权限:** ohos.permission.MANAGE_SECURE_SETTINGS
+
+**系统能力:** SystemCapability.Communication.NFC.Core
+
+**错误码:**
+
+以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。
+
+| 错误码ID | 错误信息|
+| ------- | -------|
+| 3100101 | NFC state is abnormal in service. |
+
## controller.isNfcOpen
isNfcOpen(): boolean
@@ -150,12 +195,28 @@ if (!controller.isNfcOpen()) {
console.log("controller openNfc ret: " + ret);
}
+// from api9, use 'enableNfc' to open nfc.
+try {
+ controller.enableNfc();
+ console.log("controller enableNfc success");
+} catch (busiError) {
+ console.log("controller enableNfc busiError: " + busiError);
+}
+
// close nfc, require permission: ohos.permission.MANAGE_SECURE_SETTINGS
if (controller.isNfcOpen()) {
var ret = controller.closeNfc();
console.log("controller closeNfc ret: " + ret);
}
+// from api9, use 'disableNfc' to close nfc.
+try {
+ controller.disableNfc();
+ console.log("controller disableNfc success");
+} catch (busiError) {
+ console.log("controller disableNfc busiError: " + busiError);
+}
+
// unregister callback
controller.off("nfcStateChange");
```
diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md b/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md
index 3c1f33040ca9c792e42256b083dbecaa9ec4ee44..d7ebd70b23d8889b5d04fda6832cda2f340f55da 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-nfcTag.md
@@ -126,64 +126,204 @@ getNfcATag(tagInfo: [TagInfo](#taginfo)): [NfcATag](js-apis-nfctech.md#nfcatag)
获取NFC A类型Tag对象,通过该对象可访问NfcA技术类型的Tag。
-**需要权限:** ohos.permission.NFC_TAG
+> **说明:**
+> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getNfcA](#taggetnfca9)替代。
+
+**系统能力:** SystemCapability.Communication.NFC.Tag
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。
+
+**返回值:**
+
+| **类型** | **说明** |
+| -------- | -------- |
+| [NfcATag](js-apis-nfctech.md#nfcatag) | NFC A类型Tag对象。 |
+
+## tag.getNfcA9+
+
+getNfcA(tagInfo: [TagInfo](#taginfo)): [NfcATag](js-apis-nfctech.md#nfcatag)
+
+获取NFC A类型Tag对象,通过该对象可访问NfcA技术类型的Tag。
**系统能力:** SystemCapability.Communication.NFC.Tag
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。
+
**返回值:**
| **类型** | **说明** |
| -------- | -------- |
| [NfcATag](js-apis-nfctech.md#nfcatag) | NFC A类型Tag对象。 |
+**错误码:**
+
+以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。
+
+| 错误码ID | 错误信息|
+| ------- | -------|
+| 3100201 | Tag running state is abnormal in service. |
+
## tag.getNfcBTag
getNfcBTag(tagInfo: [TagInfo](#taginfo)): [NfcBTag](js-apis-nfctech.md#nfcbtag)
获取NFC B类型Tag对象,通过该对象可访问NfcB技术类型的Tag。
-**需要权限:** ohos.permission.NFC_TAG
+> **说明:**
+> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getNfcB](#taggetnfcb9)替代。
+
+**系统能力:** SystemCapability.Communication.NFC.Tag
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。
+
+**返回值:**
+
+| **类型** | **说明** |
+| -------- | ---------------- |
+| [NfcBTag](js-apis-nfctech.md#nfcbtag) | NFC B类型Tag对象。 |
+
+## tag.getNfcB9+
+
+getNfcB(tagInfo: [TagInfo](#taginfo)): [NfcBTag](js-apis-nfctech.md#nfcbtag)
+
+获取NFC B类型Tag对象,通过该对象可访问NfcB技术类型的Tag。
**系统能力:** SystemCapability.Communication.NFC.Tag
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。
+
**返回值:**
| **类型** | **说明** |
| -------- | ---------------- |
| [NfcBTag](js-apis-nfctech.md#nfcbtag) | NFC B类型Tag对象。 |
+**错误码:**
+
+以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。
+
+| 错误码ID | 错误信息|
+| ------- | -------|
+| 3100201 | Tag running state is abnormal in service. |
+
## tag.getNfcFTag
getNfcFTag(tagInfo: [TagInfo](#taginfo)): [NfcFTag](js-apis-nfctech.md#nfcftag)
获取NFC F类型Tag对象,通过该对象可访问NfcF技术类型的Tag。
-**需要权限:** ohos.permission.NFC_TAG
+> **说明:**
+> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getNfcF](#taggetnfcf9)替代。
+
+**系统能力:** SystemCapability.Communication.NFC.Tag
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。
+
+**返回值:**
+
+| **类型** | **说明** |
+| -------- | ---------------- |
+| [NfcFTag](js-apis-nfctech.md#nfcftag) | NFC F类型Tag对象。 |
+
+## tag.getNfcF9+
+
+getNfcF(tagInfo: [TagInfo](#taginfo)): [NfcFTag](js-apis-nfctech.md#nfcftag)
+
+获取NFC F类型Tag对象,通过该对象可访问NfcF技术类型的Tag。
**系统能力:** SystemCapability.Communication.NFC.Tag
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。
+
**返回值:**
| **类型** | **说明** |
| -------- | ---------------- |
| [NfcFTag](js-apis-nfctech.md#nfcftag) | NFC F类型Tag对象。 |
+**错误码:**
+
+以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。
+
+| 错误码ID | 错误信息|
+| ------- | -------|
+| 3100201 | Tag running state is abnormal in service. |
+
## tag.getNfcVTag
getNfcVTag(tagInfo: [TagInfo](#taginfo)): [NfcVTag](js-apis-nfctech.md#nfcvtag)
获取NFC V类型Tag对象,通过该对象可访问NfcV技术类型的Tag。
-**需要权限:** ohos.permission.NFC_TAG
+> **说明:**
+> 从 API version 7 开始支持,从 API version 9 开始废弃,建议使用[tag.getNfcV](#taggetnfcv9)替代。
+
+**系统能力:** SystemCapability.Communication.NFC.Tag
+
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。
+
+**返回值:**
+
+| **类型** | **说明** |
+| -------- | ---------------- |
+| [NfcVTag](js-apis-nfctech.md#nfcvtag) | NFC V类型Tag对象。 |
+
+## tag.getNfcV9+
+
+getNfcV(tagInfo: [TagInfo](#taginfo)): [NfcVTag](js-apis-nfctech.md#nfcvtag)
+
+获取NFC V类型Tag对象,通过该对象可访问NfcV技术类型的Tag。
**系统能力:** SystemCapability.Communication.NFC.Tag
+**参数:**
+
+| 参数名 | 类型 | 必填 | 说明 |
+| --------- | ------------------------- | ---- | ---------------------------------------- |
+| taginfo | [TagInfo](#taginfo) | 是 | 包含Tag技术类型和相关参数,从tag.getTagInfo(want: Want)获取。
+
**返回值:**
| **类型** | **说明** |
| -------- | ---------------- |
| [NfcVTag](js-apis-nfctech.md#nfcvtag) | NFC V类型Tag对象。 |
+**错误码:**
+
+以下错误码的详细介绍请参见[NFC错误码](../errorcodes/errorcode-nfc.md)。
+
+| 错误码ID | 错误信息|
+| ------- | -------|
+| 3100201 | Tag running state is abnormal in service. |
+
## tag.getIsoDep9+
getIsoDep(tagInfo: [TagInfo](#taginfo)): [IsoDepTag](js-apis-nfctech.md#isoDepTag9 )
diff --git a/zh-cn/application-dev/reference/apis/js-apis-nfctech.md b/zh-cn/application-dev/reference/apis/js-apis-nfctech.md
index fc5241358c6f5e76f43833d7aef8b059b663fe58..122d4992bf1b5b2e2c5ac7d431ad970d345443d2 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-nfctech.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-nfctech.md
@@ -26,8 +26,6 @@ getSak(): number
获取NFC-A标签的SAK值。
-**需要权限:** ohos.permission.NFC_TAG
-
**系统能力:** SystemCapability.Communication.NFC.Tag
**返回值:**
@@ -52,8 +50,6 @@ getAtqa(): number[]
获取NFC-A标签的Atqa值。
-**需要权限:** ohos.permission.NFC_TAG
-
**系统能力:** SystemCapability.Communication.NFC.Tag
**返回值:**
@@ -86,8 +82,6 @@ getRespAppData(): number[]
获取标签的应用程序数据。
-**需要权限:** ohos.permission.NFC_TAG
-
**系统能力:** SystemCapability.Communication.NFC.Tag
**返回值:**
@@ -112,8 +106,6 @@ getRespProtocol(): number[]
获取标签的协议信息。
-**需要权限:** ohos.permission.NFC_TAG
-
**系统能力:** SystemCapability.Communication.NFC.Tag
**返回值:**
@@ -146,8 +138,6 @@ getSystemCode(): number[]
从标签实例获取系统代码。
-**需要权限:** ohos.permission.NFC_TAG
-
**系统能力:** SystemCapability.Communication.NFC.Tag
**返回值:**
@@ -172,8 +162,6 @@ getPmm(): number[]
从标签实例获取PMm(由IC代码和制造商参数组成)。
-**需要权限:** ohos.permission.NFC_TAG
-
**系统能力:** SystemCapability.Communication.NFC.Tag
**返回值:**
@@ -206,8 +194,6 @@ getResponseFlags(): number
从标签实例实例获取响应标志。
-**需要权限:** ohos.permission.NFC_TAG
-
**系统能力:** SystemCapability.Communication.NFC.Tag
**返回值:**
@@ -232,8 +218,6 @@ getDsfId(): number
从标签实例实例获取数据存储格式标识符(DSFID)。
-**需要权限:** ohos.permission.NFC_TAG
-
**系统能力:** SystemCapability.Communication.NFC.Tag
**返回值:**
diff --git a/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md b/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
index 082c541329f95275d81f93e69c4db19cced495da..d62aeac46128137a43229dde1175b05966b805d3 100644
--- a/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
+++ b/zh-cn/application-dev/reference/apis/js-apis-notificationManager.md
@@ -24,7 +24,7 @@ publish(request: NotificationRequest, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------- |
-| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
+| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
| callback | AsyncCallback\ | 是 | 发布通知的回调方法。 |
**错误码:**
@@ -80,7 +80,7 @@ publish(request: NotificationRequest): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------- | ---- | ------------------------------------------- |
-| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
+| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
**错误码:**
@@ -132,7 +132,7 @@ publish(request: NotificationRequest, userId: number, callback: AsyncCallback\ | 是 | 被指定的回调方法。 |
@@ -194,7 +194,7 @@ publish(request: NotificationRequest, userId: number): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ----------------------------------------- | ---- | ------------------------------------------- |
-| request | [NotificationRequest](#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
+| request | [NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest) | 是 | 用于设置要发布通知的内容和相关配置信息。 |
| userId | number | 是 | 用户ID。 |
**错误码:**
@@ -439,7 +439,7 @@ addSlot(slot: NotificationSlot, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
-| slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 |
+| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 要创建的通知通道对象。 |
| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 |
**错误码:**
@@ -488,7 +488,7 @@ addSlot(slot: NotificationSlot): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ---- | ---------------- | ---- | -------------------- |
-| slot | [NotificationSlot](#notificationslot) | 是 | 要创建的通知通道对象。 |
+| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 要创建的通知通道对象。 |
**错误码:**
@@ -605,7 +605,7 @@ addSlots(slots: Array\, callback: AsyncCallback\): voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ------------------------ |
-| slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 |
+| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 要创建的通知通道对象数组。 |
| callback | AsyncCallback\ | 是 | 表示被指定的回调方法。 |
**错误码:**
@@ -658,7 +658,7 @@ addSlots(slots: Array\): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ----- | ------------------------- | ---- | ------------------------ |
-| slots | Array\<[NotificationSlot](#notificationslot)\> | 是 | 要创建的通知通道对象数组。 |
+| slots | Array\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 要创建的通知通道对象数组。 |
**错误码:**
@@ -701,7 +701,7 @@ getSlot(slotType: SlotType, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | ----------------------------------------------------------- |
| slotType | [SlotType](#slottype) | 是 | 通知渠道类型,目前分为社交通信、服务提醒、内容咨询和其他类型。 |
-| callback | AsyncCallback\<[NotificationSlot](#notificationslot)\> | 是 | 表示被指定的回调方法。 |
+| callback | AsyncCallback\<[NotificationSlot](js-apis-inner-notification-notificationSlot.md)\> | 是 | 表示被指定的回调方法。 |
**错误码:**
@@ -783,7 +783,7 @@ getSlots(callback: AsyncCallback>): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------------------- | ---- | -------------------- |
-| callback | AsyncCallback\\> | 是 | 以callback形式返回获取此应用程序的所有通知通道的结果。 |
+| callback | AsyncCallback\\> | 是 | 以callback形式返回获取此应用程序的所有通知通道的结果。 |
**错误码:**
@@ -823,7 +823,7 @@ getSlots(): Promise\>
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
-| Promise\\> | 以Promise形式返回获取此应用程序的所有通知通道的结果。 |
+| Promise\\> | 以Promise形式返回获取此应用程序的所有通知通道的结果。 |
**错误码:**
@@ -1005,7 +1005,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean, callback: AsyncCall
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 |
| callback | AsyncCallback\ | 是 | 设定通知使能回调函数。 |
@@ -1054,7 +1054,7 @@ setNotificationEnable(bundle: BundleOption, enable: boolean): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 |
**错误码:**
@@ -1097,7 +1097,7 @@ isNotificationEnabled(bundle: BundleOption, callback: AsyncCallback\):
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback\ | 是 | 获取通知使能状态回调函数。 |
**错误码:**
@@ -1145,7 +1145,7 @@ isNotificationEnabled(bundle: BundleOption): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
**返回值:**
@@ -1237,7 +1237,7 @@ isNotificationEnabled(): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
**返回值:**
@@ -1282,7 +1282,7 @@ displayBadge(bundle: BundleOption, enable: boolean, callback: AsyncCallback\ | 是 | 设定角标使能回调函数。 |
@@ -1331,7 +1331,7 @@ displayBadge(bundle: BundleOption, enable: boolean): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
| enable | boolean | 是 | 使能状态。 |
**错误码:**
@@ -1374,7 +1374,7 @@ isBadgeDisplayed(bundle: BundleOption, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | ------------------------ |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback\ | 是 | 获取角标使能状态回调函数。 |
**错误码:**
@@ -1422,7 +1422,7 @@ isBadgeDisplayed(bundle: BundleOption): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
**返回值:**
@@ -1470,8 +1470,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot, callback: AsyncCal
| 参数名 | 类型 | 必填 | 说明 |
| -------- | --------------------- | ---- | -------------------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
-| slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
+| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 通知通道。 |
| callback | AsyncCallback\ | 是 | 设定通知通道回调函数。 |
**错误码:**
@@ -1524,8 +1524,8 @@ setSlotByBundle(bundle: BundleOption, slot: NotificationSlot): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
-| slot | [NotificationSlot](#notificationslot) | 是 | 通知通道。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
+| slot | [NotificationSlot](js-apis-inner-notification-notificationSlot.md) | 是 | 通知通道。 |
**错误码:**
@@ -1570,8 +1570,8 @@ getSlotsByBundle(bundle: BundleOption, callback: AsyncCallback> | 是 | 获取通知通道回调函数。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
+| callback | AsyncCallback> | 是 | 获取通知通道回调函数。 |
**错误码:**
@@ -1618,13 +1618,13 @@ getSlotsByBundle(bundle: BundleOption): Promise>
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
**返回值:**
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
-| Promise> | 以Promise形式返回获取指定应用的通知通道。 |
+| Promise> | 以Promise形式返回获取指定应用的通知通道。 |
**错误码:**
@@ -1666,7 +1666,7 @@ getSlotNumByBundle(bundle: BundleOption, callback: AsyncCallback\): voi
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
| callback | AsyncCallback\ | 是 | 获取通知通道数量回调函数。 |
**错误码:**
@@ -1714,7 +1714,7 @@ getSlotNumByBundle(bundle: BundleOption): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------ | ---- | ---------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 指定应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 指定应用的包信息。 |
**返回值:**
@@ -1763,7 +1763,7 @@ getAllActiveNotifications(callback: AsyncCallback>)
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | -------------------- |
-| callback | AsyncCallback> | 是 | 获取活动通知回调函数。 |
+| callback | AsyncCallback> | 是 | 获取活动通知回调函数。 |
**错误码:**
@@ -1793,7 +1793,7 @@ Notification.getAllActiveNotifications(getAllActiveNotificationsCallback);
## Notification.getAllActiveNotifications
-getAllActiveNotifications(): Promise\\>
+getAllActiveNotifications(): Promise\\>
获取当前未删除的所有通知(Promise形式)。
@@ -1807,7 +1807,7 @@ getAllActiveNotifications(): Promise\\> | 以Promise形式返回获取活动通知。 |
+| Promise\\> | 以Promise形式返回获取活动通知。 |
**错误码:**
@@ -1915,7 +1915,7 @@ getActiveNotifications(callback: AsyncCallback>): v
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------------------ | ---- | ------------------------------ |
-| callback | AsyncCallback> | 是 | 获取当前应用通知列表回调函数。 |
+| callback | AsyncCallback> | 是 | 获取当前应用通知列表回调函数。 |
**错误码:**
@@ -1945,7 +1945,7 @@ Notification.getActiveNotifications(getActiveNotificationsCallback);
## Notification.getActiveNotifications
-getActiveNotifications(): Promise\\>
+getActiveNotifications(): Promise\\>
获取当前应用未删除的通知列表(Promise形式)。
@@ -1955,7 +1955,7 @@ getActiveNotifications(): Promise\\> | 以Promise形式返回获取当前应用通知列表。 |
+| Promise\\> | 以Promise形式返回获取当前应用通知列表。 |
**错误码:**
@@ -1989,7 +1989,7 @@ cancelGroup(groupName: string, callback: AsyncCallback\): void
| 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------- | ---- | ---------------------------- |
-| groupName | string | 是 | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](#notificationrequest)对象指定。 |
+| groupName | string | 是 | 通知组名称,此名称需要在发布通知时通过[NotificationRequest](js-apis-inner-notification-notificationRequest.md#notificationrequest)对象指定。 |
| callback | AsyncCallback\ | 是 | 取消本应用指定组下通知的回调函数。 |
**错误码:**
@@ -2071,7 +2071,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string, callback: AsyncCall
| 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------- | ---- | ---------------------------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 应用的包信息。 |
| groupName | string | 是 | 通知组名称。 |
| callback | AsyncCallback\ | 是 | 删除指定应用指定组下通知的回调函数。 |
@@ -2121,7 +2121,7 @@ removeGroupByBundle(bundle: BundleOption, groupName: string): Promise\
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ------------ | ---- | -------------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 应用的包信息。 |
| groupName | string | 是 | 通知组名称。 |
**错误码:**
@@ -2786,7 +2786,7 @@ setDistributedEnable(enable: boolean, callback: AsyncCallback\): void
**示例:**
```javascript
-function setDistributedEnableCallback() {
+function setDistributedEnableCallback(err) {
if (err) {
console.info("setDistributedEnable failed " + JSON.stringify(err));
} else {
@@ -2933,7 +2933,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean, callback: As
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------ | ---- | -------------------------- |
-| bundle | [BundleOption](#bundleoption) | 是 | 应用的包信息。 |
+| bundle | [BundleOption](./js-apis-inner-notification-bundleOption.md) | 是 | 应用的包信息。 |
| enable | boolean | 是 | 是否支持。 |
| callback | AsyncCallback\ | 是 | 应用程序是否支持分布式通知的回调函数。 |
@@ -2987,7 +2987,7 @@ setDistributedEnableByBundle(bundle: BundleOption, enable: boolean): Promise\ | 是 | 查询指定应用是否支持分布式通知的回调函数。 |
**错误码:**
@@ -3050,7 +3050,7 @@ isDistributedEnabledByBundle(bundle: BundleOption, callback: AsyncCallback\