react-native-qrcode-scanner icon indicating copy to clipboard operation
react-native-qrcode-scanner copied to clipboard

How to allow the user to activate the camera permissions if he deny it at the first time ?

Open Hophoet opened this issue 4 years ago • 2 comments

A want to allow the user to reactivate it camera permission for the app if at the first time he deny the permission

What's happening?

I did't find a way to make this action available for the user like from a button , i can make an action to show the permission dialog to the user with props or method Screenshot_20210221-120020

How can it be reproduced?

allow the user to reactivate the camera permission inside the app with a button event Screenshot_20210221-121328

Build details?

Android version 11 react-native version 0.63.4

Hophoet avatar Feb 21 '21 12:02 Hophoet

` import { Platform, PermissionsAndroid, } from 'react-native'; if (Platform.OS === 'android') { const granted = await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.CAMERA, );

  if (granted === PermissionsAndroid.RESULTS.GRANTED) {
    //user accepted
  } else {
    //user declined
  }
}

`

ahmadtech2 avatar Mar 28 '21 16:03 ahmadtech2

` import { Platform, PermissionsAndroid, } from 'react-native'; if (Platform.OS === 'android') { const granted = await PermissionsAndroid.request( PermissionsAndroid.PERMISSIONS.CAMERA, );

  if (granted === PermissionsAndroid.RESULTS.GRANTED) {
    //user accepted
  } else {
    //user declined
  }
}

`

What we do in "//user accepted" ? Because i tried a few things like making the window of asking permission again, but i cant change the camera to appear again.

TatianaMatumoto avatar Jul 30 '21 20:07 TatianaMatumoto