harmony 鸿蒙Application Permission Groups
Application Permission Groups
Usage Guidelines
It will be helpful if you understand permission groups and permissions before requesting permission groups for your application.
A permission group is a logical grouping of related permissions. When a permission is requested, the members of the group are presented together in the user interface, making it easier for the user to manage permissions. If the user grants the permission, all the permissions in the permission group will be granted in a unified manner. For security purposes, the Location, Contacts, Call Logs, Phone, Messaging, and Calendar permission groups do not support unified authorization.
The following uses the Location and Camera permission groups as an example.
When an application requests only the ohos.permission.APPROXIMATELY_LOCATION permission (belong to the Location permission group), a dialog box containing only the requested permission will be displayed to request user authorization.
When an application requests the ohos.permission.APPROXIMATELY_LOCATION and ohos.permission.LOCATION permissions (belonging to the Location permission group), a dialog box containing only the requested permissions will be displayed to request user authorization.
When an application requests ohos.permission.APPROXIMATELY_LOCATION (belonging to the Location permission group) and ohos.permission.CAMERA (belonging to the Camera permission group), two dialog boxes will be displayed to request the location and camera permissions, respectively.
The following lists the permission groups supported by the system. For details about the permissions, see Open user_grant Permissions.
Location Information
Camera
Microphone
Contacts
Calendar
Fitness
Body Sensors
Images and Videos
Music and Audio
Ad Tracking
Installed Bundle List
Multi-device Collaboration
Bluetooth
NearLink
Phone
Call Logs
Messaging
Pasteboard
Directory
NOTE
The permissions are available only to 2-in-1 device applications.
Files(deprecated)
NOTE This permission group is deprecated since API version 12.
ohos.permission.READ_DOCUMENT
ohos.permission.WRITE_DOCUMENT
ohos.permission.READ_MEDIA
ohos.permission.WRITE_MEDIA
Alternative solution:
To read or write images or videos in the media library:
- (Recommended) Use Picker to read images and videos in the media library, and use SaveButton to save images and videos in the media library. This solution is recommended because the application does not need any permission.
- Request the restricted permission ohos.permission.READ_IMAGEVIDEO or ohos.permission.WRITE_IMAGEVIDEO.
To read audio clips in the media library:
Request the restricted permission ohos.permission.READ_AUDIO or ohos.permission.WRITE_AUDIO.
- To read documents in Files:
Use the file Picker to read documents in Files. For details, see Selecting Documents and Saving Documents.
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Application Access Control
harmony 鸿蒙Access Control Overview
harmony 鸿蒙Application Permission Management Overview
harmony 鸿蒙Application Permissions
harmony 鸿蒙Requesting Restricted Permissions
harmony 鸿蒙Declaring Permissions
harmony 鸿蒙Workflow for Requesting Permissions
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦