一. 权限分类
1. system_grant
system_grant 为系统授权,无需询问用户,常用的权限包括网络请求、获取网络信息、获取wifi信息、获取传感器数据等。
/* system_grant(系统授权)*/
static readonly INTERNET = 'ohos.permission.INTERNET' // 网路请求
static readonly GET_NETWORK_INFO = 'ohos.permission.GET_NETWORK_INFO' // 网络信息-读
static readonly GET_WIFI_INFO = 'ohos.permission.GET_WIFI_INFO' // WIFI信息-读
static readonly GYROSCOPE = 'ohos.permission.GYROSCOPE' // 陀螺仪传感器
static readonly ACCELEROMETER = 'ohos.permission.ACCELEROMETER' // 加速度传感器
2. user_grant
user_grant 是需要用户授权的权限,常用的权限包括定位、相机、麦克风、日历、文件读写等。
/* user_grant(用户授权)*/
static readonly LOCATION = 'ohos.permission.LOCATION' // 定位-精确
static readonly APPROXIMATELY_LOCATION = 'ohos.permission.APPROXIMATELY_LOCATION' // 定位-模糊
static readonly LOCATION_IN_BACKGROUND = 'ohos.permission.LOCATION_IN_BACKGROUND' // 定位-后台
static readonly CAMERA = 'ohos.permission.CAMERA' // 相机
static readonly MICROPHONE = 'ohos.permission.MICROPHONE' // 麦克风
static readonly READ_CONTACTS = 'ohos.permission.READ_CONTACTS' // 通讯录-读
static readonly WRITE_CONTACTS = 'ohos.permission.WRITE_CONTACTS' // 通讯录-写
static readonly READ_CALENDAR = 'ohos.permission.READ_CALENDAR' // 日历-读
static readonly WRITE_CALENDAR = 'ohos.permission.WRITE_CALENDAR' // 日历-写
static readonly WRITE_IMAGEVIDEO = &#