简体   繁体   English

用户在使用react-native-camera时拒绝在android上使用相机的权限时回调

[英]Callback when user denies permission to use camera on android while using react-native-camera

I'm using react-native-camera to take pictures in an android app. 我正在使用react-native-camera在Android应用程序中拍照。 As soon as user reaches the camera page, the library itself asks for permission to use the device's camera on android phones (with api level >22). 一旦用户到达摄像头页面,该库本身就会请求允许在android手机(API级别> 22)上使用该设备的摄像头。 (Please note that I'm not manually asking for camera permission by using PermissionsAndroid api of react-native ). (请注意,我不是通过使用react-native PermissionsAndroid api手动请求相机许可)。

Since asking for camera permission is inherent in this library, I'm expecting that it should by itself provide with appropriate callbacks when user grants or denies permission. 由于请求相机许可是该库中固有的,我希望当用户授予或拒绝许可时,它本身应该提供适当的回调。 I need to call goBack() if user denies the camera permission but could not find any appropriate callback method in their documentation wherein goBack() could be called. 如果用户拒绝摄像机许可,但在其文档中找不到可以调用goBack()任何适当的回调方法,则需要调用goBack()

You have to check permissions manually. 您必须手动检查权限。

React native permissions can help https://github.com/yonahforst/react-native-permissions React本机权限可以帮助https://github.com/yonahforst/react-native-permissions

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM