Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
83155534
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看板
体验新版 GitCode,发现更多精彩内容 >>
You need to sign in or sign up before continuing.
提交
83155534
编写于
6月 21, 2022
作者:
W
wusongqing
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
updated docs against 4556
Signed-off-by:
N
wusongqing
<
wusongqing@huawei.com
>
上级
4192270e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
43 addition
and
44 deletion
+43
-44
en/application-dev/ability/fa-pageability.md
en/application-dev/ability/fa-pageability.md
+43
-44
未找到文件。
en/application-dev/ability/fa-pageability.md
浏览文件 @
83155534
...
@@ -102,16 +102,16 @@ By default, **singleton** is used.
...
@@ -102,16 +102,16 @@ By default, **singleton** is used.
console
.
info
(
'
onStartRemoteAbility begin
'
);
console
.
info
(
'
onStartRemoteAbility begin
'
);
let
params
;
let
params
;
let
wantValue
=
{
let
wantValue
=
{
bundleName
:
'
ohos.samples.etsDemo
'
,
bundleName
:
'
ohos.samples.etsDemo
'
,
abilityName
:
'
ohos.samples.etsDemo.RemoteAbility
'
,
abilityName
:
'
ohos.samples.etsDemo.RemoteAbility
'
,
deviceId
:
getRemoteDeviceId
(),
deviceId
:
getRemoteDeviceId
(),
parameters
:
params
parameters
:
params
};
};
console
.
info
(
'
onStartRemoteAbility want=
'
+
JSON
.
stringify
(
wantValue
));
console
.
info
(
'
onStartRemoteAbility want=
'
+
JSON
.
stringify
(
wantValue
));
featureAbility
.
startAbility
({
featureAbility
.
startAbility
({
want
:
wantValue
want
:
wantValue
}).
then
((
data
)
=>
{
}).
then
((
data
)
=>
{
console
.
info
(
'
onStartRemoteAbility finished,
'
+
JSON
.
stringify
(
data
));
console
.
info
(
'
onStartRemoteAbility finished,
'
+
JSON
.
stringify
(
data
));
});
});
console
.
info
(
'
onStartRemoteAbility end
'
);
console
.
info
(
'
onStartRemoteAbility end
'
);
}
}
...
@@ -123,17 +123,17 @@ Obtain **deviceId** from **DeviceManager**. The sample code is as follows:
...
@@ -123,17 +123,17 @@ Obtain **deviceId** from **DeviceManager**. The sample code is as follows:
import
deviceManager
from
'
@ohos.distributedHardware.deviceManager
'
;
import
deviceManager
from
'
@ohos.distributedHardware.deviceManager
'
;
let
dmClass
;
let
dmClass
;
function
getRemoteDeviceId
()
{
function
getRemoteDeviceId
()
{
if
(
typeof
dmClass
===
'
object
'
&&
dmClass
!=
null
)
{
if
(
typeof
dmClass
===
'
object
'
&&
dmClass
!=
null
)
{
let
list
=
dmClass
.
getTrustedDeviceListSync
();
let
list
=
dmClass
.
getTrustedDeviceListSync
();
if
(
typeof
(
list
)
==
'
undefined
'
||
typeof
(
list
.
length
)
==
'
undefined
'
)
{
if
(
typeof
(
list
)
==
'
undefined
'
||
typeof
(
list
.
length
)
==
'
undefined
'
)
{
console
.
log
(
"
MainAbility onButtonClick getRemoteDeviceId err: list is null
"
);
console
.
log
(
"
MainAbility onButtonClick getRemoteDeviceId err: list is null
"
);
return
;
return
;
}
}
console
.
log
(
"
MainAbility onButtonClick getRemoteDeviceId success:
"
+
list
[
0
].
deviceId
);
console
.
log
(
"
MainAbility onButtonClick getRemoteDeviceId success:
"
+
list
[
0
].
deviceId
);
return
list
[
0
].
deviceId
;
return
list
[
0
].
deviceId
;
}
else
{
}
else
{
console
.
log
(
"
MainAbility onButtonClick getRemoteDeviceId err: dmClass is null
"
);
console
.
log
(
"
MainAbility onButtonClick getRemoteDeviceId err: dmClass is null
"
);
}
}
}
}
```
```
...
@@ -143,35 +143,34 @@ In the cross-device scenario, the application must also apply for the data synch
...
@@ -143,35 +143,34 @@ In the cross-device scenario, the application must also apply for the data synch
import
abilityAccessCtrl
from
"
@ohos.abilityAccessCtrl
"
;
import
abilityAccessCtrl
from
"
@ohos.abilityAccessCtrl
"
;
import
bundle
from
'
@ohos.bundle
'
;
import
bundle
from
'
@ohos.bundle
'
;
async
function
RequestPermission
()
{
async
function
RequestPermission
()
{
console
.
info
(
'
RequestPermission begin
'
);
console
.
info
(
'
RequestPermission begin
'
);
let
array
:
Array
<
string
>
=
[
"
ohos.permission.DISTRIBUTED_DATASYNC
"
];
let
array
:
Array
<
string
>
=
[
"
ohos.permission.DISTRIBUTED_DATASYNC
"
];
let
bundleFlag
=
0
;
let
bundleFlag
=
0
;
let
tokenID
=
undefined
;
let
tokenID
=
undefined
;
let
userID
=
100
;
let
userID
=
100
;
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.samples.etsDemo
'
,
bundleFlag
,
userID
);
let
appInfo
=
await
bundle
.
getApplicationInfo
(
'
ohos.samples.etsDemo
'
,
bundleFlag
,
userID
);
tokenID
=
appInfo
.
accessTokenId
;
tokenID
=
appInfo
.
accessTokenId
;
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
let
atManager
=
abilityAccessCtrl
.
createAtManager
();
let
requestPermissions
:
Array
<
string
>
=
[];
let
requestPermissions
:
Array
<
string
>
=
[];
for
(
let
i
=
0
;
i
<
array
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
array
.
length
;
i
++
)
{
let
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
array
[
i
]);
let
result
=
await
atManager
.
verifyAccessToken
(
tokenID
,
array
[
i
]);
console
.
info
(
"
verifyAccessToken result:
"
+
JSON
.
stringify
(
result
));
console
.
info
(
"
verifyAccessToken result:
"
+
JSON
.
stringify
(
result
));
if
(
result
==
abilityAccessCtrl
.
GrantStatus
.
PERMISSION_GRANTED
)
{
if
(
result
!=
abilityAccessCtrl
.
GrantStatus
.
PERMISSION_GRANTED
)
{
}
else
{
requestPermissions
.
push
(
array
[
i
]);
requestPermissions
.
push
(
array
[
i
]);
}
}
}
}
console
.
info
(
"
requestPermissions:
"
+
JSON
.
stringify
(
requestPermissions
));
console
.
info
(
"
requestPermissions:
"
+
JSON
.
stringify
(
requestPermissions
));
if
(
requestPermissions
.
length
==
0
||
requestPermissions
==
[])
{
if
(
requestPermissions
.
length
==
0
||
requestPermissions
==
[])
{
return
;
return
;
}
}
let
context
=
featureAbility
.
getContext
();
let
context
=
featureAbility
.
getContext
();
context
.
requestPermissionsFromUser
(
requestPermissions
,
1
,
(
data
)
=>
{
context
.
requestPermissionsFromUser
(
requestPermissions
,
1
,
(
data
)
=>
{
console
.
info
(
"
data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
data:
"
+
JSON
.
stringify
(
data
));
console
.
info
(
"
data requestCode:
"
+
data
.
requestCode
);
console
.
info
(
"
data requestCode:
"
+
data
.
requestCode
);
console
.
info
(
"
data permissions:
"
+
data
.
permissions
);
console
.
info
(
"
data permissions:
"
+
data
.
permissions
);
console
.
info
(
"
data authResults:
"
+
data
.
authResults
);
console
.
info
(
"
data authResults:
"
+
data
.
authResults
);
});
});
console
.
info
(
'
RequestPermission end
'
);
console
.
info
(
'
RequestPermission end
'
);
}
}
```
```
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录