提交 c5acb171 编写于 作者: Z z00524957

update docs

Signed-off-by: Nz00524957 <zengyawen1@huawei.com>
上级 4d1ee01e
...@@ -212,5 +212,3 @@ The following conditions must be met: ...@@ -212,5 +212,3 @@ The following conditions must be met:
1. Before the redirection to the previous page, a confirm dialog box will be displayed. Note that **router.disableAlertBeforeBackPage** is used to disable the display of a confirm dialog box before returning to the previous page (default), and **router.enableAlertBeforeBackPage** is used to enable the display. 1. Before the redirection to the previous page, a confirm dialog box will be displayed. Note that **router.disableAlertBeforeBackPage** is used to disable the display of a confirm dialog box before returning to the previous page (default), and **router.enableAlertBeforeBackPage** is used to enable the display.
2. The system return key is used. 2. The system return key is used.
\ No newline at end of file
...@@ -14,7 +14,7 @@ Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9 ...@@ -14,7 +14,7 @@ Applicable to: OpenHarmony SDK 3.2.3.5, stage model of API version 9
Obtain the bundle name through **context.abilityInfo.bundleName**. Obtain the bundle name through **context.abilityInfo.bundleName**.
Reference: [AbilityContext](../reference/apis/js-apis-ability-context.md) and [AbilityInfo](../reference/apis/js-apis-bundle-AbilityInfo.md) Reference: [AbilityInfo](../reference/apis/js-apis-bundle-AbilityInfo.md)
## How do I obtain an application icon? ## How do I obtain an application icon?
......
...@@ -9,7 +9,6 @@ Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9 ...@@ -9,7 +9,6 @@ Applicable to: OpenHarmony SDK 3.2.2.5, stage model of API version 9
- Method 2: Run the screenshot script. Connect to the development board to a computer running Windows. Create a text file on the computer, copy the following script content to the file, change the file name extension to **.bat** (the HDC environment variables must be configured in advance), and click **Run**. The screenshot is saved to the same directory as the **.bat** script file. - Method 2: Run the screenshot script. Connect to the development board to a computer running Windows. Create a text file on the computer, copy the following script content to the file, change the file name extension to **.bat** (the HDC environment variables must be configured in advance), and click **Run**. The screenshot is saved to the same directory as the **.bat** script file.
Example: Example:
``` ```
set filepath=/data/%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%.png set filepath=/data/%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%.png
echo %filepath% echo %filepath%
...@@ -29,10 +28,11 @@ Applicable to: DevEco Studio 3.0.0.991 ...@@ -29,10 +28,11 @@ Applicable to: DevEco Studio 3.0.0.991
![en-us_image_0000001361254285](figures/en-us_image_0000001361254285.png) ![en-us_image_0000001361254285](figures/en-us_image_0000001361254285.png)
2. Set the profile parameters as follows: 2. Set the profile parameters as follows:
Device type : default Device type : default
Resolution: 720\*1280 Resolution: 720\*1280
DPI: 240 DPI: 240
## What should I do if Device Manager incorrectly identifies a development board as FT232R USB UART even when the development board already has a driver installed? ## What should I do if Device Manager incorrectly identifies a development board as FT232R USB UART even when the development board already has a driver installed?
......
...@@ -17,7 +17,7 @@ Reference: [Notification](../reference/apis/js-apis-notification.md#notification ...@@ -17,7 +17,7 @@ Reference: [Notification](../reference/apis/js-apis-notification.md#notification
Example: Example:
```ts ```ts
import WantAgent from '@ohos.wantAgent'; import WantAgent from '@ohos.app.ability.wantAgent';
async function publishNotification() { async function publishNotification() {
let wantAgentInfo = { let wantAgentInfo = {
......
...@@ -18,10 +18,10 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9 ...@@ -18,10 +18,10 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
1. Use the **onWindowStageCreate** to obtain a **windowClass** object. 1. Use the **onWindowStageCreate** to obtain a **windowClass** object.
``` ```ts
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// When the main window is created, set the main page for this ability. // When the main window is created, set the main page for this ability.
console.log("[Demo] MainAbility onWindowStageCreate") console.log("[Demo] EntryAbility onWindowStageCreate")
windowStage.getMainWindow((err, data) => { windowStage.getMainWindow((err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to obtain the main window.') console.error('Failed to obtain the main window.')
...@@ -35,7 +35,7 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9 ...@@ -35,7 +35,7 @@ Applicable to: OpenHarmony SDK 3.2.6.3, stage model of API version 9
2. Enable the full-screen mode for the window and hide the status bar. 2. Enable the full-screen mode for the window and hide the status bar.
``` ```ts
globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => { globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err)); console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err));
...@@ -54,7 +54,7 @@ Use **window.getProperties()** to obtain the window properties. The **windowRect ...@@ -54,7 +54,7 @@ Use **window.getProperties()** to obtain the window properties. The **windowRect
Example: Example:
``` ```ts
let promise = windowClass.getProperties(); let promise = windowClass.getProperties();
promise.then((data)=> { promise.then((data)=> {
console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect)); console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect));
...@@ -70,7 +70,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -70,7 +70,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
Refer to the following code: Refer to the following code:
``` ```ts
window.getTopWindow(globalThis.mainContext).then(win => { window.getTopWindow(globalThis.mainContext).then(win => {
var systemBarProperties = { var systemBarProperties = {
statusBarColor: '#19B6FF', // Set the background color of the status bar. statusBarColor: '#19B6FF', // Set the background color of the status bar.
......
...@@ -251,7 +251,6 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -251,7 +251,6 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
To listen for in-depth changes of **@State** decorated variables, you can use **@Observed** and **@ObjectLink** decorators. To listen for in-depth changes of **@State** decorated variables, you can use **@Observed** and **@ObjectLink** decorators.
Reference: [@Observed and @ObjectLink](../quick-start/arkts-state-mgmt-page-level.md#observed-and-objectlink)
## How do I implement character string encoding and decoding? ## How do I implement character string encoding and decoding?
...@@ -289,4 +288,4 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -289,4 +288,4 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
No. Relational database operations cannot be performed in the worker thread. No. Relational database operations cannot be performed in the worker thread.
<!--no_check-->
\ No newline at end of file \ No newline at end of file
...@@ -42,7 +42,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId) ...@@ -42,7 +42,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId)
Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9 Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9
1. Create an **ImageSource** instance based on the input URI. 1. Create an **ImageSource** instance based on the input URI.
``` ```
let path = this.context.getApplicationContext().fileDirs + "test.jpg"; let path = this.context.getApplicationContext().fileDirs + "test.jpg";
const imageSourceApi = image.createImageSource(path); const imageSourceApi = image.createImageSource(path);
...@@ -52,7 +52,7 @@ Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9 ...@@ -52,7 +52,7 @@ Applicable to: OpenHarmony SDK 3.2.5.6, stage model of API version 9
- Set **desiredSize** to specify the target size after scaling. If the values are all set to **0**, scaling will not be performed. - Set **desiredSize** to specify the target size after scaling. If the values are all set to **0**, scaling will not be performed.
- Set **desiredRegion** to specify the target rectangular area after cropping. If the values are all set to **0**, cropping will not be performed. - Set **desiredRegion** to specify the target rectangular area after cropping. If the values are all set to **0**, cropping will not be performed.
- Set **rotateDegrees** to specify the rotation angle. The image will be rotated clockwise at the center. - Set **rotateDegrees** to specify the rotation angle. The image will be rotated clockwise at the center.
``` ```
const decodingOptions = { const decodingOptions = {
desiredSize: { desiredSize: {
...@@ -85,7 +85,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -85,7 +85,7 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
1. Configure the permissions **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA** in the **module.json5** file. 1. Configure the permissions **ohos.permission.READ_MEDIA** and **ohos.permission.WRITE_MEDIA** in the **module.json5** file.
Example: Example:
``` ```
{ {
"module" : { "module" : {
...@@ -104,10 +104,14 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9 ...@@ -104,10 +104,14 @@ Applicable to: OpenHarmony SDK 3.2.5.5, stage model of API version 9
``` ```
2. Call **requestPermissionsFromUser** to request the permissions from end users in the form of a dialog box. This operation is required because the grant mode of both permissions is **user_grant**. 2. Call **requestPermissionsFromUser** to request the permissions from end users in the form of a dialog box. This operation is required because the grant mode of both permissions is **user_grant**.
``` ```
import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA'] let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA']
context.requestPermissionsFromUser(permissions).then((data) => { let atManager = abilityAccessCtrl.createAtManager();
// context is the ability-level context of the initiator UIAbility.
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
console.log("Succeed to request permission from user with data: " + JSON.stringify(data)) console.log("Succeed to request permission from user with data: " + JSON.stringify(data))
}).catch((error) => { }).catch((error) => {
console.log("Failed to request permission from user with error: " + JSON.stringify(error)) console.log("Failed to request permission from user with error: " + JSON.stringify(error))
......
...@@ -76,4 +76,4 @@ Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9 ...@@ -76,4 +76,4 @@ Applicable to: OpenHarmony SDK 3.2.7.5, stage model of API version 9
4. Use message port 0 on the application side to send messages to message port 1 on the HTML side. 4. Use message port 0 on the application side to send messages to message port 1 on the HTML side.
Reference: [Web](../reference/arkui-ts/ts-basic-components-web.md#postmessage9) Reference: [Web](../reference/arkui-ts/ts-basic-components-web.md)
...@@ -20,9 +20,9 @@ The following figures show the AVRecorder state transition and the interaction w ...@@ -20,9 +20,9 @@ The following figures show the AVRecorder state transition and the interaction w
## Constraints ## Constraints
Before developing audio recording, configure the permission **ohos.permission.MICROPHONE** for your application. For details about the configuration, see [Permission Application Guide](../security/accesstoken-guidelines.md). Before developing the recording feature, configure permissions for your application. If audio recording is involved, obtain the permission **ohos.permission.MICROPHONE** by following the instructions provided in [Permission Application Guide](../security/accesstoken-guidelines.md).
To use the camera to record videos, the camera module is required. For details about how to use the camera APIs, see [Camera Management](../reference/apis/js-apis-camera.md). To use the camera to record videos, the camera module is required. For details about how to use the APIs and obtain permissions, see [Camera Management](../reference/apis/js-apis-camera.md).
## How to Develop ## How to Develop
...@@ -30,6 +30,8 @@ For details about the AVRecorder APIs, see the [AVRecorder APIs in the Media Cla ...@@ -30,6 +30,8 @@ For details about the AVRecorder APIs, see the [AVRecorder APIs in the Media Cla
For details about the processes related to the media library, see [Media Library Management](../reference/apis/js-apis-medialibrary.md). For details about the processes related to the media library, see [Media Library Management](../reference/apis/js-apis-medialibrary.md).
For details about the camera-related process, see [Camera Management](../reference/apis/js-apis-camera.md).
### Full-Process Scenario of Audio and Video Recording ### Full-Process Scenario of Audio and Video Recording
The full audio and video recording process includes creating an instance, setting recording parameters, obtaining the input surface, starting, pausing, resuming, and stopping recording, and releasing resources. The full audio and video recording process includes creating an instance, setting recording parameters, obtaining the input surface, starting, pausing, resuming, and stopping recording, and releasing resources.
...@@ -478,9 +480,3 @@ export class VideoRecorderDemo { ...@@ -478,9 +480,3 @@ export class VideoRecorderDemo {
} }
} }
``` ```
### AVRecorder App
The AVRecorder app provides a complete audio and video recording process, which includes creating an instance, setting recording parameters, obtaining the input surface, starting, pausing, resuming, and stopping recording, and releasing resources.
For details about the code, see [AVRecorderDemo]([multimedia_player_framework: Implementation of media playback and recording](https://gitee.com/openharmony/multimedia_player_framework/tree/master/test/appdemo/AVRecorderDemo)).
# Ability框架开发常见问题 # Ability框架开发常见问题
## Stage模型中是否有类似FA模型的DataAbility的开发指导文档
适用于:OpenHarmony SDK 3.2.3.5版本, API9 Stage模型
Stage模型中DataShareExtensionAbility提供了向其他应用共享以及管理其数据的方法。
参考文档:[数据共享开发指导](../database/database-datashare-guidelines.md)
## 拉起Ability在界面上没反应 ## 拉起Ability在界面上没反应
适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型
...@@ -54,7 +46,7 @@ build() { ...@@ -54,7 +46,7 @@ build() {
方式二:使用箭头函数。 方式二:使用箭头函数。
## 如何解决must have required property 'startWindowIcon'报错 ## 如何解决must have required property 'startWindowIcon'报错
适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型
...@@ -83,27 +75,19 @@ Ability配置中缺少startWindowIcon属性配置,需要在module.json5中abil ...@@ -83,27 +75,19 @@ Ability配置中缺少startWindowIcon属性配置,需要在module.json5中abil
使用Ability的onConfigurationUpdated回调实现,系统语言、颜色模式以及Display相关的参数,比如方向、Density,发生变化时触发该回调。 使用Ability的onConfigurationUpdated回调实现,系统语言、颜色模式以及Display相关的参数,比如方向、Density,发生变化时触发该回调。
参考文档:[Ability开发指导](../ability/stage-ability.md)
## Stage模型是否推荐用globalThis去获取Context ## Stage模型是否推荐用globalThis去获取Context
适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型
不推荐,Stage模型使用globalThis去获取Context是错误的使用方式。在Stage模型中,整个应用进程共用一个js虚拟机实例,其中可以运行多个Ability实例,共用一个global对象。在同一个js虚拟机内的不同的Ability中使用globalThis获取Context,存在被覆盖从而发生错误的风险。 不推荐,Stage模型使用globalThis去获取Context是错误的使用方式。在Stage模型中,整个应用进程共用一个js虚拟机实例,其中可以运行多个Ability实例,共用一个global对象。在同一个js虚拟机内的不同的Ability中使用globalThis获取Context,存在被覆盖从而发生错误的风险。
推荐使用方式参考:[Stage模型的Context详细介绍](../ability/context-userguide.md#stage模型的context详细介绍) 推荐使用方式参考:[Stage模型的Context详细介绍](../application-models/application-context-stage.md)
## 如何在应用A中去获取应用B的Hap包的安装路径 ## 如何在应用A中去获取应用B的HAP的安装路径
适用于:OpenHarmony SDK 3.0以上版本, API9 Stage模型 适用于:OpenHarmony SDK 3.0以上版本, API9 Stage模型
首先需要申请系统权限,具体参看文档:[自动化签名](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-auto-configuring-signature-information-0000001271659465)。导入bundle模块,通过调用bundle.getApplicationInfo()接口,通过包名获取应用信息。然后通过application.moduleSourceDirs获取应用存储路径。 首先需要申请系统权限,具体参看文档:[自动化签名](https://developer.harmonyos.com/cn/docs/documentation/doc-guides/ohos-auto-configuring-signature-information-0000001271659465)。导入bundle模块,通过调用bundle.getApplicationInfo()接口,通过Bundle名称获取应用信息。然后通过application.moduleSourceDirs获取应用存储路径。
## 调用方使用startAbilityForResult,被调用方如何返回数据
适用于:OpenHarmony SDK3.0, API9 Stage模型
被调用方使用AbilityContext.terminateSelfWithResult方法,销毁被调用方ability,传递参数给startAbilityForResult回调函数,具体用法请参考[AbilityContext](../reference/apis/js-apis-ability-context.md#abilitycontextterminateselfwithresult)
## FA卡片上架后在用户的服务中心展示时可否触发生命周期,从而实现用户没有打开过FA应用的情况下获取到用户的登录信息? ## FA卡片上架后在用户的服务中心展示时可否触发生命周期,从而实现用户没有打开过FA应用的情况下获取到用户的登录信息?
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型
通过\@ohos.bundle模块bundle.getBundleInfo()接口获取包信息bundleInfo,然后分别通过bundleInfo.versionCode、bundleInfo.versionName 通过@ohos.bundle模块bundle.getBundleInfo()接口获取包信息bundleInfo,然后分别通过bundleInfo.versionCode、bundleInfo.versionName
参考文档:[Bundle模块](../reference/apis/js-apis-Bundle.md#bundlegetbundleinfo) 参考文档:[Bundle模块](../reference/apis/js-apis-Bundle.md#bundlegetbundleinfo)
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
通过可以context.abilityInfo.bundleName获取。 通过可以context.abilityInfo.bundleName获取。
参考文档:[AbilityContext](../reference/apis/js-apis-ability-context.md)[AbilityInfo](../reference/apis/js-apis-bundle-AbilityInfo.md) 参考文档:[AbilityInfo](../reference/apis/js-apis-bundle-AbilityInfo.md)
## 如何获取应用图标 ## 如何获取应用图标
......
...@@ -18,7 +18,7 @@ extraData代表发送请求的额外数据,支持如下数据: ...@@ -18,7 +18,7 @@ extraData代表发送请求的额外数据,支持如下数据:
错误码28代表CURLE_OPERATION_TIMEDOUT,操作超时。网络请求底层使用libcurl库,更多错误码可以查看相应文档。 错误码28代表CURLE_OPERATION_TIMEDOUT,操作超时。网络请求底层使用libcurl库,更多错误码可以查看相应文档。
参考文档:[Response常用错误码](../reference/apis/js-apis-http.md#response常用错误码)[Curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) 参考文档:[Curl错误码](https://curl.se/libcurl/c/libcurl-errors.html)
## \@ohos.net.http.d.ts的response错误码返回6是什么意思? ## \@ohos.net.http.d.ts的response错误码返回6是什么意思?
...@@ -26,7 +26,7 @@ extraData代表发送请求的额外数据,支持如下数据: ...@@ -26,7 +26,7 @@ extraData代表发送请求的额外数据,支持如下数据:
6表示地址无法解析主机,可以尝试ping一下request中的url,确认是否可以ping通。 6表示地址无法解析主机,可以尝试ping一下request中的url,确认是否可以ping通。
更多错误码参考[Response常用错误码](../reference/apis/js-apis-http.md#response常用错误码)或者[Curl错误码](https://curl.se/libcurl/c/libcurl-errors.html) 更多错误码参考[Curl错误码](https://curl.se/libcurl/c/libcurl-errors.html)
## 调用camera拍摄的照片怎么上传到服务器 ## 调用camera拍摄的照片怎么上传到服务器
...@@ -44,7 +44,7 @@ HttpRequestOptions中的header是一个Object类型,可以直接在header里 ...@@ -44,7 +44,7 @@ HttpRequestOptions中的header是一个Object类型,可以直接在header里
适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型
1. 鼠标移到extraData, ctrl+鼠标左键,跳转到sdk中,里面有关于extraData的传参说明。可以发现文档中对extraData的定义是这样的 extraData?: string | Object,也就是extraData支持string 和 Object两种类型。 1. 鼠标移到extraData, ctrl+鼠标左键,跳转到sdk中,里面有关于extraData的传参说明。可以发现文档中对extraData的定义为 extraData?: string | Object,也就是extraData支持string 和 Object两种类型。
2. 这两种写法都可以实现: 2. 这两种写法都可以实现:
a.extraData:"data to send"; a.extraData:"data to send";
......
# 数据管理开发常见问题 # 数据管理开发常见问题
## 如何将PixelMap的数据存储到数据库中 ## 如何将PixelMap的数据存储到数据库中
适用于:OpenHarmony SDK 3.2.3.5版本 适用于:OpenHarmony SDK 3.2.3.5版本
...@@ -16,7 +16,6 @@ PixelMap应该被转换成相应的ArrayBuffer再放进数据库。 ...@@ -16,7 +16,6 @@ PixelMap应该被转换成相应的ArrayBuffer再放进数据库。
示例: 示例:
``` ```
hdc_std file recv /data/app/el2/100/database/com.xxxx.xxxx/entry/db/test.db ./test.db hdc_std file recv /data/app/el2/100/database/com.xxxx.xxxx/entry/db/test.db ./test.db
``` ```
...@@ -62,12 +61,8 @@ PixelMap应该被转换成相应的ArrayBuffer再放进数据库。 ...@@ -62,12 +61,8 @@ PixelMap应该被转换成相应的ArrayBuffer再放进数据库。
- 分布式数据管理KV数据模型Value最大支持4M。 - 分布式数据管理KV数据模型Value最大支持4M。
参考文档:[首选项概述](../database/database-preference-overview.md)[分布式数据服务概述](../database/database-mdds-overview.md)
## Stage模型数据共享DataShare开发 ## Stage模型数据共享DataShare开发
适用于:OpenHarmony SDK 3.2.5.5版本,API 9 适用于:OpenHarmony SDK 3.2.5.5版本,API 9
Stage模型DataShare不可与FA模型DataAbility混用,连接的服务端应用需使用DataShareExtensionAbility实现。 Stage模型DataShare不可与FA模型DataAbility混用,连接的服务端应用需使用DataShareExtensionAbility实现。
参考文档:[数据共享开发指导](../database/database-datashare-guidelines.md)
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
- 方法二:通过截屏脚本一键截屏,可以在电脑上查看。操作方法:Windows上连接开发板,然后电脑上新建文本文件,拷贝如下脚本内容,文件名后缀改为.bat文件(需要提前配置好hdc的环境变量),点击运行后,截屏图片与脚本在同一目录。 - 方法二:通过截屏脚本一键截屏,可以在电脑上查看。操作方法:Windows上连接开发板,然后电脑上新建文本文件,拷贝如下脚本内容,文件名后缀改为.bat文件(需要提前配置好hdc的环境变量),点击运行后,截屏图片与脚本在同一目录。
示例: 示例:
``` ```
set filepath=/data/%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%.png set filepath=/data/%date:~0,4%%date:~5,2%%date:~8,2%%time:~1,1%%time:~3,2%%time:~6,2%.png
echo %filepath% echo %filepath%
......
...@@ -43,9 +43,9 @@ try { ...@@ -43,9 +43,9 @@ try {
适用于:OpenHarmony SDK3.0, API9 Stage模型 适用于:OpenHarmony SDK3.0, API9 Stage模型
1如果想获取连接设备的udid,可使用 hdc shell bm get --udid命令; 1. 如果想获取连接设备的udid,可使用 hdc shell bm get --udid命令;
2如果想在代码中获得,参考文档 [udid](../reference/apis/js-apis-device-info.md) 2. 如果想在代码中获得,参考文档 [udid](../reference/apis/js-apis-device-info.md)
## 开发快捷键功能 ## 开发快捷键功能
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
使用于:OpenHarmony SDK 3.2.5.5版本 使用于:OpenHarmony SDK 3.2.5.5版本
1.通过业务日志打印,定位崩溃的代码位置。 1. 通过业务日志打印,定位崩溃的代码位置。
2.通过Crash文件查看报错信息,Crash文件路径是:/data/log/faultlog/faultlogger/。 2. 通过Crash文件查看报错信息,Crash文件路径是:/data/log/faultlog/faultlogger/。
## UiTest测试框架无法获取控件问题 ## UiTest测试框架无法获取控件问题
......
...@@ -12,19 +12,19 @@ emitter数据大小限制不超过10240。 ...@@ -12,19 +12,19 @@ emitter数据大小限制不超过10240。
通过配置Notification.publish发布通知接口的参数NotificationRequest中wantAgent属性实现 通过配置Notification.publish发布通知接口的参数NotificationRequest中wantAgent属性实现
参考文档:[Notification](../reference/apis/js-apis-notification.md#notificationpublish)[WantAgent](../reference/apis/js-apis-wantAgent.md) 参考文档:[Notification](../reference/apis/js-apis-notification.md#notificationpublish)[WantAgent](../reference/apis/js-apis-app-ability-wantAgent.md)
示例: 示例:
``` ```ts
import WantAgent from '@ohos.wantAgent'; import WantAgent from '@ohos.app.ability.wantAgent';
async function publishNotification() { async function publishNotification() {
let wantAgentInfo = { let wantAgentInfo = {
wants: [ wants: [
{ {
bundleName: "com.example.notification", bundleName: "com.example.myapplication",
abilityName: "MainAbility", abilityName: "EntryAbility",
} }
], ],
operationType: WantAgent.OperationType.START_ABILITIES, operationType: WantAgent.OperationType.START_ABILITIES,
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
是递归删除。 是递归删除。
## 如何实现如果文件不存在则创建文件 ## 如何实现如果文件不存在则创建文件
适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型
......
...@@ -17,11 +17,11 @@ ...@@ -17,11 +17,11 @@
适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.6.3版本,API9 Stage模型
1. 可以在onWindowStageCreate方法获取windowClass对象。 1. 可以在onWindowStageCreate方法获取windowClass对象。
``` ```ts
onWindowStageCreate(windowStage) { onWindowStageCreate(windowStage) {
// Main window is created, set main page for this ability // Main window is created, set main page for this ability
console.log("[Demo] MainAbility onWindowStageCreate") console.log("[Demo] EntryAbility onWindowStageCreate")
windowStage.getMainWindow((err, data) => { windowStage.getMainWindow((err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to obtain the main window.') console.error('Failed to obtain the main window.')
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
``` ```
2. 设置窗口全屏,隐藏状态栏。 2. 设置窗口全屏,隐藏状态栏。
``` ```ts
globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => { globalThis.windowClass.setFullScreen(isFullScreen, (err, data) => {
if (err.code) { if (err.code) {
console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err)); console.error('Failed to enable the full-screen mode. Cause:' + JSON.stringify(err));
...@@ -53,8 +53,8 @@ ...@@ -53,8 +53,8 @@
示例: 示例:
``` ```ts
let promise = windowClass.getProperties(); let promise = windowClass.getProperties();
promise.then((data)=> { promise.then((data)=> {
console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect)); console.info('Succeeded in obtaining the window properties. Data: ' + JSON.stringify(data.windowRect));
...@@ -69,8 +69,8 @@ promise.then((data)=> { ...@@ -69,8 +69,8 @@ promise.then((data)=> {
参考如下方式实现,示例: 参考如下方式实现,示例:
``` ```ts
window.getTopWindow(globalThis.mainContext).then(win => { window.getTopWindow(globalThis.mainContext).then(win => {
var systemBarProperties = { var systemBarProperties = {
statusBarColor: '#19B6FF', // 状态栏背景颜色 statusBarColor: '#19B6FF', // 状态栏背景颜色
......
...@@ -16,7 +16,6 @@ TS语言的使用在生成器函数中存在以下限制: ...@@ -16,7 +16,6 @@ TS语言的使用在生成器函数中存在以下限制:
错误示例: 错误示例:
``` ```
build() { build() {
let a: number = 1 // invalid: variable declaration not allowed let a: number = 1 // invalid: variable declaration not allowed
...@@ -54,7 +53,7 @@ build() { ...@@ -54,7 +53,7 @@ build() {
1. 通过resourceManager的RawFile接口获取Uint8Array格式数据。 1. 通过resourceManager的RawFile接口获取Uint8Array格式数据。
2. 通过String.fromCharCode将Uint8Array格式数据转化为String类型。快快快 2. 通过String.fromCharCode将Uint8Array格式数据转化为String类型。
参考文档:[资源管理](../reference/apis/js-apis-resource-manager.md) 参考文档:[资源管理](../reference/apis/js-apis-resource-manager.md)
...@@ -86,8 +85,6 @@ resourceManager.getRawFile(path, (error, value) => { ...@@ -86,8 +85,6 @@ resourceManager.getRawFile(path, (error, value) => {
Page和Ability打包后会对import的对象分别形成两个不同的闭包,即打包出两个Global对象。因此,所引用的静态变量并不是同一对象,所以无法通过class静态变量方式定义全局变量。建议使用AppStorage进行全局变量管理。 Page和Ability打包后会对import的对象分别形成两个不同的闭包,即打包出两个Global对象。因此,所引用的静态变量并不是同一对象,所以无法通过class静态变量方式定义全局变量。建议使用AppStorage进行全局变量管理。
参考文档:[应用程序的数据存储](../quick-start/arkts-state-mgmt-application-level.md)
## Stage模型下如何获取资源 ## Stage模型下如何获取资源
适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.3.5版本,API9 Stage模型
...@@ -180,7 +177,7 @@ systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970 ...@@ -180,7 +177,7 @@ systemTime.getCurrentTime(false)和new Date().getTime()一样,都是返回1970
适用于:OpenHarmony SDK3.2.6.5, API9 Stage模型 适用于:OpenHarmony SDK3.2.6.5, API9 Stage模型
\@BuilderParam修饰的属性进行赋值时不带参数(如:content: this.specificParam),则此属性的类型需定义成无返回值的函数(如:\@BuilderParam content: () =&gt; void);若带参数(如:callContent: this.specificParam1("111")),则此属性的类型需定义成any(如:\@BuilderParam callContent: any;),具体用法请参考[BuilderParam](../quick-start/arkts-dynamic-ui-elememt-building.md#builderparam8) \@BuilderParam修饰的属性进行赋值时不带参数(如:content: this.specificParam),则此属性的类型需定义成无返回值的函数(如:\@BuilderParam content: () =&gt; void);若带参数(如:callContent: this.specificParam1("111")),则此属性的类型需定义成any(如:\@BuilderParam callContent: any;)。
## ArkTS如何把string转成byte数组 ## ArkTS如何把string转成byte数组
...@@ -248,8 +245,6 @@ OpenHarmony推荐使用worker来处理多线程场景。 ...@@ -248,8 +245,6 @@ OpenHarmony推荐使用worker来处理多线程场景。
通过\@Observed配合\@ObjectLink装饰符实现。 通过\@Observed配合\@ObjectLink装饰符实现。
参考文档:[Observed和ObjectLink数据管理](../quick-start/arkts-state-mgmt-page-level.md#observed和objectlink数据管理)
## 如何实现字符串编解码 ## 如何实现字符串编解码
适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型
......
...@@ -42,7 +42,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId) ...@@ -42,7 +42,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId)
适用于:OpenHarmony 3.2.5.6版本,API9 Stage模型 适用于:OpenHarmony 3.2.5.6版本,API9 Stage模型
1. **通过传入的uri创建图片源实例ImageSource对象。** 1. **通过传入的uri创建图片源实例ImageSource对象。**
``` ```
let path = this.context.getApplicationContext().fileDirs + "test.jpg"; let path = this.context.getApplicationContext().fileDirs + "test.jpg";
const imageSourceApi = image.createImageSource(path); const imageSourceApi = image.createImageSource(path);
...@@ -52,7 +52,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId) ...@@ -52,7 +52,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId)
- 设置desiredSize支持按尺寸缩放,如果设置为全0,则不进行缩放。 - 设置desiredSize支持按尺寸缩放,如果设置为全0,则不进行缩放。
- 设置desiredRegion支持按矩形区域裁剪,如果设置为全0,则不进行裁剪。 - 设置desiredRegion支持按矩形区域裁剪,如果设置为全0,则不进行裁剪。
- 设置rotateDegrees支持旋转角度,以图像中心点顺时针旋转。 - 设置rotateDegrees支持旋转角度,以图像中心点顺时针旋转。
``` ```
const decodingOptions = { const decodingOptions = {
desiredSize: { desiredSize: {
...@@ -85,7 +85,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId) ...@@ -85,7 +85,7 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId)
1. 在module.json5配置文件中配置媒体读写权限ohos.permission.READ_MEDIA和ohos.permission.WRITE_MEDIA。 1. 在module.json5配置文件中配置媒体读写权限ohos.permission.READ_MEDIA和ohos.permission.WRITE_MEDIA。
示例: 示例:
``` ```
{ {
"module" : { "module" : {
...@@ -104,13 +104,13 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId) ...@@ -104,13 +104,13 @@ cameraInput = await this.cameraManager.createCameraInput(cameraId)
``` ```
2. 这两个权限的授权方式均为user_grant,因此需要调用requestPermissionsFromUser接口,以动态弹窗的方式向用户申请授权。 2. 这两个权限的授权方式均为user_grant,因此需要调用requestPermissionsFromUser接口,以动态弹窗的方式向用户申请授权。
``` ```
import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl.d.ts';
let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA'] let permissions: Array<string> = ['ohos.permission.READ_MEDIA','ohos.permission.WRITE_MEDIA']
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
// context为调用方UIAbility的AbilityContext // context为调用方UIAbility的UIAbilityContext
atManager.requestPermissionsFromUser(context, permissions).then((data) => { atManager.requestPermissionsFromUser(context, permissions).then((data) => {
console.log("Succeed to request permission from user with data: " + JSON.stringify(data)) console.log("Succeed to request permission from user with data: " + JSON.stringify(data))
}).catch((error) => { }).catch((error) => {
......
...@@ -28,9 +28,9 @@ Native API中的[Drawing](../reference/native-apis/_drawing.md)接口可以提 ...@@ -28,9 +28,9 @@ Native API中的[Drawing](../reference/native-apis/_drawing.md)接口可以提
适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.5.3版本,API9 Stage模型
1. 在编译工具Hvigor脚本文件hvigorfile.js中,通过subModule.getPackageJsonPath方法获取module中package.json文件位置 1. 在编译工具Hvigor脚本文件hvigorfile.js中,通过subModule.getPackageJsonPath方法获取module中package.json文件位置
2. 使用nodejs能力读取package.json文件中version字段,写入build-profile.json5文件buildOption.cppFlags字段 2. 使用nodejs能力读取package.json文件中version字段,写入build-profile.json5文件buildOption.cppFlags字段
示例: 示例:
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
可以使用Stack堆叠容器,设置子组件在容器内的最底部。 可以使用Stack堆叠容器,设置子组件在容器内的最底部。
示例: 示例:
``` ```
build() { build() {
Stack({alignContent : Alignment.Bottom}) { Stack({alignContent : Alignment.Bottom}) {
...@@ -59,7 +59,7 @@ build() { ...@@ -59,7 +59,7 @@ build() {
示例: 示例:
``` ```
// 弹窗组件 // 弹窗组件
@CustomDialog @CustomDialog
...@@ -144,7 +144,7 @@ GridContainer内子组件默认水平左对齐,居中显示可以参考以下 ...@@ -144,7 +144,7 @@ GridContainer内子组件默认水平左对齐,居中显示可以参考以下
内部嵌套布局组件Row,设置Row属性justifyContent(FlexAlign.Center),内部嵌套子组件可保持居中显示,参考[栅格布局](../reference/arkui-ts/ts-container-gridcontainer.md)文档。 内部嵌套布局组件Row,设置Row属性justifyContent(FlexAlign.Center),内部嵌套子组件可保持居中显示,参考[栅格布局](../reference/arkui-ts/ts-container-gridcontainer.md)文档。
示例: 示例:
``` ```
GridContainer({ sizeType: SizeType.SM, columns: 12 }) { GridContainer({ sizeType: SizeType.SM, columns: 12 }) {
Row() { Row() {
...@@ -164,10 +164,10 @@ GridContainer({ sizeType: SizeType.SM, columns: 12 }) { ...@@ -164,10 +164,10 @@ GridContainer({ sizeType: SizeType.SM, columns: 12 }) {
在加载窗口内容之前,采用systemAvoidAreaChange事件监听。 在加载窗口内容之前,采用systemAvoidAreaChange事件监听。
示例: 示例:
``` ```ts
// MainAbility.ts import Window from '@ohos.window';
import window from '@ohos.window'; import UIAbility from '@ohos.app.ability.UIAbility';
/** /**
* 设置沉浸式窗口,并获取状态栏和导航栏高度 * 设置沉浸式窗口,并获取状态栏和导航栏高度
...@@ -187,7 +187,7 @@ async function enterImmersion(mainWindow: window.Window) { ...@@ -187,7 +187,7 @@ async function enterImmersion(mainWindow: window.Window) {
statusBarContentColor: "#FF0000" statusBarContentColor: "#FF0000"
}) })
} }
export default class MainAbility extends Ability { export default class EntryAbility extends UIAbility {
// do something // do something
async onWindowStageCreate(windowStage: window.WindowStage) { async onWindowStageCreate(windowStage: window.WindowStage) {
let mainWindow = await windowStage.getMainWindow() let mainWindow = await windowStage.getMainWindow()
...@@ -212,8 +212,8 @@ gesture的属性distance默认值是5,把gesture的属性distance设成1就可 ...@@ -212,8 +212,8 @@ gesture的属性distance默认值是5,把gesture的属性distance设成1就可
示例: 示例:
``` ```ts
Column() { Column() {
Text(this.value) Text(this.value)
.backgroundColor(Color.Green).margin(30).fontSize(20) .backgroundColor(Color.Green).margin(30).fontSize(20)
...@@ -234,8 +234,8 @@ List组件绑定Scoller控制器,通过currentOffset方式获取当前的滚 ...@@ -234,8 +234,8 @@ List组件绑定Scoller控制器,通过currentOffset方式获取当前的滚
示例: 示例:
``` ```ts
Column() { Column() {
List({ space: 20, initialIndex: 0,scroller: this.scroller}) { List({ space: 20, initialIndex: 0,scroller: this.scroller}) {
ForEach(this.arr, (item) => { ForEach(this.arr, (item) => {
...@@ -258,8 +258,8 @@ Column() { ...@@ -258,8 +258,8 @@ Column() {
适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型
``` ```ts
// 3.1.5.5版本之前,取值方式为:router.getParams().key // 3.1.5.5版本之前,取值方式为:router.getParams().key
private value: string = router.getParams().value; private value: string = router.getParams().value;
// 从3.1.6.5版本起,取值方式为:router.getParams()['key'] // 从3.1.6.5版本起,取值方式为:router.getParams()['key']
...@@ -296,8 +296,8 @@ lpx相当于百分比视图,按比例扩大或者缩小。 ...@@ -296,8 +296,8 @@ lpx相当于百分比视图,按比例扩大或者缩小。
颜色可以使用两种格式,例如 0x7F000000 或者 '\#7F000000' ,其中前两位是透明度,后六位是RGB。 颜色可以使用两种格式,例如 0x7F000000 或者 '\#7F000000' ,其中前两位是透明度,后六位是RGB。
``` ```ts
fontColor(0x7F000000) fontColor(0x7F000000)
fontColor( '#7F000000' ) fontColor( '#7F000000' )
``` ```
...@@ -306,7 +306,7 @@ fontColor( '#7F000000' ) ...@@ -306,7 +306,7 @@ fontColor( '#7F000000' )
适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.5.5版本,API9 Stage模型
在Page页面返回时,系统会调用\@Entry修饰的自定义组件的onBackPress()回调,可以在回调函数中实现相关业务诉求。参考[自定义组件生命周期回调函数](../ui/ui-ts-custom-component-lifecycle-callbacks.md) 在Page页面返回时,系统会调用\@Entry修饰的自定义组件的onBackPress()回调,可以在回调函数中实现相关业务诉求。参考[自定义组件生命周期回调函数](../reference/arkui-ts/ts-custom-component-lifecycle.md)
## TextInput组件密码模式下,右边的眼睛图标是否支持自定义? ## TextInput组件密码模式下,右边的眼睛图标是否支持自定义?
...@@ -356,12 +356,6 @@ onSubmit事件在回车键或软键盘回车触发该回调,参数为当前软 ...@@ -356,12 +356,6 @@ onSubmit事件在回车键或软键盘回车触发该回调,参数为当前软
页面路由栈支持的最大页面数量是32,当超出此限制时,使用router.push接口页面无法完成跳转 。 页面路由栈支持的最大页面数量是32,当超出此限制时,使用router.push接口页面无法完成跳转 。
## ArkUI是否支持通过代码动态创建组件
适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型
支持使用[条件渲染](../quick-start/arkts-rendering-control.md#条件渲染)[循环渲染](../quick-start/arkts-rendering-control.md#循环渲染)等方式进行动态创建组件。
## 页面路由携带PixelMap对象参数,跳转页面无法获取 ## 页面路由携带PixelMap对象参数,跳转页面无法获取
适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型
...@@ -400,7 +394,7 @@ input 组件的 type 设置为 date,只是会有相关格式提示,本质上 ...@@ -400,7 +394,7 @@ input 组件的 type 设置为 date,只是会有相关格式提示,本质上
示例: 示例:
``` ```
@Component @Component
struct FoodImageDisplay { struct FoodImageDisplay {
...@@ -504,7 +498,7 @@ Scroll支持单个子组件,子组件高度应由内容高度决定,当内 ...@@ -504,7 +498,7 @@ Scroll支持单个子组件,子组件高度应由内容高度决定,当内
可以参考如下实现: 可以参考如下实现:
``` ```
struct Index { struct Index {
@State text: string = 'Hello World' @State text: string = 'Hello World'
...@@ -545,12 +539,6 @@ id添加为唯一值,成为关键字。 ...@@ -545,12 +539,6 @@ id添加为唯一值,成为关键字。
基于OpenHarmony开发的应用,默认字体'HarmonyOS Sans',且当前只支持这种字体。 基于OpenHarmony开发的应用,默认字体'HarmonyOS Sans',且当前只支持这种字体。
## Ability与UI页面推荐的数据交互方式是什么
适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型
推荐使用[LocalStorage](../quick-start/arkts-state-mgmt-application-level.md#localstorage)
## 父组件如何与其孙子组件进行状态同步 ## 父组件如何与其孙子组件进行状态同步
适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.6.5版本,API9 Stage模型
...@@ -565,7 +553,7 @@ id添加为唯一值,成为关键字。 ...@@ -565,7 +553,7 @@ id添加为唯一值,成为关键字。
代码示例 代码示例
``` ```
beautySub(str,len) { beautySub(str,len) {
var reg = /[\u4e00-\u9fa5]/g; var reg = /[\u4e00-\u9fa5]/g;
...@@ -623,11 +611,9 @@ RichText底层是web,可以参考html的语法,在div上加上的overflow: ...@@ -623,11 +611,9 @@ RichText底层是web,可以参考html的语法,在div上加上的overflow:
通过PersistentStorage类实现管理应用持久化数据,可以将特定标记的持久化数据链接到AppStorage中,并由AppStorage接口访问对应持久化数据。 通过PersistentStorage类实现管理应用持久化数据,可以将特定标记的持久化数据链接到AppStorage中,并由AppStorage接口访问对应持久化数据。
参考文档:[持久化数据管理](../quick-start/arkts-state-mgmt-application-level.md#persistentstorage)
示例: 示例:
``` ```
AppStorage.Link('varA') AppStorage.Link('varA')
PersistentStorage.PersistProp("varA", "111"); PersistentStorage.PersistProp("varA", "111");
......
...@@ -91,5 +91,4 @@ export default class DateTimeUtil{ ...@@ -91,5 +91,4 @@ export default class DateTimeUtil{
} }
} }
``` ```
\ No newline at end of file
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认未开启,控制web网页中localStorage的使用,对sessionStorage未做控制 设置是否开启文档对象模型存储接口(DOM Storage API)权限,默认未开启,控制web网页中localStorage的使用,对sessionStorage未做控制
## Web组件加载的html页面内如何检测网络状态 ## Web组件加载的html页面内如何检测网络状态
适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型 适用于:OpenHarmony SDK 3.2.7.5版本,API9 Stage模型
...@@ -77,4 +76,4 @@ onAppear方法只是定位完Canvas的位置,onReady方法才是测量完成 ...@@ -77,4 +76,4 @@ onAppear方法只是定位完Canvas的位置,onReady方法才是测量完成
4. 使用应用侧的端口0给HTML侧消息端口1发送消息。 4. 使用应用侧的端口0给HTML侧消息端口1发送消息。
使用参考:[Web组件](../reference/arkui-ts/ts-basic-components-web.md#postmessage9) 使用参考:[Web组件](../reference/arkui-ts/ts-basic-components-web.md)
...@@ -35,7 +35,7 @@ AVPlayer提供功能完善一体化播放能力,应用只需要提供流媒体 ...@@ -35,7 +35,7 @@ AVPlayer提供功能完善一体化播放能力,应用只需要提供流媒体
应用通过调用JS接口层提供的AVPlayer接口实现相应功能时,框架层会通过播放服务(Player Framework)解析成单独的音频数据流和视频数据流,音频数据流经过软件解码后输出至音频服务(Audio Framework),再至硬件接口层的音频HDI,实现音频播放功能。视频数据流经过硬件(推荐)/软件解码后输出至图形渲染服务(Graphic Framework),再输出至硬件接口层的显示HDI,完成图形渲染。 应用通过调用JS接口层提供的AVPlayer接口实现相应功能时,框架层会通过播放服务(Player Framework)解析成单独的音频数据流和视频数据流,音频数据流经过软件解码后输出至音频服务(Audio Framework),再至硬件接口层的音频HDI,实现音频播放功能。视频数据流经过硬件(推荐)/软件解码后输出至图形渲染服务(Graphic Framework),再输出至硬件接口层的显示HDI,完成图形渲染。
完整的视频播放需要:应用、XComponemt、Player Framework、Graphic Framework、Audio Framework、显示HDI和音频HDI共同实现。 完整的视频播放需要:应用、XComponent、Player Framework、Graphic Framework、Audio Framework、显示HDI和音频HDI共同实现。
图2中,数字标注表示需要数据与外部模块的传递。 图2中,数字标注表示需要数据与外部模块的传递。
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
音视频类应用接入媒体会话后,可以发送应用的数据(比如正在播放的歌曲、歌曲的播放状态等),用户可以通过系统播控中心、语音助手等应用切换多个应用、多个设备播放。音视频类应用如果不接入媒体会话,将无法在后台播放,在应用进入后台时,会被强制停止播放。 音视频类应用接入媒体会话后,可以发送应用的数据(比如正在播放的歌曲、歌曲的播放状态等),用户可以通过系统播控中心、语音助手等应用切换多个应用、多个设备播放。音视频类应用如果不接入媒体会话,将无法在后台播放,在应用进入后台时,会被强制停止播放。
实现后台播放,还需申请长时任务避免进入挂起(Suspend)状态。具体参考[长时任务开发指导](../task-management/continuous-task-dev-guide.md)
## 基础概念 ## 基础概念
在开发前,需要先了解以下基础概念: 在开发前,需要先了解以下基础概念:
......
...@@ -46,7 +46,7 @@ ...@@ -46,7 +46,7 @@
> >
> 下面代码示例中的url仅作示意使用,开发者需根据实际情况,确认资源有效性并设置: > 下面代码示例中的url仅作示意使用,开发者需根据实际情况,确认资源有效性并设置:
> >
> - 如果使用本地资源播放,必须确认相应的资源文件可用,并使用应用沙箱路径访问对应资源,参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。 > - 如果使用本地资源播放,必须确认资源文件可用,并使用应用沙箱路径访问对应资源,参考[获取应用文件路径](../application-models/application-context-stage.md#获取应用开发路径)。应用沙箱的介绍及如何向应用沙箱推送文件,请参考[文件管理](../file-management/app-sandbox-directory.md)。
> >
> - 如果使用网络播放路径,需[申请相关权限](../security/accesstoken-guidelines.md):ohos.permission.INTERNET。 > - 如果使用网络播放路径,需[申请相关权限](../security/accesstoken-guidelines.md):ohos.permission.INTERNET。
> >
...@@ -61,7 +61,7 @@ ...@@ -61,7 +61,7 @@
6. 视频播控:播放play(),暂停pause(),跳转seek(),停止stop() 等操作。 6. 视频播控:播放play(),暂停pause(),跳转seek(),停止stop() 等操作。
7. (可选)更换资源:调用reset()重置资源,AVPlayer重新进入idle状态,允许更换资源url。 7. 可选)更换资源:调用reset()重置资源,AVPlayer重新进入idle状态,允许更换资源url。
8. 退出播放:调用release()销毁实例,AVPlayer进入released状态,退出播放。 8. 退出播放:调用release()销毁实例,AVPlayer进入released状态,退出播放。
......
...@@ -30,7 +30,7 @@ OpenHarmony中提供的接口,部分是仅供OEM厂商使用的system api, ...@@ -30,7 +30,7 @@ OpenHarmony中提供的接口,部分是仅供OEM厂商使用的system api,
随DevEco下载的SDK为public-SDK,不包括系统接口。如需使用系统接口,需要: 随DevEco下载的SDK为public-SDK,不包括系统接口。如需使用系统接口,需要:
- 参考[full-SDK替换指南](../../quick-start/full-sdk-switch-guide.md)将SDK替换为full-SDK。 - 参考[full-SDK替换指南](../../quick-start/full-sdk-switch-guide.md)将SDK替换为full-SDK。
- 参考[HarmonyAppProvision配置文件的说明](../../security/app-provision-structure.md#harmonyappprovision配置文件的说明)修改HarmonyAppProvision配置文件中的app-feature字段为hos_system_app(系统应用)。 - 参考[HarmonyAppProvision配置文件的说明](../../security/app-provision-structure.md)修改HarmonyAppProvision配置文件中的app-feature字段为hos_system_app(系统应用)。
## 权限说明 ## 权限说明
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册