手机网站改版,河南商丘网络图,机械外贸网站,wordpress站内搜索慢【关键词】
权限、SystemInfo、setting 【问题背景】
小程序转快应用#xff0c;用户在使用快应用的过程中如果产生了一些授权行为#xff0c;开发者是否有办法去收集到用户已经授权过的权限呢#xff0c;从而进行更好管理呢#xff1f; 【解决方案】
小程序转快应用中是… 【关键词】
权限、SystemInfo、setting 【问题背景】
小程序转快应用用户在使用快应用的过程中如果产生了一些授权行为开发者是否有办法去收集到用户已经授权过的权限呢从而进行更好管理呢 【解决方案】
小程序转快应用中是可行的方法有如下两种
1、 通过qa.getSystemInfoSync()接口返回的信息。如下图所示
代码 getset2() {const sysInfo qa.getSystemInfoSync()console.log(sysInfo)}
运行结果 devicePixelRatio:3,albumAuthorized:false,cameraAuthorized:false,locationAuthorized:false,microphoneAuthorized:false,notificationAuthorized:false,notificationAlertAuthorized:false,notificationBadgeAuthorized:false,notificationSoundAuthorized:false,bluetoothEnabled:false,locationEnabled:true,wifiEnabled:true,
2、 通过qa.getSetting获取当前用户的设置。
代码 qa.getSetting({success(res) {console.log(getSetting success, authSetting JSON.stringify(res.authSetting))}})
运行结果 getSetting success, authSetting {scope.userLocation:false,scope.writePhotosAlbum:true,scope.record:false,scope.camera:false,scope.userInfo:false,scope.address:false,scope.invoiceTitle:false,scope.invoice:false,scope.werun:false}