harmony 鸿蒙Camera Development Preparations
Camera Development Preparations
The main process of camera application development includes development preparations, device input management, session management, preview, photographing, and video recording.
Before developing a camera application, you must request camera-related permissions (as described in the table below) to ensure that the application has the permission to access the camera hardware and other services. Before requesting the permission, ensure that the basic principles for permission management are met.
Permission | Description | Authorization Mode |
---|---|---|
ohos.permission.CAMERA | Allows an application to use the camera to take photos and record videos. | user_grant |
ohos.permission.MICROPHONE | Allows an application to access the microphone. This permission is required only if the application is used to record audio. |
user_grant |
ohos.permission.WRITE_MEDIA | Allows an application to read media files from and write media files into the user’s external storage. This permission is optional. | user_grant |
ohos.permission.READ_MEDIA | Allows an application to read media files from the user’s external storage. This permission is optional. | user_grant |
ohos.permission.MEDIA_LOCATION | Allows an application to access geographical locations in the user’s media file. This permission is optional. | user_grant |
After configuring the permissions in the module.json5 file, the application must call abilityAccessCtrl.requestPermissionsFromUser to check whether the required permissions are granted. If not, request the permissions from the user by displaying a dialog box.
For details about how to request and verify the permissions, see Permission Application Guide.
NOTE
Even if the user has granted a permission, the application must check for the permission before calling an API protected by the permission. It should not persist the permission granted status, because the user can revoke the permission through the system application Settings.
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Developing Audio Call
harmony 鸿蒙Audio Call Development
harmony 鸿蒙Audio Effect Management
harmony 鸿蒙Audio Input Device Management
harmony 鸿蒙Audio Output Device Management
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦