gruhn / vue-qrcode-reader

A set of Vue.js components for detecting and decoding QR codes.
https://gruhn.github.io/vue-qrcode-reader
MIT License
2.1k stars 335 forks source link

Camera not opening on Android Devices after convert to Capacitor #333

Closed vhlpdevelop closed 1 year ago

vhlpdevelop commented 1 year ago

Describe the bug Works like a charm in browser. But i tried to convert my webapp to android using capacitor. After that this error appears and camera doesnt show up. Error =>

E/chromium: [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. E/chromium: [ERROR:web_contents_delegate.cc(218)] WebContentsDelegate::CheckMediaAccessPermission: Not supported. I/CameraManagerGlobal: Connecting to camera service W/cr_media: Requires MODIFY_AUDIO_SETTINGS and RECORD_AUDIO. No audio device will be available for recording D/Capacitor: App paused D/Capacitor: Unable to find a Capacitor plugin to handle permission requestCode, trying Cordova plugins 1208988326 D/Capacitor: App resumed I/Capacitor/Console: File: http://localhost/js/chunk-716f7e04.ba5d842d.js - Line 1 - Msg: [object DOMException]

To Reproduce Just convert it your vue application to android and then, emulate it. (using capacitor js) Also tried using a real device, but same error.

Screenshots https://ibb.co/brptFZY https://ibb.co/g4cJ4zB https://ibb.co/0sp7kZd

Desktop (please complete the following information):

Smartphone (please complete the following information):

vhlpdevelop commented 1 year ago

So... after a lot time and using the best method( try and fail) i fix it. But how? Its simple. First thing, sometimes capacitor will not add on AndroidManifest.xml permission necessary to open the DEVICE CAMERA. First, add Capacitor Camera API https://capacitorjs.com/docs/apis/camera follow the steps. After that Build you app and sync with capacitor. Before you build apk or run it, go to AndroidManifest.xml and add <uses-permission android:name="android.permission.CAMERA" /> in permissions section.

that's it. Sorry for my horrible english 👍