未验证 提交 c60d0685 编写于 作者: O openharmony_ci 提交者: Gitee

!12943 【挑单】修改requestPermissionsFromUser申请用户授权权限

Merge pull request !12943 from y1585740638/cherry-pick-1672122272
...@@ -587,7 +587,7 @@ requestPermissionsFromUser(context: Context, permissions: Array<Permissions&g ...@@ -587,7 +587,7 @@ requestPermissionsFromUser(context: Context, permissions: Array<Permissions&g
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
try { try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"], (err, data)=>{ atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"], (err, data)=>{
console.info("data:" + JSON.stringify(data)); console.info("data:" + JSON.stringify(data));
console.info("data permissions:" + data.permissions); console.info("data permissions:" + data.permissions);
console.info("data authResults:" + data.authResults); console.info("data authResults:" + data.authResults);
...@@ -633,7 +633,7 @@ requestPermissionsFromUser(context: Context, permissions: Array<Permissions&g ...@@ -633,7 +633,7 @@ requestPermissionsFromUser(context: Context, permissions: Array<Permissions&g
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
try { try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => { atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"]).then((data) => {
console.info("data:" + JSON.stringify(data)); console.info("data:" + JSON.stringify(data));
console.info("data permissions:" + data.permissions); console.info("data permissions:" + data.permissions);
console.info("data authResults:" + data.authResults); console.info("data authResults:" + data.authResults);
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
import abilityAccessCtrl from '@ohos.abilityAccessCtrl'; import abilityAccessCtrl from '@ohos.abilityAccessCtrl';
let atManager = abilityAccessCtrl.createAtManager(); let atManager = abilityAccessCtrl.createAtManager();
try { try {
atManager.requestPermissionsFromUser(this.context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => { atManager.requestPermissionsFromUser(this.context, ["ohos.permission.CAMERA"]).then((data) => {
console.info("data:" + JSON.stringify(data)); console.info("data:" + JSON.stringify(data));
console.info("data permissions:" + data.permissions); console.info("data permissions:" + data.permissions);
console.info("data authResults:" + data.authResults); console.info("data authResults:" + data.authResults);
......
...@@ -189,7 +189,7 @@ ...@@ -189,7 +189,7 @@
var context = this.context var context = this.context
var AtManager = abilityAccessCtrl.createAtManager(); var AtManager = abilityAccessCtrl.createAtManager();
//requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗 //requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
AtManager.requestPermissionsFromUser(context, ["ohos.permission.MANAGE_DISPOSED_APP_STATUS"]).then((data) => { AtManager.requestPermissionsFromUser(context, ["ohos.permission.CAMERA"]).then((data) => {
console.log("data type:" + typeof(data)); console.log("data type:" + typeof(data));
console.log("data:" + data); console.log("data:" + data);
console.log("data permissions:" + data.permissions); console.log("data permissions:" + data.permissions);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册