capacitor-community / barcode-scanner

A fast and efficient (QR) barcode scanner for Capacitor
MIT License
437 stars 167 forks source link

Não abre a câmera para ler o código de barras #198

Closed SauloNogAlves closed 1 year ago

SauloNogAlves commented 1 year ago
  1. Fiz todas as configurações do manifesto, fiz a instalações e usei da forma proposta, porém sequer abre a câmera para leitura:
  2. Usei o código de uma maneira mais simples, como mostro seguir: async ler_codigo_barras(){ console.log('Estou tentando ler o cod...')

    const status = await BarcodeScanner.checkPermission({ force: true }); console.log('Limpando o background') BarcodeScanner.hideBackground(); console.log('Lendo o código mesmo') const result = await BarcodeScanner.startScan(); console.log('Resultado da leitura:', result.content) this.resultado = result.content console.log('Cheguei no final da função...') }

} desta forma ele até respondeu do debugador do android studio, porém não abre a câmera para ler o código de barras. Em um momento ele leu o código de barra, mesmo não aparecendo o código. Isso aconteceu uma única vez.

O retorno do debugador do android:

I/ThreeFingerSwipe: 0 ACTION_DOWN point count = 1 I/ThreeFingerSwipe: onPointDown... pointIndex = 0, pointId = 0 I/ThreeFingerSwipe: currentX = 313.0, currentY = 750.0 I/ThreeFingerSwipe: 0 ACTION_UP point count = 1 I/Capacitor/Console: File: http://localhost/6445.10b2876060283da9.js - Line 1 - Msg: Estou tentando ler o cod... V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 116460809, pluginId: BarcodeScanner, methodName: checkPermission V/Capacitor: callback: 116460809, pluginId: BarcodeScanner, methodName: checkPermission, methodData: {"force":true} I/Capacitor/Console: File: http://localhost/6445.10b2876060283da9.js - Line 1 - Msg: Limpando o background I/Capacitor/Console: File: http://localhost/6445.10b2876060283da9.js - Line 1 - Msg: Lendo o código mesmo V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 116460810, pluginId: BarcodeScanner, methodName: showBackground V/Capacitor: callback: 116460810, pluginId: BarcodeScanner, methodName: showBackground, methodData: {} V/Capacitor/Plugin: To native (Capacitor plugin): callbackId: 116460811, pluginId: BarcodeScanner, methodName: startScan V/Capacitor: callback: 116460811, pluginId: BarcodeScanner, methodName: startScan, methodData: {} D/CameraPreview: pause() D/CameraInstance: Closing camera D/SensorManager: unregisterListenerImpl sensor = null, listener = android.view.OrientationEventListener$SensorEventListenerImpl@251bb0b I/Capacitor/Console: File: http://localhost/ - Line 228 - Msg: undefined D/CameraPreview: resume() D/SensorManager: registerListenerImpl sensor = {Sensor name="icm40607 Accelerometer", vendor="INV", version=1, type=1, maxRange=78.45375, resolution=0.01, power=0.17, minDelay=5000}, delayUs = 200000, latencyUs = 0, listener = android.view.OrientationEventListener$SensorEventListenerImpl@4887aa6 I/gralloc4: unregister: id=21c000018aa I/gralloc4: unregister: id=21c000018ab I/gralloc4: unregister: id=21c000018ad I/gralloc4: unregister: id=21c000018af I/gralloc4: unregister: id=21c000018b1 I/gralloc4: unregister: id=21c000018b3 D/CameraInstance: Opening camera I/Camera-JNI: number_of_cameras:2 I/Camera-JNI: number_of_cameras:2 I/Camera-JNI: number_of_cameras:2 I/Camera-JNI: number_of_cameras:2 D/CameraInstance: Configuring camera I/CameraManager: Camera Display Orientation: 90 I/CameraManager: Initial camera parameters: preview-size=1920x1080;video-size=1920x1080;preferred-preview-size-for-video=1920x1080;preview-size-values=1920x1080,1920x1072,1440x1080,1600x720,1280x720,960x720,800x600,720x480,640x480,352x288,320x240,320x180,320x144,176x144;video-size-values=1920x1080,1920x1072,1440x1080,1600x720,1280x720,960x720,800x600,720x480,640x480,352x288,320x240,320x180,320x144,176x144;preview-format=yuv420sp;preview-format-values=yuv420p,yuv420sp;preview-frame-rate=30;preview-fps-range=5000,30000;preview-fps-range-values=(10000,10000),(5000,15000),(15000,15000),(5000,20000),(20000,20000),(5000,24000),(24000,24000),(5000,30000),(20000,30000),(30000,30000);preview-frame-rate-values=10,15,20,24,30;perfect-skin-level=0;brightness=3;brightness-values=0,1,2,3,4,5,6;contrast=3;contrast-values=0,1,2,3,4,5,6;saturation=3;saturation-values=0,1,2,3,4,5,6;metering-mode=frame-average;metering-mode-values=frame-average,center-weighted,spot-metering,(null);slow-motion=0;slow-motion-values=0,1,4;antibandauto-enable-values=1;smile-enable-values=1;is-takepicture-with-flash=0;picture-size=4000x3000;picture-size-values=4000x3000,4000x2250,4000x2000,4000x1800,4000x1896,3840x2160,3264x2448,3264x1836,3264x1632,3264x1552,3264x1468,2592x1944,2592x1458,2592x1296,2592x1224,2560x1920,2560x1440,2448x2448,2320x1740,2304x1728,2272x1080,2160x1080,2048x1536,2048x1152,1920x1080,1920x1072,1600x1200,1440x1080,1600x720,1280x720,960x720,800x600,720x480,640x480,352x288,320x240,320x180,320x144;picture-format=jpeg;picture-format-values=jpeg;jpeg-thumbnail-width=320;jpeg-thumbnail-height=240;jpeg-thumbnail-size-values=0x0,256x144,288x144,304x144,240x240,320x240,432x288;jpeg-thumbnail-quality=90;jpeg-quality=90;rotation=0;whitebalance=auto;whitebalance-values=auto,incandescent,fluorescent,daylight,cloudy-daylight;effect=none;effect-values=none,mono,negative,solarize,sepia,aqua;antibanding=auto;antibanding-values=off,50hz,60hz,auto;scene-mode=auto;scene-mode-values=auto,night,action,portrait,landscape,hdr;flash-mode=off;flash-mode-values=off,auto,on,torch;focus-mode=auto;focus-mode-values=infinity,auto,macro,continuous-picture,continuous-video;max-num-focus-areas=1;focus-areas=(0,0,0,0,0);focal-length=4.71;horizontal-view-angle=68.3848;vertical-view-angle=54.0026;exposure-compensation=0;max-exposure-compensation=32;min-exposure-compensation=-32;exposure-compensation-step=0.0625;auto-exposure-lock=false;auto-exposure-lock-supported=true;auto-whitebalance-lock=false;auto-whitebalance-lock-supported=true;max-num-metering-areas=1;metering-areas=(0,0,0,0,0);zoom=0;max-zoom=99;zoom-ratios=100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166,169,172,175,178,181,184,187,190,193,196,199,203,206,209,212,215,218,221,224,227,230,233,236,239,242,245,248,251,254,257,260,263,266,269,272,275,278,281,284,287,290,293,296,299,303,306,309,312,315,318,321,324,327,330,333,336,339,342,345,348,351,354,357,360,363,366,369,372,375,378,381,384,387,390,393,396,399;zoom-supported=true;smooth-zoom-supported=false;focus-distances=Infinity,Infinity,Infinity;max-num-detected-faces-hw=10;max-num-detected-faces-sw=0;video-frame-format=android-opaque;recording-hint=false;video-snapshot-supported=true;video-stabilization=false;video-stabilization-supported=false I/CameraConfiguration: Requesting focus mode value from among: [continuous-picture, continuous-video, auto] I/CameraConfiguration: Supported focus mode values: [infinity, auto, macro, continuous-picture, continuous-video] I/CameraConfiguration: Can set focus mode to: continuous-picture I/CameraConfiguration: Requesting flash mode value from among: [off] I/CameraConfiguration: Supported flash mode values: [off, auto, on, torch] I/CameraConfiguration: Can set flash mode to: off I/CameraConfiguration: Flash mode already set to off I/PreviewScalingStrategy: Viewfinder size: 1466x720 I/PreviewScalingStrategy: Preview in order of preference: [1600x720, 1280x720, 1920x1072, 1920x1080, 1440x1080, 960x720, 720x480, 800x600, 640x480, 320x180, 320x144, 320x240, 352x288, 176x144] I/CameraManager: Final camera parameters: video-size=1920x1080;preferred-preview-size-for-video=1920x1080;preview-size-values=1920x1080,1920x1072,1440x1080,1600x720,1280x720,960x720,800x600,720x480,640x480,352x288,320x240,320x180,320x144,176x144;video-size-values=1920x1080,1920x1072,1440x1080,1600x720,1280x720,960x720,800x600,720x480,640x480,352x288,320x240,320x180,320x144,176x144;preview-format=yuv420sp;preview-format-values=yuv420p,yuv420sp;preview-frame-rate=30;preview-fps-range=5000,30000;preview-fps-range-values=(10000,10000),(5000,15000),(15000,15000),(5000,20000),(20000,20000),(5000,24000),(24000,24000),(5000,30000),(20000,30000),(30000,30000);preview-frame-rate-values=10,15,20,24,30;perfect-skin-level=0;brightness=3;brightness-values=0,1,2,3,4,5,6;contrast=3;contrast-values=0,1,2,3,4,5,6;saturation=3;saturation-values=0,1,2,3,4,5,6;metering-mode=frame-average;metering-mode-values=frame-average,center-weighted,spot-metering,(null);slow-motion=0;slow-motion-values=0,1,4;antibandauto-enable-values=1;smile-enable-values=1;is-takepicture-with-flash=0;picture-size=4000x3000;picture-size-values=4000x3000,4000x2250,4000x2000,4000x1800,4000x1896,3840x2160,3264x2448,3264x1836,3264x1632,3264x1552,3264x1468,2592x1944,2592x1458,2592x1296,2592x1224,2560x1920,2560x1440,2448x2448,2320x1740,2304x1728,2272x1080,2160x1080,2048x1536,2048x1152,1920x1080,1920x1072,1600x1200,1440x1080,1600x720,1280x720,960x720,800x600,720x480,640x480,352x288,320x240,320x180,320x144;picture-format=jpeg;picture-format-values=jpeg;jpeg-thumbnail-width=320;jpeg-thumbnail-height=240;jpeg-thumbnail-size-values=0x0,256x144,288x144,304x144,240x240,320x240,432x288;jpeg-thumbnail-quality=90;jpeg-quality=90;rotation=0;whitebalance=auto;whitebalance-values=auto,incandescent,fluorescent,daylight,cloudy-daylight;effect=none;effect-values=none,mono,negative,solarize,sepia,aqua;antibanding=auto;antibanding-values=off,50hz,60hz,auto;scene-mode=auto;scene-mode-values=auto,night,action,portrait,landscape,hdr;flash-mode=off;flash-mode-values=off,auto,on,torch;focus-mode-values=infinity,auto,macro,continuous-picture,continuous-video;max-num-focus-areas=1;focus-areas=(0,0,0,0,0);focal-length=4.71;horizontal-view-angle=68.3848;vertical-view-angle=54.0026;exposure-compensation=0;max-exposure-compensation=32;min-exposure-compensation=-32;exposure-compensation-step=0.0625;auto-exposure-lock=false;auto-exposure-lock-supported=true;auto-whitebalance-lock=false;auto-whitebalance-lock-supported=true;max-num-metering-areas=1;metering-areas=(0,0,0,0,0);zoom=0;max-zoom=99;zoom-ratios=100,103,106,109,112,115,118,121,124,127,130,133,136,139,142,145,148,151,154,157,160,163,166,169,172,175,178,181,184,187,190,193,196,199,203,206,209,212,215,218,221,224,227,230,233,236,239,242,245,248,251,254,257,260,263,266,269,272,275,278,281,284,287,290,293,296,299,303,306,309,312,315,318,321,324,327,330,333,336,339,342,345,348,351,354,357,360,363,366,369,372,375,378,381,384,387,390,393,396,399;zoom-supported=true;smooth-zoom-supported=false;focus-distances=Infinity,Infinity,Infinity;max-num-detected-faces-hw=10;max-num-detected-faces-sw=0;video-frame-format=android-opaque;recording-hint=false;video-snapshot-supported=true;video-stabilization=false;video-stabilization-supported=false;focus-mode=continuous-picture;preview-size=1600x720 I/CenterCropStrategy: Preview: 720x1600; Scaled: 720x1600; Want: 720x1466 I/CameraPreview: Starting preview D/CameraInstance: Starting preview I/AutoFocusManager: Current focus mode 'continuous-picture'; use auto focus? false I/gralloc4: register: id=21c000018b5 I/gralloc4: register: id=21c000018b6 I/gralloc4: register: id=21c000018b8 I/gralloc4: register: id=21c000018ba I/gralloc4: register: id=21c000018bc I/gralloc4: register: id=21c000018be

No final não faz nada.

tafelnl commented 1 year ago

Please adhere to the issue template. If you just copy and paste code (without formatting even!) into the message, it's practically unreadable to anyone else. If you have a minimal reproduction, it may be of great worth to the maintainers. Please do share it as a github repo or stackblitz for example. Also the common language spoken here is English.

Without following the points above, you cannot expect any of the maintainers to be able to help you with your issue

thegnuu commented 1 year ago

Closing this, feel free to open a new issues with more information if your issue still exists