checkAndRequestPermission 检查并请求权限

checkAndRequestPermission ^7.8

检查并请求相册权限、通知权限、定位权限、蓝牙权限

#请求参数

Prop Type Default Comment
type String N/A 权限类型:相机:CAMERA、通知:NOTIFICATION、定位:LOCATION、蓝牙:BLE
needRequest String N/A 为"0"表示只判断是否有权限,没有权限时不申请权限,为"1"表示判断是否有权限,如果没有进行权限申请,默认“1”。

#接口调用示例

const params = {
    "type": "NOTIFICATION",
    "needRequest": "1"
}
this.$bridge
  .checkAndRequestPermission(params)
  .then(res => {
    this.$alert(res)
  })
  .catch(err => {
    this.$toast(err)
  })

#接口返回示例

{
    "errorCode": 0,
    "errorMsg": "已开通此权限"
}
posted on 2024-12-19 09:26  AtlasLapetos  阅读(11)  评论(0)    收藏  举报