提交 e5bce3c5 编写于 作者: L lsq

资料意见修改

Signed-off-by: Nlsq <linshuqing2@huawei.com>
上级 c2be7161
......@@ -385,7 +385,6 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // You can use getApplicationInfo to obtain the access token ID.
let permissionFlag = 1;
try {
atManager.getPermissionFlags(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS").then((data) => {
console.log(`getPermissionFlags success, data->${JSON.stringify(data)}`);
......@@ -459,11 +458,12 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
**Example**
```js
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenIDList: Array<number> = [];
let permissionNameList = [];
let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionNameList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
try {
atManager.on('permissionStateChange', tokenIDList, permissionNameList, (data) => {
console.debug("receive permission state change, data:" + JSON.stringify(data));
......@@ -508,11 +508,12 @@ For details about the error codes, see [Ability Access Control Error Codes](../e
**Example**
```js
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenIDList: Array<number> = [];
let permissionNameList = [];
let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionNameList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
try {
atManager.off('permissionStateChange', tokenIDList, permissionNameList);
} catch(err) {
......
......@@ -385,7 +385,6 @@ import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenID = 0; // 可以通过getApplicationInfo获取accessTokenId
let permissionFlag = 1;
try {
atManager.getPermissionFlags(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS").then((data) => {
console.log(`getPermissionFlags success, data->${JSON.stringify(data)}`);
......@@ -459,11 +458,12 @@ on(type: 'permissionStateChange', tokenIDList: Array&lt;number&gt;, permissionNa
**示例:**
```js
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenIDList: Array<number> = [];
let permissionNameList = [];
let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionNameList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
try {
atManager.on('permissionStateChange', tokenIDList, permissionNameList, (data) => {
console.debug("receive permission state change, data:" + JSON.stringify(data));
......@@ -508,11 +508,12 @@ off(type: 'permissionStateChange', tokenIDList: Array&lt;number&gt;, permissionN
**示例:**
```js
import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
import abilityAccessCtrl, {Permissions} from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager();
let tokenIDList: Array<number> = [];
let permissionNameList = [];
let appInfo = bundle.getApplicationInfoSync('com.example.myapplication', 0, 100);
let tokenIDList: Array<number> = [appInfo.accessTokenId];
let permissionNameList: Array<Permissions> = ["ohos.permission.DISTRIBUTED_DATASYNC"];
try {
atManager.off('permissionStateChange', tokenIDList, permissionNameList);
} catch(err) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册