Search code examples
react-nativeexpoqr-codeandroid-permissions

How to add camera permission in react native


I want to scan the qr code using this package react-native-qrcode-scanner, I am following this tutorial https://enappd.com/blog/react-native-qr-code-scanning-using-react-native-camera/117/ In the tutorial, the camera permission is given through manifest file, however I don't have this file in my expo project. I tried to add "permissions": ["CAMERA"] to app.json file but it didn't work so How can I add camera permission?


Solution

  • Is there a specific reason you want to use that particular library, or are you using it simply because it is what is covered in the tutorial?

    Expo has a barcode scanner library that will perform QR code scanning, here is the documentation: https://docs.expo.dev/versions/latest/sdk/bar-code-scanner/. This library can be used in the managed workflow (which you are using by the sounds of things) and the documentation is pretty straight forward.

    Having looked at the library that you want to use, it will require linking which means you will have to eject your project to access the necessary files required for that - if there isn't any particularly requirement for you to use this library specifically, I would suggest steering clear of ejecting if it can be avoided.