未验证 提交 62e37407 编写于 作者: Q ql 提交者: Gitee

update zh-cn/application-dev/ability/fa-pageability.md.

Signed-off-by: Nql <qianli16@huawei.com>
上级 9ae9c733
......@@ -131,7 +131,7 @@ PageAbility提供命周期回调,开发者可以在`app.js/app.ets`中重写
function onStartRemoteAbility() {
console.info('onStartRemoteAbility begin');
let params;
var wantValue = {
let wantValue = {
bundleName: 'ohos.samples.etsDemo',
abilityName: 'ohos.samples.etsDemo.RemoteAbility',
deviceId: getRemoteDeviceId(),
......@@ -153,7 +153,7 @@ PageAbility提供命周期回调,开发者可以在`app.js/app.ets`中重写
let dmClass;
function getRemoteDeviceId() {
if (typeof dmClass === 'object' && dmClass != null) {
var list = dmClass.getTrustedDeviceListSync();
let list = dmClass.getTrustedDeviceListSync();
if (typeof (list) == 'undefined' || typeof (list.length) == 'undefined') {
console.log("MainAbility onButtonClick getRemoteDeviceId err: list is null");
return;
......@@ -173,15 +173,15 @@ PageAbility提供命周期回调,开发者可以在`app.js/app.ets`中重写
async function RequestPermission() {
console.info('RequestPermission begin');
let array: Array<string> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
var bundleFlag = 0;
var tokenID = undefined;
var userID = 100;
var appInfo = await bundle.getApplicationInfo('ohos.samples.etsDemo', bundleFlag, userID);
let bundleFlag = 0;
let tokenID = undefined;
let userID = 100;
let appInfo = await bundle.getApplicationInfo('ohos.samples.etsDemo', bundleFlag, userID);
tokenID = appInfo.accessTokenId;
var atManager = abilityAccessCtrl.createAtManager();
let atManager = abilityAccessCtrl.createAtManager();
let requestPermissions: Array<string> = [];
for (let i = 0;i < array.length; i++) {
var result = await atManager.verifyAccessToken(tokenID, array[i]);
let result = await atManager.verifyAccessToken(tokenID, array[i]);
console.info("verifyAccessToken result:" + JSON.stringify(result));
if (result == abilityAccessCtrl.GrantStatus.PERMISSION_GRANTED) {
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册