Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
c63300fd
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c63300fd
编写于
7月 18, 2023
作者:
O
openharmony_ci
提交者:
Gitee
7月 18, 2023
浏览文件
操作
浏览文件
下载
差异文件
!21011 【资料问题】元能力文档接口一致性和示例代码问题
Merge pull request !21011 from yuyaozhi/master
上级
8c67fb38
c59f5386
变更
25
隐藏空白更改
内联
并排
Showing
25 changed file
with
115 addition
and
111 deletion
+115
-111
zh-cn/application-dev/reference/apis/js-apis-ability-ability.md
...application-dev/reference/apis/js-apis-ability-ability.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-app-ability-common.md
...lication-dev/reference/apis/js-apis-app-ability-common.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md
...dev/reference/apis/js-apis-app-ability-quickFixManager.md
+5
-27
zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md
...pplication-dev/reference/apis/js-apis-app-ability-want.md
+1
-0
zh-cn/application-dev/reference/apis/js-apis-app-form-formBindingData.md
...on-dev/reference/apis/js-apis-app-form-formBindingData.md
+1
-12
zh-cn/application-dev/reference/apis/js-apis-app-form-formInfo.md
...plication-dev/reference/apis/js-apis-app-form-formInfo.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-application-StaticSubscriberExtensionContext.md
...s/js-apis-application-StaticSubscriberExtensionContext.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-application-appManager.md
...tion-dev/reference/apis/js-apis-application-appManager.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-businessAbilityRouter.md
...ation-dev/reference/apis/js-apis-businessAbilityRouter.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
...dev/reference/apis/js-apis-inner-ability-abilityResult.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md
...ev/reference/apis/js-apis-inner-ability-connectOptions.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md
...lication-dev/reference/apis/js-apis-inner-ability-want.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md
...erence/apis/js-apis-inner-application-abilityDelegator.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStateData.md
...erence/apis/js-apis-inner-application-abilityStateData.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md
.../reference/apis/js-apis-inner-application-appStateData.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md
...ence/apis/js-apis-inner-application-applicationContext.md
+2
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md
...pis/js-apis-inner-application-applicationStateObserver.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md
...n-dev/reference/apis/js-apis-inner-application-context.md
+21
-16
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md
...ence/apis/js-apis-inner-application-continueDeviceInfo.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueMissionInfo.md
...nce/apis/js-apis-inner-application-continueMissionInfo.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md
...v/reference/apis/js-apis-inner-application-missionInfo.md
+1
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md
...ference/apis/js-apis-inner-application-missionListener.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
...apis/js-apis-inner-application-serviceExtensionContext.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
...erence/apis/js-apis-inner-application-uiAbilityContext.md
+35
-25
zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md
...cation-dev/reference/apis/js-apis-uripermissionmanager.md
+15
-14
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-ability-ability.md
浏览文件 @
c63300fd
...
...
@@ -13,6 +13,8 @@ Ability模块将二级模块API组织在一起方便开发者进行导出。
import
ability
from
'
@ohos.ability.ability
'
;
```
## 属性
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase
| 名称 | 类型 | 描述 |
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-common.md
浏览文件 @
c63300fd
...
...
@@ -14,7 +14,7 @@ import common from '@ohos.app.ability.common';
```
## 属性
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.Ability
Bas
e
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.Ability
Runtime.Cor
e
| 名称 | 类型 | 说明 |
| ----------- | -------------------- | ------------------------------------------------------------ |
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-quickFixManager.md
浏览文件 @
c63300fd
...
...
@@ -64,21 +64,13 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>, callback: AsyncCallback\<v
**错误码**
:
在打补丁过程中发生的错误,其错误码及错误信息通过公共事件
[
COMMON_EVENT_QUICK_FIX_APPLY_RESULT
](
commonEvent-definitions.md#common_event_quick_fix_apply_result9
)
的参数返回给应用开发者。
| 错误码ID | 错误信息 |
| ------- | -------- |
| 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
| 18500008 | Internal error. |
在打补丁过程中发生的错误,其错误码及错误信息通过公共事件
[
COMMON_EVENT_QUICK_FIX_APPLY_RESULT
](
commonEvent-definitions.md#common_event_quick_fix_apply_result9
)
的参数返回给应用开发者。这部分错误码及错误信息如下:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 18500003 | Deploy hqf failed. |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500006 | Load patch failed. |
| 18500007 | Unload patch failed. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
> 说明:调用applyQuickFix接口时,补丁文件所在路径为应用沙箱路径。沙箱路径的获取参考[获取应用的沙箱路径](js-apis-bundle-BundleInstaller.md#获取应用的沙箱路径),映射到设备上的路径为/proc/<应用进程Id>/root/沙箱路径。
...
...
@@ -126,21 +118,13 @@ applyQuickFix(hapModuleQuickFixFiles: Array\<string>): Promise\<void>;
**错误码**
:
在打补丁过程中发生的错误,其错误码及错误信息通过公共事件
[
COMMON_EVENT_QUICK_FIX_APPLY_RESULT
](
commonEvent-definitions.md#common_event_quick_fix_apply_result9
)
的参数返回给应用开发者。
| 错误码ID | 错误信息 |
| ------- | -------- |
| 18500002 | The specified quick fix is invalid. It may not exist or inaccessible. |
| 18500008 | Internal error. |
在打补丁过程中发生的错误,其错误码及错误信息通过公共事件
[
COMMON_EVENT_QUICK_FIX_APPLY_RESULT
](
commonEvent-definitions.md#common_event_quick_fix_apply_result9
)
的参数返回给应用开发者。这部分错误码及错误信息如下:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 18500003 | Deploy hqf failed. |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500006 | Load patch failed. |
| 18500007 | Unload patch failed. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -279,13 +263,7 @@ revokeQuickFix(bundleName: string, callback: AsyncCallback\<void>): void;
| 18500001 | The bundle is not exist or no patch has applied. |
| 18500009 | The application has a apply quick fix task that is being processed. |
在撤销补丁过程中发生的错误,其错误码及错误信息通过公共事件
[
COMMON_EVENT_QUICK_FIX_REVOKE_RESULT
](
./common_event/commonEvent-ability.md#common_event_quick_fix_revoke_result10
)
的参数返回给应用开发者。这部分错误码及错误信息如下:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 18500004 | Switch hqf failed. |
| 18500005 | Delete hqf failed. |
| 18500007 | Unload patch failed. |
在撤销补丁过程中发生的错误,其错误码及错误信息通过公共事件
[
COMMON_EVENT_QUICK_FIX_REVOKE_RESULT
](
./common_event/commonEvent-ability.md#common_event_quick_fix_revoke_result10
)
的参数返回给应用开发者。
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-want.md
浏览文件 @
c63300fd
...
...
@@ -171,6 +171,7 @@ import Want from '@ohos.app.ability.Want';
```ts
// (1) UIAbility1启动一个ServiceExtension
import common from '@ohos.app.ability.common';
let context = getContext(this) as common.UIAbilityContext; // UIAbilityContext
let want = {
bundleName: 'com.example.myapplication1',
...
...
zh-cn/application-dev/reference/apis/js-apis-app-form-formBindingData.md
浏览文件 @
c63300fd
...
...
@@ -74,15 +74,4 @@ try {
}
catch
(
error
)
{
console
.
error
(
`catch error, code:
${
error
.
code
}
, message:
${
error
.
message
}
`
);
}
```
## ProxyData
定义表单代理数据。
**系统能力**
:SystemCapability.Ability.Form
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| key | string | 是 | 代理的密钥。值取决于数据发布者。|
| subscriberId | string | 否 | 订阅者ID。值取决于数据发布者。默认值为当前卡片ID。|
\ No newline at end of file
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-app-form-formInfo.md
浏览文件 @
c63300fd
...
...
@@ -169,6 +169,8 @@ import formInfo from '@ohos.app.form.formInfo';
**系统能力**
:SystemCapability.Ability.Form
**系统API**
: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | -------- | -------- | -------------------- | ------------------------------------------------------------ |
| bundleName | string | 是 | 否 | 提供方卡片所属包的Bundle名称。 |
...
...
zh-cn/application-dev/reference/apis/js-apis-application-StaticSubscriberExtensionContext.md
浏览文件 @
c63300fd
...
...
@@ -37,7 +37,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
-
调用方应用位于后台时,使用该接口启动Ability需申请
`ohos.permission.START_ABILITIES_FROM_BACKGROUND`
权限
-
跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请
`ohos.permission.START_INVISIBLE_ABILITY`
权限
**需要权限**
:ohos.permission.
CLEAN_BACKGROUND_PROCESSES
**需要权限**
:ohos.permission.
START_ABILITIES_FROM_BACKGROUND
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
...
...
@@ -106,7 +106,7 @@ startAbility(want: Want): Promise<void>;
-
调用方应用位于后台时,使用该接口启动Ability需申请
`ohos.permission.START_ABILITIES_FROM_BACKGROUND`
权限
-
跨应用场景下,目标Ability的visible属性若配置为false,调用方应用需申请
`ohos.permission.START_INVISIBLE_ABILITY`
权限
**需要权限**
:ohos.permission.
CLEAN_BACKGROUND_PROCESSES
**需要权限**
:ohos.permission.
START_ABILITIES_FROM_BACKGROUND
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
...
...
zh-cn/application-dev/reference/apis/js-apis-application-appManager.md
浏览文件 @
c63300fd
...
...
@@ -404,7 +404,7 @@ killProcessWithAccount(bundleName: string, accountId: number): Promise\<void\>
>
> 当accountId为当前用户时,不需要校验ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNTS权限。
**需要权限**
:ohos.permission.
CLEAN_BACKGROUND_PROCESSES, ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNT
S
**需要权限**
:ohos.permission.
INTERACT_ACROSS_LOCAL_ACCOUNTS, ohos.permission.CLEAN_BACKGROUND_PROCESSE
S
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
...
...
@@ -446,7 +446,7 @@ killProcessWithAccount(bundleName: string, accountId: number, callback: AsyncCal
**系统API**
: 此接口为系统接口,三方应用不支持调用。
**需要权限**
:ohos.permission.
CLEAN_BACKGROUND_PROCESSES, ohos.permission.INTERACT_ACROSS_LOCAL_ACCOUNT
S
**需要权限**
:ohos.permission.
INTERACT_ACROSS_LOCAL_ACCOUNTS, ohos.permission.CLEAN_BACKGROUND_PROCESSE
S
**参数:**
...
...
zh-cn/application-dev/reference/apis/js-apis-businessAbilityRouter.md
浏览文件 @
c63300fd
...
...
@@ -26,7 +26,7 @@ import businessAbilityRouter from '@ohos.app.businessAbilityRouter';
此枚举值用于标识过滤条件类型。
**系统能力:**
以下各项对应的系统能力均为SystemCapability.
BundleManager.BundleFramework
.Core
**系统能力:**
以下各项对应的系统能力均为SystemCapability.
Ability.AbilityRuntime
.Core
**系统API:**
此接口为系统接口。
...
...
@@ -39,7 +39,7 @@ import businessAbilityRouter from '@ohos.app.businessAbilityRouter';
此过滤值用于过滤查询的ability类型。
**系统能力:**
SystemCapability.
BundleManager.BundleFramework
.Core
**系统能力:**
SystemCapability.
Ability.AbilityRuntime
.Core
**系统API:**
此接口为系统接口。
...
...
@@ -57,7 +57,7 @@ queryBusinessAbilityInfo(filter: BusinessAbilityFilter, callback: AsyncCallback\
**需要权限:**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**系统能力:**
SystemCapability.
BundleManager.BundleFramework
.Core
**系统能力:**
SystemCapability.
Ability.AbilityRuntime
.Core
**系统API:**
此接口为系统接口。
...
...
@@ -94,7 +94,7 @@ queryBusinessAbilityInfo(filter: BusinessAbilityFilter): Promise\<Array\<Busines
**需要权限:**
ohos.permission.GET_BUNDLE_INFO_PRIVILEGED
**系统能力:**
SystemCapability.
BundleManager.BundleFramework
.Core
**系统能力:**
SystemCapability.
Ability.AbilityRuntime
.Core
**系统API:**
此接口为系统接口。
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
浏览文件 @
c63300fd
...
...
@@ -16,8 +16,8 @@ import ability from '@ohos.ability.ability';
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityBase
| 名称 |
可读 | 可写 |
类型 | 必填 | 说明 |
| ----------- | --------
|-------- | --------
------------ | ---- | ------------------------------------------------------------ |
| resultCode
| 是 | 是
| number | 是 | 表示Ability被拉起并退出后返回的结果码。 |
| want
| 是 | 是
|
[
Want
](
./js-apis-app-ability-want.md
)
| 否 | 表示Ability被拉起并退出后返回的数据。 |
| 名称 | 类型 | 必填 | 说明 |
| ----------- | -------------------- | ---- | ------------------------------------------------------------ |
| resultCode | number | 是 | 表示Ability被拉起并退出后返回的结果码。 |
| want |
[
Want
](
./js-apis-app-ability-want.md
)
| 否 | 表示Ability被拉起并退出后返回的数据。 |
zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md
浏览文件 @
c63300fd
...
...
@@ -16,7 +16,7 @@ import common from '@ohos.app.ability.common';
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
|
参数名
| 类型 | 必填 | 说明 |
|
名称
| 类型 | 必填 | 说明 |
| ------------ | -------- | ---- | ------------------------- |
| onConnect
<sup>
7+
</sup>
| function | 是 | 建立连接时的回调函数。 |
| onDisconnect
<sup>
7+
</sup>
| function | 是 | 断开连接时的回调函数。 |
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md
浏览文件 @
c63300fd
...
...
@@ -27,7 +27,7 @@ import Want from '@ohos.app.ability.Want';
| action | string | 否 | 表示要执行的通用操作(如:查看、分享、应用详情)。在隐式Want中,您可以定义该字段,配合uri或parameters来表示对数据要执行的操作。具体参考:
[
action说明
](
js-apis-ability-wantConstant.md#wantconstantaction
)
。隐式Want定义及匹配规则参考:
[
显式Want与隐式Want匹配规则
](
../../application-models/explicit-implicit-want-mappings.md
)
。 |
| parameters | {
[
key: string]: Object} | 否 | 表示WantParams,由开发者自行决定传入的键值对。默认会携带以下key值:<br>ohos.aafwk.callerPid 表示拉起方的pid。<br>ohos.aafwk.param.callerToken 表示拉起方的token。<br>ohos.aafwk.param.callerUid 表示[bundleInfo
](
js-apis-bundle-BundleInfo.md#bundleinfo
)
中的uid,应用包里应用程序的uid。
<br
/>
- component.startup.newRules:表示是否启用新的管控规则。
<br
/>
- moduleName:表示拉起方的模块名,该字段的值即使定义成其他字符串,在传递到另一端时会被修改为正确的值。
<br
/>
- ohos.dlp.params.sandbox:表示dlp文件才会有。 |
| entities | Array
\<
string> | 否 | 表示目标Ability额外的类别信息(如:浏览器、视频播放器),在隐式Want中是对action字段的补充。在隐式Want中,您可以定义该字段,来过滤匹配Ability类型。具体参考:
[
entity说明
](
js-apis-app-ability-wantConstant.md#wantconstantentity
)
。 |
| moduleName
<sup>
9
+
</sup>
| string | 否 | 表示待启动的Ability所属的模块(module)。 |
| moduleName
<sup>
10
+
</sup>
| string | 否 | 表示待启动的Ability所属的模块(module)。 |
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md
浏览文件 @
c63300fd
...
...
@@ -1231,7 +1231,7 @@ waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------------------------------------------------------------ | ---- | ------------------------------------------------------------ |
| monitor |
[
AbilityStageMonitor
](
js-apis-inner-application-abilityStageMonitor.md
)
| 是 |
[
AbilityStageMonitor
](
js-apis-inner-application-abilityStageMonitor.md
)
实例 |
| timeout | number |
否
| 超时最大等待时间,以毫秒为单位。 |
| timeout | number |
是
| 超时最大等待时间,以毫秒为单位。 |
**返回值:**
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStateData.md
浏览文件 @
c63300fd
...
...
@@ -16,6 +16,8 @@ import appManager from '@ohos.application.appManager';
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
**系统API**
: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------------------- | ---------| ---- | ---- | ------------------------- |
| pid | number | 是 | 否 | 进程ID。 |
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md
浏览文件 @
c63300fd
...
...
@@ -12,6 +12,8 @@
import
appManager
from
'
@ohos.app.ability.appManager
'
;
```
## 属性
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
**系统API**
:本模块被标记为@systemapi,对三方应用隐藏
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationContext.md
浏览文件 @
c63300fd
...
...
@@ -359,7 +359,7 @@ export default class EntryAbility extends UIAbility {
## ApplicationContext.off(type: 'applicationStateChange')<sup>10+</sup>
off(type: 'applicationStateChange'
):
**void**
;
off(type: 'applicationStateChange'
, callback?: ApplicationStateChangeCallback):
**void**
;
取消当前应用注册的前后台变化的全部监听。
...
...
@@ -370,6 +370,7 @@ off(type: 'applicationStateChange'): **void**;
| 参数名 | 类型 | 必填 | 说明 |
| ------ | ------------- | ---- | -------------------- |
| type | string | 是 | 取消监听事件的类型,必须为'applicationStateChange'。 |
| callback |
[
ApplicationStateChangeCallback
](
#js-apis-app-ability-applicationStateChangeCallback.md
)
| 否 | 对于该事件监听的回调方法,可以对应用从后台切换到前台,以及前台切换到后台分别定义回调。 |
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md
浏览文件 @
c63300fd
...
...
@@ -12,6 +12,8 @@
import
appManager
from
'
@ohos.app.ability.appManager
'
;
```
## 属性
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
**系统API**
:该接口为系统接口,三方应用不支持调用。
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md
浏览文件 @
c63300fd
...
...
@@ -158,7 +158,7 @@ try {
## Context.getGroupDir<sup>10+</sup>
getGroupDir(
groupId
: string): Promise
\<
string>;
getGroupDir(
dataGroupID
: string): Promise
\<
string>;
通过使用元服务应用中的Group ID获取对应的共享目录,使用Promise异步回调。
...
...
@@ -166,9 +166,9 @@ getGroupDir(groupId: string): Promise\<string>;
**参数:**
|
名称
| 类型 | 必填 | 说明 |
|
参数名
| 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ------------- |
|
groupId
| string | 是 | 元服务应用项目创建时,系统会指定分配唯一Group ID。 |
|
dataGroupID
| string | 是 | 元服务应用项目创建时,系统会指定分配唯一Group ID。 |
**返回值:**
...
...
@@ -188,16 +188,19 @@ getGroupDir(groupId: string): Promise\<string>;
```
ts
let
groupId
=
"
1
"
;
context
.
getGroupDir
(
groupId
).
then
(
data
=>
{
let
getGroupDirContext
:
common
.
Context
;
try
{
getGroupDirContext
.
getGroupDir
(
groupId
).
then
(
data
=>
{
console
.
log
(
"
getGroupDir result:
"
+
data
);
}).
catch
((
err
)
=>
{
console
.
error
(
'
error: ${JSON.stringify(err)}
'
);
});
})
}
catch
(
error
)
{
console
.
error
(
'
getGroupDirContext failed, error.code: ${error.code}, error.message: ${error.message}
'
);
}
```
## Context.getGroupDir<sup>10+</sup>
getGroupDir(
groupId
: string, callback: AsyncCallback
\<
string>);
getGroupDir(
dataGroupID
: string, callback: AsyncCallback
\<
string>);
通过使用元服务应用中的Group ID获取对应的共享目录,使用callback异步回调。
...
...
@@ -205,9 +208,9 @@ getGroupDir(groupId: string, callback: AsyncCallback\<string>);
**参数:**
|
名称
| 类型 | 必填 | 说明 |
|
参数名
| 类型 | 必填 | 说明 |
| -------- | ---------------------- | ---- | ------------- |
|
groupId
| string | 是 | 元服务应用项目创建时,系统会指定分配唯一Group ID。 |
|
dataGroupID
| string | 是 | 元服务应用项目创建时,系统会指定分配唯一Group ID。 |
| callback | AsyncCallback
\<
string> | 是 | 以callback方式返回对应的共享目录。如果不存在则返回为空,仅支持应用el2加密级别。|
**错误码**
:
...
...
@@ -221,12 +224,14 @@ getGroupDir(groupId: string, callback: AsyncCallback\<string>);
**示例:**
```
ts
context
.
getGroupDir
(
"
1
"
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
getGroupDir faile, err: ${JSON.stringify(err)}
'
);
}
else
{
console
.
log
(
'
getGroupDir result is: ${JSON.stringify(data)}
'
);
}
let
getGroupDirContext
:
common
.
Context
;
getGroupDirContext
.
getGroupDir
(
"
1
"
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
getGroupDir faile, err: ${JSON.stringify(err)}
'
);
}
else
{
console
.
log
(
'
getGroupDir result is: ${JSON.stringify(data)}
'
);
}
});
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md
浏览文件 @
c63300fd
...
...
@@ -10,6 +10,8 @@
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Mission
**系统API**
: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ------ | ---- | ---- | ------- |
| srcDeviceId | string | 是 | 是 | 表示任务迁移源设备ID。 |
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueMissionInfo.md
浏览文件 @
c63300fd
...
...
@@ -13,6 +13,8 @@
import
distributedMissionManager
from
'
@ohos.distributedMissionManager
'
;
```
## 属性
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Mission
| 名称 | 类型 | 可读 | 可写 | 说明 |
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md
浏览文件 @
c63300fd
...
...
@@ -28,6 +28,7 @@ import missionManager from '@ohos.app.ability.missionManager';
| label | string | 是 | 是 | 表示任务的标签。 |
| iconPath | string | 是 | 是 | 表示任务的图标路径。 |
| continuable | boolean | 是 | 是 | 表示任务是否可以迁移。 |
| abilityState | number | 是 | 是 | 表示此任务的能力状态。 |
| unclearable
<sup>
10+
</sup>
| boolean | 是 | 是 | 表示任务是否可以被用户手动删除。 |
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md
浏览文件 @
c63300fd
...
...
@@ -16,6 +16,8 @@ import missionManager from '@ohos.app.ability.missionManager';
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission
**系统API**
: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 必填 | 说明 |
| ----------- | -------- | ---- | ------------------------------------------------------------ |
| onMissionCreated | function | 否 | 表示当系统创建任务时回调执行。 |
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
浏览文件 @
c63300fd
...
...
@@ -1102,6 +1102,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
| 16000001 | The specified ability does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Can not start invisible component. |
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000008 | The crowdtesting application expires. |
| 16000053 | The ability is not on the top of the UI. |
...
...
@@ -1169,6 +1170,7 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options
| 16000001 | The specified ability does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Can not start invisible component. |
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000008 | The crowdtesting application expires. |
| 16000053 | The ability is not on the top of the UI. |
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
浏览文件 @
c63300fd
...
...
@@ -116,7 +116,6 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
**错误码:**
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 16000001 | The specified ability does not exist. |
...
...
@@ -276,6 +275,8 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>):
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
| 16000010 | The call with the continuation flag is forbidden. |
| 16000011 | The context does not exist. |
| 16000012 | The application is controlled. |
| 16000013 | The application is controlled by EDM. |
| 16000050 | Internal error. |
| 16000053 | The ability is not on the top of the UI. |
| 16000055 | Installation-free timed out. |
...
...
@@ -345,6 +346,8 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
| 16000010 | The call with the continuation flag is forbidden. |
| 16000011 | The context does not exist. |
| 16000012 | The application is controlled. |
| 16000013 | The application is controlled by EDM. |
| 16000050 | Internal error. |
| 16000053 | The ability is not on the top of the UI. |
| 16000055 | Installation-free timed out. |
...
...
@@ -424,6 +427,8 @@ startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityRes
| 16000009 | An ability cannot be started or stopped in Wukong mode. |
| 16000010 | The call with the continuation flag is forbidden. |
| 16000011 | The context does not exist. |
| 16000012 | The application is controlled. |
| 16000013 | The application is controlled by EDM. |
| 16000050 | Internal error. |
| 16000053 | The ability is not on the top of the UI. |
| 16000055 | Installation-free timed out. |
...
...
@@ -979,6 +984,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
| ------- | -------------------------------- |
| 16000001 | The specified ability does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Can not start invisible component. |
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000011 | The context does not exist. |
...
...
@@ -1040,8 +1046,6 @@ stopServiceExtensionAbility(want: Want): Promise\<void>;
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000011 | The context does not exist. |
| 16000012 | The application is controlled. |
| 16000013 | The application is controlled by EDM. |
| 16000050 | Internal error. |
| 16200001 | The caller has been released. |
...
...
@@ -1445,6 +1449,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
| 16000001 | The specified ability does not exist. |
| 16000002 | Incorrect ability type. |
| 16000004 | Can not start invisible component. |
| 16000005 | The specified process does not have the permission. |
| 16000006 | Cross-user operations are not allowed. |
| 16000008 | The crowdtesting application expires. |
| 16000053 | The ability is not on the top of the UI. |
...
...
@@ -2226,7 +2231,7 @@ setMissionContinueState(state: AbilityConstant.ContinueState, callback:AsyncCall
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| state |
[
ContinueState
](
js-apis-app-ability-abilityConstant.md#abilityconstantcontinuestate10
)
| 是 | 流转状态。 |
| state |
[
AbilityConstant.
ContinueState
](
js-apis-app-ability-abilityConstant.md#abilityconstantcontinuestate10
)
| 是 | 流转状态。 |
| callback | AsyncCallback
<
void
>
| 是 | 回调函数,返回接口调用是否成功的结果。 |
**错误码:**
...
...
@@ -2260,7 +2265,7 @@ setMissionContinueState(state: AbilityConstant.ContinueState): Promise<void&g
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| state |
[
ContinueState
](
js-apis-app-ability-abilityConstant.md#abilityconstantcontinuestate10
)
| 是 | 流转状态。 |
| state |
[
AbilityConstant.
ContinueState
](
js-apis-app-ability-abilityConstant.md#abilityconstantcontinuestate10
)
| 是 | 流转状态。 |
**返回值:**
...
...
@@ -2787,9 +2792,9 @@ startAbilityByCallWithAccount(want: Want, accountId: number): Promise<Caller&
}
```
## UIAbilityContext.reportDrawnCompleted
## UIAbilityContext.reportDrawnCompleted
<sup>10+</sup>
reportDrawnCompleted(callback: AsyncCallback
<void>
): void;
reportDrawnCompleted(callback: AsyncCallback
\
<
void>): void;
当页面加载完成(loadContent成功)时,为开发者提供打点功能(callback形式)。
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
...
...
@@ -2812,26 +2817,31 @@ reportDrawnCompleted(callback: AsyncCallback<void>): void;
**示例:**
```
ts
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
onWindowStageCreate
(
windowStage
:
window
.
WindowStage
)
{
windowStage
.
loadContent
(
'
pages/Index
'
,
(
err
,
data
)
=>
{
if
(
err
.
code
)
{
return
;
}
try
{
this
.
context
.
reportDrawnCompleted
((
err
)
=>
{
if
(
err
.
code
)
{
// 处理业务逻辑错误
console
.
error
(
`reportDrawnCompleted failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
return
;
}
// 执行正常业务
console
.
info
(
'
reportDrawnCompleted succeed
'
);
});
}
catch
(
err
)
{
// 捕获同步的参数错误
if
(
err
.
code
)
{
return
;
}
try
{
this
.
context
.
reportDrawnCompleted
((
err
)
=>
{
if
(
err
.
code
)
{
// 处理业务逻辑错误
console
.
error
(
`reportDrawnCompleted failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
}
return
;
}
// 执行正常业务
console
.
info
(
'
reportDrawnCompleted succeed
'
);
});
}
catch
(
err
)
{
// 捕获同步的参数错误
console
.
error
(
`reportDrawnCompleted failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
}
});
console
.
log
(
"
MainAbility onWindowStageCreate
"
)
}
}
};
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md
浏览文件 @
c63300fd
...
...
@@ -57,18 +57,18 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: stri
import
fileUri
from
'
@ohos.file.fileuri
'
;
let
targetBundleName
=
'
com.example.test_case1
'
let
path
=
this
.
context
.
filesDir
+
'
/newDir
'
;
await
fileio
.
mkdir
(
path
,
function
(
err
)
{
let
path
=
"
file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir
"
;
fileio
.
mkdir
(
path
,
function
(
err
)
{
if
(
err
)
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
"
mkdir error
"
+
err
.
message
);
console
.
log
(
"
mkdir error
"
+
err
.
message
)
}
else
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
"
mkdir succeed
"
);
console
.
log
(
"
mkdir succeed
"
)
}
});
let
uri
=
fileUri
.
getUriFromPath
(
path
);
uriPermissionManager
.
grantUriPermission
(
uri
,
WantConstant
.
Flags
.
FLAG_AUTH_READ_URI_PERMISSION
,
targetBundleName
,
(
result
)
=>
{
console
.
log
(
"
result.code =
"
+
result
.
code
)
})
console
.
log
(
"
result.code =
"
+
result
.
code
)
})
```
...
...
@@ -119,20 +119,21 @@ grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: stri
import
fileUri
from
'
@ohos.file.fileuri
'
;
let
targetBundleName
=
'
com.example.test_case1
'
let
path
=
this
.
context
.
filesDir
+
'
/newDir
'
;
await
fileio
.
mkdir
(
path
,
function
(
err
)
{
let
path
=
"
file://com.example.test_case1/data/storage/el2/base/haps/entry_test/files/newDir
"
;
fileio
.
mkdir
(
path
,
function
(
err
)
{
if
(
err
)
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
"
mkdir error
"
+
err
.
message
);
console
.
log
(
"
mkdir error
"
+
err
.
message
)
}
else
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
"
mkdir succeed
"
);
console
.
log
(
"
mkdir succeed
"
)
}
});
let
uri
=
fileUri
.
getUriFromPath
(
path
);
uriPermissionManager
.
grantUriPermission
(
uri
,
w
antConstant
.
Flags
.
FLAG_AUTH_READ_URI_PERMISSION
,
targetBundleName
)
.
then
((
data
)
=>
{
uriPermissionManager
.
grantUriPermission
(
uri
,
W
antConstant
.
Flags
.
FLAG_AUTH_READ_URI_PERMISSION
,
targetBundleName
)
.
then
((
data
)
=>
{
console
.
log
(
'
Verification succeeded.
'
+
data
)
}).
catch
((
error
)
=>
{
console
.
log
(
'
Verification failed.
'
);
}).
catch
((
error
)
=>
{
console
.
log
(
'
Verification failed.
'
);
})
```
## uriPermissionManager.revokeUriPermission
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录