Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
571a73f2
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看板
提交
571a73f2
编写于
7月 11, 2022
作者:
Y
yuyaozhi
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix sample code problems of ability
Signed-off-by:
N
yuyaozhi
<
yuyaozhi@huawei.com
>
上级
90ead80e
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
10 addition
and
94 deletion
+10
-94
zh-cn/application-dev/reference/apis/js-apis-application-ability.md
...ication-dev/reference/apis/js-apis-application-ability.md
+1
-4
zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md
...plication-dev/reference/apis/js-apis-dataAbilityHelper.md
+6
-6
zh-cn/application-dev/reference/apis/js-apis-featureAbility.md
.../application-dev/reference/apis/js-apis-featureAbility.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md
...cation-dev/reference/apis/js-apis-formextensioncontext.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md
...cation-dev/reference/apis/js-apis-uripermissionmanager.md
+0
-83
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-application-ability.md
浏览文件 @
571a73f2
...
...
@@ -234,11 +234,8 @@ onNewWant(want: Want, launchParams: AbilityConstant.LaunchParam): void;
```
js
class
myAbility
extends
Ability
{
onNewWant
(
want
,
launchParams
)
{
onNewWant
(
want
)
{
console
.
log
(
'
onNewWant, want:
'
+
want
.
abilityName
);
if
(
launchParams
.
launchReason
===
AbilityConstant
.
LaunchReason
.
CONTINUATION
)
{
console
.
log
(
'
onNewWant, launchReason is continuation
'
);
}
}
}
```
...
...
zh-cn/application-dev/reference/apis/js-apis-dataAbilityHelper.md
浏览文件 @
571a73f2
...
...
@@ -647,7 +647,7 @@ delete(uri: string, predicates: dataAbility.DataAbilityPredicates, callback: Asy
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
ohos_data_ability
from
'
@ohos.data.data
a
bility
'
import
ohos_data_ability
from
'
@ohos.data.data
A
bility
'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
...
...
@@ -685,7 +685,7 @@ delete(uri: string, predicates: dataAbility.DataAbilityPredicates): Promise\<num
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
ohos_data_ability
from
'
@ohos.data
.dataa
bility
'
import
ohos_data_ability
from
'
@ohos.data
A
bility
'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
...
...
@@ -719,7 +719,7 @@ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.Data
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
ohos_data_ability
from
'
@ohos.data.data
a
bility
'
import
ohos_data_ability
from
'
@ohos.data.data
A
bility
'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
...
...
@@ -765,7 +765,7 @@ update(uri: string, valuesBucket: rdb.ValuesBucket, predicates: dataAbility.Data
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
ohos_data_ability
from
'
@ohos.data.data
a
bility
'
import
ohos_data_ability
from
'
@ohos.data.data
A
bility
'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
...
...
@@ -806,7 +806,7 @@ query(uri: string, columns: Array\<string>, predicates: dataAbility.DataAbilityP
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
ohos_data_ability
from
'
@ohos.data.data
a
bility
'
import
ohos_data_ability
from
'
@ohos.data.data
A
bility
'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
...
...
@@ -849,7 +849,7 @@ query(uri: string, columns: Array\<string>, predicates: dataAbility.DataAbilityP
```
js
import
featureAbility
from
'
@ohos.ability.featureAbility
'
import
ohos_data_ability
from
'
@ohos.data.data
a
bility
'
import
ohos_data_ability
from
'
@ohos.data.data
A
bility
'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
...
...
zh-cn/application-dev/reference/apis/js-apis-featureAbility.md
浏览文件 @
571a73f2
...
...
@@ -369,7 +369,7 @@ hasWindowFocus(): Promise\<boolean>
**示例:**
```
javascript
import
featureAbility
from
'
@ohos.ability.feature
a
bility
'
;
import
featureAbility
from
'
@ohos.ability.feature
A
bility
'
;
featureAbility
.
hasWindowFocus
().
then
((
data
)
=>
{
console
.
info
(
"
==========================>hasWindowFocus=======================>
"
);
});
...
...
zh-cn/application-dev/reference/apis/js-apis-formextensioncontext.md
浏览文件 @
571a73f2
...
...
@@ -33,6 +33,7 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData, cal
```
js
import
formBindingData
from
'
@ohos.application.formBindingData
'
import
FormExtension
from
'
@ohos.application.FormExtension
'
export
default
class
MyFormExtension
extends
FormExtension
{
onUpdate
(
formId
)
{
console
.
log
(
'
FormExtension onUpdate, formId:
'
+
formId
);
...
...
@@ -71,6 +72,7 @@ updateForm(formId: string, formBindingData: formBindingData.FormBindingData): Pr
```
js
import
formBindingData
from
'
@ohos.application.formBindingData
'
import
FormExtension
from
'
@ohos.application.FormExtension
'
export
default
class
MyFormExtension
extends
FormExtension
{
onUpdate
(
formId
)
{
console
.
log
(
'
FormExtension onUpdate, formId:
'
+
formId
);
...
...
zh-cn/application-dev/reference/apis/js-apis-uripermissionmanager.md
已删除
100644 → 0
浏览文件 @
90ead80e
# uriPermissionManager
uriPermissionManager模块提供了Uri权限管理的能力。
> **说明:**
>
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
## 导入模块
```
import UriPermissionManager from '@ohos.application.uriPermissionManager';
```
## uriPermissionManager.verifyUriPermission
verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number, callback: AsyncCallback
<
number
>
): void
检验某个应用是否对指定的uri有flag指定的权限。
**系统能力:**
SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 指向文件的uri,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 |
| flag | wantConstant.Flags | 是 | uri的读权限或写权限。 |
| accessTokenId | number | 是 | 每个应用的唯一标识ID,开发者通过包管理接口自行获取。 |
| callback | AsyncCallback
<
number
>
| 是 | callback形式返回检验结果,返回0表示有权限,返回-1表示无权限。 |
**示例:**
```
js
import
WantConstant
from
'
@ohos.ability.wantConstant
'
;
let
accessTokenId
=
1
let
uri
=
"
fileshare:///com.samples.filesharetest.FileShare/person/10
"
UriPermissionManager
.
verifyUriPermission
(
uri
,
WantConstant
.
Flags
.
FLAG_AUTH_READ_URI_PERMISSION
,
accessTokenId
,
(
result
)
=>
{
console
.
log
(
"
result.code =
"
+
result
.
code
)
})
// accessTokenId开发者通过包管理接口自行获取
```
## uriPermissionManager.verifyUriPermission
verifyUriPermission(uri: string, flag: wantConstant.Flags, accessTokenId: number): Promise
<
number
>
检验某个应用是否对指定的uri有flag指定的权限。
**系统能力:**
SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri | string | 是 | 指向文件的uri,例如fileshare:///com.samples.filesharetest.FileShare/person/10。 |
| flag | wantConstant.Flags | 是 | uri的读权限或写权限。 |
| accessTokenId | number | 是 | 每个应用的唯一标识ID,开发者通过包管理接口自行获取。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
number
>
| 返回0表示有权限,返回-1表示无权限。 |
**示例:**
```
js
import
WantConstant
from
'
@ohos.ability.wantConstant
'
;
let
accessTokenId
=
1
let
uri
=
"
fileshare:///com.samples.filesharetest.FileShare/person/10
"
UriPermissionManager
.
verifyUriPermission
(
uri
,
WantConstant
.
Flags
.
FLAG_AUTH_READ_URI_PERMISSION
,
accessTokenId
)
.
then
((
data
)
=>
{
console
.
log
(
'
Verification succeeded.
'
+
data
)
}).
catch
((
error
)
=>
{
console
.
log
(
'
Verification failed.
'
);
})
```
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录