GithubHelp home page GithubHelp logo

capacitor-community / barcode-scanner Goto Github PK

View Code? Open in Web Editor NEW
434.0 434.0 153.0 1.46 MB

A fast and efficient (QR) barcode scanner for Capacitor

License: MIT License

Ruby 1.57% Java 35.86% Objective-C 2.21% Swift 35.13% JavaScript 0.96% TypeScript 24.27%

barcode-scanner's People

Contributors

7-plus-t avatar ae1ns avatar dependabot[bot] avatar ec-lmayr avatar gunsha avatar haschtl avatar jcesarmobile avatar longlife1st avatar oupsla avatar paintedshepherd avatar pedropanos avatar pkunszt avatar rbalet avatar scr2em avatar sjonkeesse avatar tafelnl avatar thegnuu avatar theonlytails avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

barcode-scanner's Issues

openAppSettings() throws an error

Calling openAppSettings() throws and error

There is no ActivityCallback method registered for the name: openSettingsResult.
Please define a callback method annotated with @ActivityCallback that receives arguments: (PluginCall, ActivityResult)        

Version

  • v2.0.0

Smartphone

  • OS: Android 8.0.0

Scanning with Android off a secondary LCD screen

Describe the bug
This is not really a bug, but the best description I can give. I have a small IOT with LCD screen, which shows a pairing QR code. In IOS it scans immediately, no issues.

In Android, the scanner opens but it doesn't read the code. Obviously refresh rate may be affecting it. When I scan off my monitor, no problem.

To Reproduce
It seems strictly related to the refresh on the LCD, because the identical QR code below displayed on a monitor works.

Version
1.2.1

Android
Samsung Note 10

image

[Android] Permission Request resolves immediately

The promise when requesting the permission status / request always immediately resolves without waiting for the user input.

To Reproduce
If requesting the permission like below, statusRequest.granted will never be true, as the checkPermission promise resolves immediately.

 const statusRequest = await BarcodeScanner.checkPermission({ force: true });

  if (statusRequest.asked) {
    // system requested the user for permission during this call
    // only possible when force set to true
  }

  if (statusRequest.granted) {
    // the user did grant the permission now
    // ERROR this will never happen, if the user just now granted the permission
    return true;
  }

Expected behavior
The await BarcodeScanner.checkPermission({ force: true }) should only resolve when the permission request is done.

  • OS: Android

I have looked through the Android code and added to paramaters to the savedReturnObject.
https://github.com/ec-lmayr/barcode-scanner/blob/main/android/src/main/java/com/dutchconcepts/capacitor/barcodescanner/BarcodeScanner.java

Once in line 407 ( this.savedReturnObject.put("resolve", "1"); ) and once in the permCallback in 467 ( this.savedReturnObject.put("resolve", "2"); ).

It is always with { resolve: 1 } resolved.
It seems like the return statement after calling requestPermissionForAlias(PERMISSION_ALIAS_CAMERA, call, "cameraPermsCallback"); in line 391 is ignored? Event when it's called the call will be resolved in line 407. Never in 467.

Maybe this helps you somehow? Thanks for you work!
All the best,
lukas

Add WIFI from QR code

Is your feature request related to a problem? Please describe.
no

Describe the solution you'd like
when you scan a QR code with wifi data with native camera it offers to connect to wifi
WIFI:T:WPA;S:myHome;P:12345678;H:false;

Android 11 permission "Ask every time" doesn't prompt the user to give camera permission again

Describe the bug
On android 11 there is a possibility to set the camera permission to "Ask every time". In case this permission is set plugins checkPermission method returns status denied set to true, only if user sets the permission manually to "Allow only while using the app" in Settings -> Apps -> [app] it is possible to scan the codes again. The issue appears after the device goes to sleep mode.

To Reproduce
Steps to reproduce the behavior:

  1. Call the checkPermission
  2. On prompt select "Only this time"
  3. Code scanning works as expected
  4. Close the app and leave device until it goes to sleep mode or turn it off
  5. Open cell phone, open the app and call the checkPermission again (click on scann button)
  6. Result object has property denied set to true

Expected behavior
If permission is set to "Ask every time" the app should prompt the window with question to set the permissions again.

Screenshots
If applicable, add screenshots to help explain your problem.

Version
v2.0.0

Smartphone (please complete the following information):

  • Device: [Samsung A70]
  • OS: [Android 11]

Additional context
Add any other context about the problem here.

startScan() doesn't open native camera

Describe the bug
I installed this plugin on Ionic 5 Angular iOS project. Whenever I run startScan method, it doesn't trigger native camera and no error message. The only thing I can see in log is this

⚡️  To Native ->  BarcodeScanner hideBackground 7747052
⚡️  To Native ->  BarcodeScanner startScan 7747053

To Reproduce
Steps to reproduce the behavior:

  1. Follow install plugin instruction at readme

  2. Import Plugins
    import { Plugins } from '@capacitor/core';

  3. Put prepare on ionViewWillEnter()

  4. Create wrapper function to call startScan method.

async openBarcodeScanner() {
    const { BarcodeScanner } = Plugins;
    
    BarcodeScanner.hideBackground();
    try {
      const barcodeData = await BarcodeScanner.startScan()
        console.log('Barcode data', barcodeData);
        if(barcodeData.hasContent) {
          this.checkBarcode(barcodeData.content);
        }
    } catch (err) {
      console.log('Scan barcode error', err);
    }
  } 

  1. Edit info.plist, set camera usage description
  2. Ionic build, sync, then open ios

Expected behavior
When startScan method get called, screen should immediately navigate to native camera.

Smartphone (please complete the following information):

  • Device: iPhone 6
  • OS: iOS 12.4.9

WebView transparent in react

Describe the bug
I want to use this QRCode Scanner with react, and tried on the Android, but it doesn't popup the scanner view. I searched the problem, it should be the Webview transparent problem...But I didn't find the solution for Ionic React

To Reproduce
Steps to reproduce the behavior:

export const QRScanner: React.FC = () => {
  const startScan = async () => {
    BarcodeScanner.hideBackground()

    const result = await BarcodeScanner.startScan()

    if (result.hasContent) {
      console.log(result.content)
    }
  }

  const stopScan = () => {
    BarcodeScanner.showBackground()
    BarcodeScanner.stopScan()
  }

  return (
    <IonPage>
      <IonHeader>
        <IonToolbar>
          <IonButtons slot="start">
            <IonMenuButton />
          </IonButtons>
          <IonTitle>QRScanner</IonTitle>
        </IonToolbar>
      </IonHeader>

      <IonContent fullscreen>
        <IonRow>
          <IonButton onClick={startScan}>Start</IonButton>
          <IonButton onClick={stopScan}>Cancel</IonButton>
        </IonRow>
      </IonContent>
    </IonPage>
  )
}

Expected behavior
The Scan View should coming, but it doesn't! But I got notice from Android, that the camera should already working...

Version
"@capacitor/android": "^3.1.1",
"@capacitor-community/barcode-scanner": "^2.0.1",

Smartphone (please complete the following information):
Android

Supertypes of the following classes cannot be resolved. Please make sure you have the required dependencies in the classpath: class com.dutchconcepts.capacitor.barcodescanner.BarcodeScanner, unresolved supertypes: com.journeyapps.barcodescanner.BarcodeCallback

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Version
[e.g. v1.0.0]

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

"TypeError: undefined is not an object" [...] / Error: method not available in web

So, I'm using this plugin for a while, but now i stared a new web app project with vue and the quasar framework.
I imported the plugin in the <script> tag:

import { Plugins, CameraResultType } from '@capacitor/core';

const { BarcodeScanner } = Plugins

and want a function to return the scanned data like:

async GetScanQrCode () {
      const camPermission = await BarcodeScanner.checkPermission({ force: true })
      if (!camPermission.granted) {
        return false
      }
      const result = await BarcodeScanner.startScan()
      if (result.hasContent) {
        return result.content
      }
    }

In my last project I did it the same all the way, so im pretty confused that on my iPhone 8 i get this message:

https://prnt.sc/11uywim

So it immediately fails. This also happens on my Android device, a Xiaomi Mi Note 10

So... what could be the problem here?
I already updated all my dependencies the lastest version and tried everything that comes to my mind, i just don't see why it's still working in my old project but not in this one.
In both projects im using vue version 2.6.12

Also, when i try to import the plugin this way...

import { BarcodeScanner } from '@capacitor-community/barcode-scanner'

... I always get the message "Error: method not available in web", either I'm running on a mobile or not.
This is very confusing and I really hope someone can help me out here.

Thanks in advance!

Problem with startScan : class member cannot have the keyword 'const', ts (1248)

import { Component } from '@angular/core';

import { BarcodeScanner } from '@capacitor-community/barcode-scanner';

@component({
selector: 'app-tab2',
templateUrl: 'tab2.page.html',
styleUrls: ['tab2.page.scss']
})
export class Tab2Page {

constructor() {}

const startScan = async () => {
BarcodeScanner.hideBackground(); // make background of WebView transparent

const result = await BarcodeScanner.startScan(); // start scanning and wait for a result

// if the result has content
if (result.hasContent) {
  console.log(result.content); // log the raw scanned content
}

};
}

Roadmap for this project?

First of all, many thanks to @tafelnl for the good work on this module 👏 🙇‍♂️ 🚀 🍻

Currently this module is probably the only reliable option, since the old Cordova module repo has already been archived and the pure web-based solutions (e.g. zxing-js) are not really suitable for Capacitor/Ionic (among other things because of the iOS WebRTC v>=14.3 issue).

We are currently using this module in a project and therefore somewhat depend on it. So it would be great to know what developments are planned, preferably with a rough timeline. Especially features like Frame in Camera view or torch integration are mission critical for us and it's not clear if or when this will be addressed.

Again, we are grateful for all the work that has already been done 🙏 Now we just want to find out if we can stick with the module 🙂

[android] feat: add support for inverted barcodes

On iOS inverted barcodes (white dots on black background) are recognized. Android can and should support this too.

I found a way too support this:

mBarcodeView.setDecoderFactory(new DefaultDecoderFactory(null, null, null, Intents.Scan.MIXED_SCAN));

need help to use barcode scanner

I am new to capacitorjs and trying out your plugin BarcodeScanner.

Followed the instructions, defining build.gradle, adding BarcodeScanner.class in MainActivity.
Also, run 'ionic build; ionic cap copy; ionic cap sync' and then re-compile and run on Android device.
In the Ionic App, I have a service providing startScan() function that will be trigger by a user click:

  public startScan = async () => {
    console.log(`here in startScan()`);
    // const { BarcodeScanner } = Plugins;
    BarcodeScanner.hideBackground(); // make background of WebView transparent
    const result = await BarcodeScanner.startScan(); // start scanning and wait for a result
    // if the result has content
    if (result.hasContent) {
      console.log(result.content); // log the raw scanned content
    }
  }

However, it seems it has no function at all. After clicked and called the function, it has no scanning window popped. Can anyone help to give me some hints? Thanks.

Can't open the QR Code Scanner: Access denied finding property "vendor.camera.aux.packagelist"

Describe the bug
Nothing happens on the android app when I call:
await BarcodeScanner.startScan()

Expected behavior
The bar code scanner should appear.

Version
I'm using Ionic 5 Angular with Capacitor, here the versions:

"@angular/core": "~11.2.0",
"@ionic/angular": "^5.5.2",
"@ionic-native/core": "^5.31.1",
"@capacitor-community/barcode-scanner": "^1.2.1",
"@capacitor/android": "^2.4.6",
 "@capacitor/core": "2.4.6",

Smartphone (please complete the following information):

  • Device: Xiaomi Mi A1
  • OS: Android 9

Additional context
I added
Here the error logs I get on Android studio when I call await BarcodeScanner.startScan():

2021-03-19 17:44:35.059 871-11602/? E/mm-camera: <STATS_AIS ><ERROR> 173: dsps_send_req: DSPS Send Request Timeout!!
2021-03-19 17:44:35.059 871-11602/? E/mm-camera: <STATS_AIS ><ERROR> 173: dsps_send_req: DSPS Send Request Timeout!!
2021-03-19 17:44:35.067 871-11587/? E/mm-camera: <IFACE ><ERROR> 637: iface_queue_buf_int: iface_queue_buf_int: queue buf to kernel failed, rc = -1
2021-03-19 17:44:35.067 871-11587/? E/mm-camera: <IFACE ><ERROR> 1862: iface_axi_divert_ack: iface_axi_divert_ack: isp_queue_buf error = -1
2021-03-19 17:44:35.067 871-11587/? E/mm-camera: <IFACE ><ERROR> 11498: iface_util_divert_ack: iface_util_divert_ack: VFE1 IFACE_AXI_ACTION_CODE_STREAM_DIVERT_ACK failed! rc = -1
2021-03-19 17:44:35.067 871-11587/? E/mm-camera: <ISP   ><ERROR> 1366: isp_util_forward_event: failed: mct_port_send_event_to_peer event->type 2
2021-03-19 17:44:35.068 871-11587/? E/mm-camera: <ISP   ><ERROR> 473: isp_port_process_upstream_event: failed: isp_handler_enqueue_event_to_trigger_queue
2021-03-19 17:44:35.068 871-11587/? E/mm-camera: <ISP   ><ERROR> 528: isp_port_event: failed: isp_port_process_upstream_event
2021-03-19 17:44:35.068 871-11587/? E/mm-camera: <PPROC ><ERROR> 678: base_port_handle_buf_divert_ack: base_port_handle_buf_divert_ack:678, failed
2021-03-19 17:44:35.068 871-11587/? E/mm-camera: <IMGLIB><ERROR> 565: module_imgbase_forward_port_event: module_imgbase_forward_port_event_paaf:565] Fowarding event 2 from src port failed
2021-03-19 17:44:35.068 871-11587/? E/mm-camera: <CPP   ><ERROR> 900: cpp_module_send_event_upstream: send_event_to_peer failed 0
2021-03-19 17:44:35.068 871-11587/? E/mm-camera: <CPP   ><ERROR> 976: cpp_module_send_buf_divert_ack: [CPP_BUF:] send_event_upstream failed -14
2021-03-19 17:44:35.099 871-11602/? E/mm-camera: <MCT   ><ERROR> 1108: mct_pipeline_decide_hw_wakeup: Couldn't find meta stream
2021-03-19 17:44:35.115 871-11736/? E/quadracfa_dummy: inside dummy remosaic_deinit 1
2021-03-19 17:44:35.244 5966-10915/io.ionic.starter E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2021-03-19 17:44:35.245 5966-10915/io.ionic.starter E/libc: Access denied finding property "vendor.camera.aux.packagelist2"
2021-03-19 17:44:35.245 5966-10915/io.ionic.starter E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2021-03-19 17:44:35.245 5966-10915/io.ionic.starter E/libc: Access denied finding property "vendor.camera.aux.packagelist2"
2021-03-19 17:44:35.256 24944-11742/? E/FileSource: Failed to open file '/product/media/audio/ui/camera_click.ogg'. (No such file or directory)
2021-03-19 17:44:35.256 24944-11742/? E/GenericSource: Failed to create data source!
2021-03-19 17:44:35.256 24943-24943/? E/MediaPlayerNative: error (1, -2147483648)
2021-03-19 17:44:35.256 24943-27642/? E/CameraService: Failed to load CameraService sounds: /product/media/audio/ui/camera_click.ogg
2021-03-19 17:44:35.258 586-29986/? E/SDM: HWCDisplay::GetHWCLayer: [0] GetLayer(210705) failed: no such layer
2021-03-19 17:44:35.274 24944-11749/? E/FileSource: Failed to open file '/product/media/audio/ui/VideoRecord.ogg'. (No such file or directory)
2021-03-19 17:44:35.274 24944-11749/? E/GenericSource: Failed to create data source!
2021-03-19 17:44:35.274 24943-24943/? E/MediaPlayerNative: error (1, -2147483648)
2021-03-19 17:44:35.274 24943-27642/? E/CameraService: Failed to load CameraService sounds: /product/media/audio/ui/VideoRecord.ogg
2021-03-19 17:44:35.288 24944-11755/? E/FileSource: Failed to open file '/product/media/audio/ui/VideoStop.ogg'. (No such file or directory)
2021-03-19 17:44:35.288 24944-11755/? E/GenericSource: Failed to create data source!
2021-03-19 17:44:35.289 24943-24943/? E/MediaPlayerNative: error (1, -2147483648)
2021-03-19 17:44:35.289 24943-27642/? E/CameraService: Failed to load CameraService sounds: /product/media/audio/ui/VideoStop.ogg
2021-03-19 17:44:35.338 871-11769/? E/mm-camera: <STATS_AIS ><ERROR> 173: dsps_send_req: DSPS Send Request Timeout!!
2021-03-19 17:44:35.340 24945-24961/? E/NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'INTERFACE' not found
2021-03-19 17:44:35.340 24945-24961/? E/NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'STATE' not found
2021-03-19 17:44:35.340 24945-24961/? E/NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'TIME_NS' not found
2021-03-19 17:44:35.340 24945-24961/? E/NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'UID' not found
2021-03-19 17:44:35.347 871-871/? E/mm-camera: <STATS ><ERROR> 2827: stats_port_check_caps_reserve: Invalid Port capability type!
2021-03-19 17:44:35.347 871-871/? E/mm-camera: <STATS ><ERROR> 2827: stats_port_check_caps_reserve: Invalid Port capability type!
2021-03-19 17:44:35.357 871-11786/? E/mm-camera: <MCT   ><ERROR> 1108: mct_pipeline_decide_hw_wakeup: Couldn't find meta stream
2021-03-19 17:44:35.359 871-11786/? E/mm-camera: <MCT   ><ERROR> 1108: mct_pipeline_decide_hw_wakeup: Couldn't find meta stream
2021-03-19 17:44:35.364 5966-10915/io.ionic.starter E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2021-03-19 17:44:35.364 5966-10915/io.ionic.starter E/libc: Access denied finding property "vendor.camera.aux.packagelist2"
2021-03-19 17:44:35.364 5966-10915/io.ionic.starter E/libc: Access denied finding property "vendor.camera.aux.packagelist"
2021-03-19 17:44:35.364 5966-10915/io.ionic.starter E/libc: Access denied finding property "vendor.camera.aux.packagelist2"
2021-03-19 17:44:35.377 577-11760/? E/QCameraParameters: setMorphoHDR, ++
2021-03-19 17:44:35.377 577-11760/? E/QCameraParameters: setMorphoHHT, ++
2021-03-19 17:44:35.388 871-11786/? E/mm-camera: <MCT   ><ERROR> 1108: mct_pipeline_decide_hw_wakeup: Couldn't find meta stream
2021-03-19 17:44:35.389 577-11760/? E/QCameraParameters: str_val (null)
2021-03-19 17:44:35.389 577-11760/? E/QCameraMorphoPostProc: Enable: nothing to changed!
2021-03-19 17:44:35.389 577-11760/? E/QCameraMorphoPostProc: Enable: nothing to changed!
2021-03-19 17:44:35.389 577-11760/? E/QCameraMorphoPostProc: Enable: nothing to changed!
2021-03-19 17:44:35.389 871-11786/? E/mm-camera: <MCT   ><ERROR> 1108: mct_pipeline_decide_hw_wakeup: Couldn't find meta stream
2021-03-19 17:44:35.403 871-11786/? E/mm-camera: <IFACE ><ERROR> 2791: iface_util_modify_plane_info_for_native_buf: iface_util_modify_plane_info_for_native_buf: Invalid cam_format 2088533116
2021-03-19 17:44:35.403 871-11786/? E/mm-camera: <IFACE ><ERROR> 2826: iface_util_calculate_frame_length_for_native_buf: iface_util_calculate_frame_length_for_native_buf: returned fail=-1
2021-03-19 17:44:35.403 871-11786/? E/mm-camera: <IFACE ><ERROR> 2791: iface_util_modify_plane_info_for_native_buf: iface_util_modify_plane_info_for_native_buf: Invalid cam_format 2088533116
2021-03-19 17:44:35.403 871-11786/? E/mm-camera: <IFACE ><ERROR> 2826: iface_util_calculate_frame_length_for_native_buf: iface_util_calculate_frame_length_for_native_buf: returned fail=-1
2021-03-19 17:44:35.403 871-11786/? E/mm-camera: <MCT   ><ERROR> 1108: mct_pipeline_decide_hw_wakeup: Couldn't find meta stream
2021-03-19 17:44:35.404 871-11786/? E/mm-camera: <MCT   ><ERROR> 1108: mct_pipeline_decide_hw_wakeup: Couldn't find meta stream
2021-03-19 17:44:35.410 871-11786/? E/mm-camera: <IMGLIB><ERROR> 4525: faceproc_hw_comp_create: Library not loaded, handle=0x0, p_ops=0xf0654c4c
2021-03-19 17:44:35.559 871-11767/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_eeprom_get_calibration_items: 501: ENTER arc_ov12a10_eeprom_get_calibration_items
2021-03-19 17:44:35.559 871-11767/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_eeprom_get_calibration_items: 516: is_wbc:1,is_afc:1,is_lsc:1,is_dpc:0,is_insensor:0,        is_ois:0
2021-03-19 17:44:35.559 871-11767/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_eeprom_get_calibration_items: 517:  Exit 
2021-03-19 17:44:35.565 871-11767/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_autofocus_calibration: 565: Enter
2021-03-19 17:44:35.565 871-11767/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_autofocus_calibration: 593: [xiaomi af otp] marco: 708, infinity: 203
2021-03-19 17:44:35.565 871-11767/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_autofocus_calibration: 609: [xiaomi af otp] adjusted code_per_step: 125, qvalue: 128
2021-03-19 17:44:35.572 871-11786/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_eeprom_get_calibration_items: 501: ENTER arc_ov12a10_eeprom_get_calibration_items
2021-03-19 17:44:35.572 871-11786/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_eeprom_get_calibration_items: 516: is_wbc:1,is_afc:1,is_lsc:1,is_dpc:0,is_insensor:0,        is_ois:0
2021-03-19 17:44:35.572 871-1163/? E/quadracfa_dummy: inside dummy remosaic_init 1
2021-03-19 17:44:35.572 871-11786/? E/mm-camera: <SENSOR><ERROR> arc_ov12a10_eeprom_get_calibration_items: 517:  Exit 
2021-03-19 17:44:35.572 871-1163/? E/quadracfa_dummy: inside dummy remosaic_gainmap_gen 1
2021-03-19 17:44:35.579 871-11786/? E/mm-camera: <IFACE ><ERROR> 4075: iface_util_set_hw_stream_config_pix: iface_util_set_hw_stream_config_pix: Assigned vfe 1 intf 0 for related cam type 1
2021-03-19 17:44:35.598 871-11786/? E/mm-camera: <IMGLIB><ERROR> 396: faceproc_comp_get_param: faceproc_comp_get_param:396] Error type 520
2021-03-19 17:44:35.598 871-11786/? E/mm-camera: <IMGLIB><ERROR> 1701: faceproc_sw_wrapper_get_config: Null pointer p_handle=0x0, p_config=0xebe0079c
2021-03-19 17:44:35.598 871-11786/? E/mm-camera: <IMGLIB><ERROR> 318: faceproc_comp_set_param: Error param=521
2021-03-19 17:44:35.598 871-11786/? E/mm-camera: <IMGLIB><ERROR> 3396: module_faceproc_client_exec: rc -4
2021-03-19 17:44:35.635 577-11761/? E/mm-still: omx_component_set_callbacks: Bad Parameter
2021-03-19 17:44:35.721 871-11777/? E/mm-camera: <ERROR> 831: dmlroc_init: dmlroc_init cfg: camif 1080x1920, elem 44x60, thres 0.001600, accur 8
2021-03-19 17:44:35.721 871-11777/? E/mm-camera: <ERROR> 832: dmlroc_init: dmlroc_init cfg: offsetH 0, offsetV 12
2021-03-19 17:44:35.721 871-11777/? E/mm-camera: <ERROR> 833: dmlroc_init: dmlroc_init mesh: rxc 10x13, subs 4, hxw 30x30, offset vert 0, horz 0
2021-03-19 17:44:35.749 871-11782/? E/mm-camera: <STATS_AF ><ERROR> 904: af_process_parse_stats: Invalid FV data!
2021-03-19 17:44:40.518 24945-24961/? E/NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'INTERFACE' not found
2021-03-19 17:44:40.518 24945-24961/? E/NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'STATE' not found
2021-03-19 17:44:40.518 24945-24961/? E/NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'TIME_NS' not found
2021-03-19 17:44:40.518 24945-24961/? E/NetlinkEvent: NetlinkEvent::FindParam(): Parameter 'UID' not found

Here a part of my AndroidManifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="io.ionic.starter">
    <!-- Permissions -->

    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Camera, Photos, input file -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- Geolocation API -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.location.gps" />
    <!-- Network API -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- Navigator.getUserMedia -->
    <!-- Video -->
    <uses-permission android:name="android.permission.CAMERA" />
    <!-- Audio -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
    <!-- capacitor-community/barcode-scanner -->
    <uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
    <uses-feature android:name="android.hardware.camera" />
    <application
        android:hardwareAccelerated="true"

Here a part of my MainActivity.java:

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
      ActivityCompat.requestPermissions(this, new String[] {Manifest.permission.CAMERA},50);
    }
    // Initializes the Bridge
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      // Additional plugins you've installed go here
      // Ex: add(TotallyAwesomePlugin.class);
      add(BarcodeScanner.class);

    }});
  }
}

Here the javascript code I use:

  async scanQRCode() {
    try {
      const { BarcodeScanner } = Plugins;
      BarcodeScanner.hideBackground(); // make background of WebView transparent
      const result = await BarcodeScanner.startScan(); // start scanning and wait for a result
      // if the result has content
      console.log(result);
      if (result.hasContent) {
        console.log(result.content); // log the raw scanned content
      }
    } catch (error) {
      ToastHelper.toastError(`Problem with the QR Code Scanner, error: ${error}`);
    }
  }

The android app already has Camera/Location/Microphone/Storage permissions granted on the phone.

feat: add configurability to just pause the scanner (while keeping the view open) on scan rather than destroying it.

Right now the current implementation of the scanner is to automatically destroy it for battery and performance reasons. In the source code there is currently a destroy function which dismantles the camera and hides the viewfinder. It would be great if we could configure this functionality to just pause the scanner when a barcode is scanned, and to keep the camera viewfinder open, something like the function below.

private func destroy() {
self.shouldRunScan = false
}

Issue in adding a stop scan button and adjust the height and width of the camera

Hi,

I have used the plugin with my capacitor vue project where am trying to implement the barcode scanner. I found this one useful but after adding it, i released that i don't have any option to add a stop scan button over the screen(since camera covers all over the screen). Would be helpful if anyone can suggest me a solution where and how i can add a Stop button and also adjust the height and width of the camera view. Thanks.

Option for limiting which code type(s) can be scanned

Is your feature request related to a problem? Please describe.
I'd like to be able to limit the code types that can be scanned. I think this would improve user experience because incompatible code types can't be scanned this way.

Describe the solution you'd like
An option in the prepare and/or startScan methods to specify which code type(s) this particular scanner can scan.

Describe alternatives you've considered
.

Additional context
Example of how the phonegap barcode scanner handled this (formats option):
https://github.com/phonegap/phonegap-plugin-barcodescanner#using-the-plugin

Web/PWA support

Would be nice if this plugin can have a web implementation so we can use it in PWA apps :)

Getting @color/colorPrimary instead of the BarcodeView

After setting everything transparent in the web view, the Barcode View is not showing up but barcode scans are working properly. It is only the app primary color that is in the background.

I edit a little the source code by bringing the Barcode View to the front instead of the WebView everything works properly but I cannot take advantage of the custom personalisation with HTML/CSS.

Ionic CLI : 6.12.3
Ionic Framework: 5.1.1
Capacitor: 2.1.1

Android: 6

Thanks

No podspec found for `DutchconceptsCapacitorBarcodeScanner` in `../../node_modules/@dutchconcepts/capacitor-barcode-scanner`

Describe the bug
When trying to install the plugin, I get an error saying there is no podspec found for the plugin.

To Reproduce
Steps to reproduce the behavior:

  1. Follow installation instructions - starting with npm install @dutchconcepts/capacitor-barcode-scanner
  2. Run npx cap sync
  3. See error:

No podspec found for DutchconceptsCapacitorBarcodeScanner in ../../node_modules/@dutchconcepts/capacitor-barcode-scanner

Expected behavior
When running npx cap sync we should not get this error.

Additional context
I see a podspec file in capacitor-barcode-scanner, so not sure why it's not finding it. Even after adding it to Info.plist, I still get this error. I have not tried it on Android yet so do not know if the plugin works there.

hideBackground not working?

Version
Dev mode.......... capacitor
Pkg quasar........ v1.15.0
Pkg @quasar/app... v2.1.14
Debugging......... enabled
Running mode...... IDE (manual)

Desktop (please complete the following information):

  • OS: windows
  • Browser chrome

Smartphone (please complete the following information):

  • Device: samsung galaxy s10
  • OS: 10.0
  • Browser
  • Version [e.g. 22]

Additional context
Hello.. Thank you for making a great program.
There are some strange things, so I ask you a question.

I am using the quasar framework.
My source is
methods: {
async checkPermission() {
const { BarcodeScanner } = Plugins;
const status = await BarcodeScanner.checkPermission({ force: true });

  if (status.granted) {
    // 권한이 부여 된 사용자
    return true;
  }

  return false;
},
async startScan() {
  try {
    const { BarcodeScanner } = Plugins;

    const status = await this.checkPermission();

    await BarcodeScanner.hideBackground();
    const result = await BarcodeScanner.startScan();
    if (result.hasContent) {
      alert(result.content);
    }
  } catch (error) {
    alert(error);
    console.error(error);
  }
}

When I run the scan... nothing happens.
It seems that hideBackground is not doing anything.

However, when the barcode is scanned... the barcode is output as an alert.

It works fine, but I can't see the scan screen.

Is there any other way I can try?

Empty response object when checking permissions with { force: false } option

As stated in the docs, it should be possible to check the permissions without triggering the native system dialog:

const status = await BarcodeScanner.checkPermission({ force: false });

While I assumed the status const would hold all fields from the CheckPermissionResult interface (see below), I am receiving an empty object {}. In theory, the empty object does comply with the interface typing since all properties are optional but it does not make much sense though. Plus the docs are indicating that the properties should be available when checking with force: false.

// CheckPermissionResult interface
interface CheckPermissionResult {
    granted?: boolean;
    denied?: boolean;
    asked?: boolean;
    neverAsked?: boolean;
    restricted?: boolean;
    unknown?: boolean;
}

I am using the latest version (2.0.0) of the plugin with Capacitor 3.0.1. Tested on an Android emulator (Google Pixel 2).

Capacitor 3 support

Great package, awesome you've recently became a community plugin! 🎉

I was wondering if there's Capacitor 3 support coming?

Thanks!

Output scanned format in BarcodeScanner.startScan()

Is your feature request related to a problem? Please describe.
What would be the right way to output format after scan result received?

Describe the solution you'd like
I have added found.type to PluginCallResultData() but it prints smth like "type":"org.gs1.EAN-13"

public func metadataOutput(_ captureOutput: AVCaptureMetadataOutput, didOutput metadataObjects: [AVMetadataObject], from connection: AVCaptureConnection) {

        if (metadataObjects.count == 0 || !self.isScanning) {
            // while nothing is detected, or if scanning is false, do nothing.
            return
        }

        let found = metadataObjects[0] as! AVMetadataMachineReadableCodeObject
        if (targetedFormats.contains(found.type)) {
            var jsObject = PluginCallResultData()
            if (found.stringValue != nil) {
                jsObject["hasContent"] = true
                jsObject["content"] = found.stringValue
                jsObject["type"] = found.type // prints ex:"org.gs1.EAN-13"
            } else {
                jsObject["hasContent"] = false
            }

            if (self.savedCall != nil) {
                savedCall?.resolve(jsObject)
                savedCall = nil
            }

            self.destroy()
        }
    }

Additional context
How can we convert fount.type to format as described in documentation?

Category Type Android iOS
1D Product
UPC_A ✔**
UPC_E
UPC_EAN_EXTENSION
EAN_8
EAN_13
1D Industrial
CODE_39
CODE_39_MOD_43
CODE_93
CODE_128
CODABAR
ITF
ITF_14
2D
AZTEC
DATA_MATRIX
MAXICODE
PDF_417
QR_CODE
RSS_14
RSS_EXPANDED

Using Yarn workspaces results in: Error: method not available in web

Describe the bug
All methods yield just Error: method not available in web.

To Reproduce
Use any methods of the plugin.
EDIT: I'm using just prepare, hide/show-Background and startScan methods.

Version

I'm using [email protected] and @capacitor-community/[email protected], here is the full list of yarn cap doctor

💊   Capacitor Doctor  💊 

Installed Dependencies:

  @capacitor/cli 2.4.7
  @capacitor/core 2.4.7
  @capacitor/android 2.4.7
  @capacitor/ios 2.4.7
  @capacitor/electron not installed

[success] Android looking great! 👌
  Found 10 Capacitor plugins for ios:
    @capacitor-community/barcode-scanner (1.2.1)
    capacitor-dark-mode (1.0.5)
    capacitor-plugin-ios-swipe-back (1.0.3)
    capacitor-rate-app (0.1.1)
    capacitor-secure-storage-plugin (0.5.0)
    cordova-plugin-appcenter-crashes (0.5.1)
    cordova-plugin-appcenter-shared (0.5.1)
    cordova-plugin-fingerprint-aio (4.0.2)
    cordova-plugin-inappbrowser (5.0.1-dev)
    onesignal-cordova-plugin (2.11.3)
[success] iOS looking great! 👌

Desktop (please complete the following information):

I'm using Yarn@1 with workspaces feature in a monorepo.

  System:
    OS: macOS 11.4
    CPU: (8) x64 Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
    Memory: 439.66 MB / 32.00 GB
    Shell: 3.1.2 - /usr/local/bin/fish
  Browsers:
    Brave Browser: 89.1.21.77
    Chrome: 91.0.4472.114
    Edge: 91.0.864.54
    Firefox: 85.0.2
    Safari: 14.1.1

Smartphone (please complete the following information):

Tested on one physical device

  • Device: Samsung SM-J330F
  • OS: Android 8.0
  • WebView implementation with Chrome 91.0.4472.120

And on an Apple simulator

  • Device: iPhone 11
  • OS: iOS 14.5

And on an Android emulator

  • Device: Pixel 3
  • OS: Android 11

Additional context
I read the logs for anything "barcode" related but no trace of warning/error. I also double-checked the setup and all seems to be OK.

It only scans QRCodes

It only scans QRCodes in both ios and android.
Did you try to scan a barcode? and is there any settings to make it work?
It is good plugin but it can't recognize barcodes only qrcodes!

Not scanning barcode on android

Describe the bug
I was trying to scan a barcode in android but not reading it at all. Sometimes I can scan but it takes several seconds to read the barcode.

Here is my code:

import { Component, AfterViewInit, OnDestroy, ChangeDetectorRef } from '@angular/core';
import { AlertController } from '@ionic/angular';
import { BarcodeScanner } from '@capacitor-community/barcode-scanner';
import { ModalService } from 'src/app/services/modal.service';

@component({
selector: 'app-barcode-scan-model',
templateUrl: './barcode-scan-model.component.html',
styleUrls: ['./barcode-scan-model.component.scss'],
})
export class BarcodeScanModelComponent implements AfterViewInit, OnDestroy {

result = null;
scanActive = false;

constructor(
private alertCtrl: AlertController,
private _cdf: ChangeDetectorRef,
private modal: ModalService
) { }

async ngAfterViewInit() {
document.addEventListener('click', (evt) => {
const target = evt.target as HTMLElement;
if (target.id === 'closeScanner') {
this.stopScan();
}
});
await BarcodeScanner.prepare();
this.startScan();
this._cdf.detectChanges();
}

ngOnDestroy() {
this.stopScan();
}

async startScan() {
BarcodeScanner.hideBackground();
document.body.classList.add('qrscanner');
const allowed = await this.checkPermission();
if (allowed) {
this.scanActive = true;
const result = await BarcodeScanner.startScan();
if (result?.hasContent) {
this.result = result.content;
}
document.body.classList.remove('qrscanner');
BarcodeScanner.showBackground();
this.scanActive = false;
} else {
document.body.classList.remove('qrscanner');
BarcodeScanner.showBackground();
this.dismiss();
}
}

stopScan() {
if (this.scanActive) {
document.body.classList.remove('qrscanner');
BarcodeScanner.showBackground();
BarcodeScanner.stopScan();
this.scanActive = false;
this.dismiss();
}
}

async checkPermission() {
return new Promise(async (resolve, reject) => {
const status = await BarcodeScanner.checkPermission({ force: true });

  if (status.granted) {
    resolve(true);
  } else if (status.denied) {
    const alert = await this.alertCtrl.create({
      header: 'Sem permissão',
      message: 'Por favor libere o acesso a sua câmera nas configurações.',
      buttons: [
        {
          text: 'Não',
          role: 'cancel',
          handler: () => {
            resolve(false);
          }
        },
        {
          text: 'Abrir configurações',
          handler: () => {
            BarcodeScanner.openAppSettings();
            resolve(false);
          }
        }
      ]
    });

    await alert.present();
  } else {
    resolve(false);
  }
});

}

dismiss() {
this.modal.dismiss();
}

}

Screenshots
Here is the barcode I am trying to scan:
WhatsApp Image 2021-09-06 at 12 08 24

Version
"@angular/core": "~10.0.0",
"@capacitor/android": "^3.1.2",
"@capacitor/core": "^3.1.2",
"@ionic-native/core": "^5.30.0",
"@ionic/angular": "^5.5.2",
"@capacitor-community/barcode-scanner": "^2.0.1"

Smartphone (please complete the following information):

  • Device: ZenFone Shot Plus
  • OS: Android 9
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
When I scan a QR code it works perfectly but when I try to scan a barcode it doesn't work or it takes too long to read the barcode.

Examples / Demo?

Are there any resources / examples / demo's to test this app out?
Or maybe a list with apps that are built with this barcode-scanner, and are public?

... or maybe a simple APK for android, just to see it in action.

Use IntentIntegrator for better 1D Performance

While Testing this plugin for our application i found out that the performance for 1D Barcode. (Code-39) is not as good as in our old nativ application. Both use the zxing libarary. The difference is in our old app we use IntentIntegrator to show the Scanner.
I implemented IntentIntegrator into this plugin if you are interrested. Also the torch would be easier with IntentIntegrator and the backgorund of the Application would not have to be hidden becuse a custom Activity is started.

Frame in Camera view

Is your feature request related to a problem? Please describe.
When there are multiple codes close together on the scanned surface, there's no way to make sure the scanner scans a particular one.

Describe the solution you'd like
A frame in the camera view, in which the code would have to be placed to scan it, would fix this.

Describe alternatives you've considered
None. I've seen this in other barcode scanning plugins and I think this is the way to go.

Additional context
Example of solution

Make use of Capacitor's `Camera.requestPermissions()`

First of all - Cool plugin, thank you!

I was playing a bit with permissions and found that if access to camera once granted by the official Capacitor Camera plugin, then no need to ask again - yours works just fine.
Even more, this line in manifest becomes optional then:

<uses-permission android:name="android.permission.CAMERA" />

I played more, and found that it would be even more convenient to use "consent popup" shown by Camera.requestPermissions(), then to ask people to go to App settings -> permissions.

I'm not an Android developer and, maybe, I'm missing something. Could you confirm that it is a good flow, if your app is using Capacitor's Camera plugin anyway (for other purposes)

If so, it probably deserves to be mentioned in the docs.

Jest Issue - ReferenceError: capacitorExports is not defined

Describe the bug
When I test against a module using this plugin, jest throws an error after the import statement:

  ● Test suite failed to run

    ReferenceError: capacitorExports is not defined

    > 5 | import {BarcodeScanner} from "@capacitor-community/barcode-scanner";
        | ^
      6 | import {Capacitor} from "@capacitor/core";

      at Object.<anonymous> (node_modules/@capacitor-community/barcode-scanner/dist/plugin.js:68:7)
      at Object.<anonymous> (src/views/myview.ts:5:1)
      at Object.<anonymous> (src/views/myview.test.ts:3:1)
      at TestScheduler.scheduleTests (node_modules/@jest/core/build/TestScheduler.js:333:13)
      at runJest (node_modules/@jest/core/build/runJest.js:387:19)
      at _run10000 (node_modules/@jest/core/build/cli/index.js:408:7)
      at runCLI (node_modules/@jest/core/build/cli/index.js:261:3)

To Reproduce
Run jest against a module using this plugin

Expected behavior
No error from jest, I don't test this plugin using it.

Version
2.0.1

Autofocus unreliable on Android

Describe the bug
The camera sometimes does not autofocus properly. (It might be a problem happening on specific devices).
It is possible to fix the focus by switching to stock Camera app and return to app implementing this plugin.

To Reproduce
Steps to reproduce the behavior:
Implement QR reading using this plugin.

Expected behavior
Unless configured otherwise, plugin should have constant autofocus in order to find QR code easier.

Screenshots

Version
1.2.1

Smartphone (please complete the following information):

  • Device: Xiaomi Mi10 Lite 5G
  • OS: Android 10

Additional context
I was actually able to figure out what the problem is.
On my device, it seems that the focus setting is only working properly when the continuous mode is set.
Looking at the implementation of the plugin, I was actually able to fix the issue by adding the following code to the plugin, in the setupCamera() method.

settings.setContinuousFocusEnabled(true);

I was wondering if this mode was not added on purpose (maybe because it is not supported by all devices?) or if it just was not required at all so far.
At least, if it's not the case by default, I would like to add a way to add that flag through some kind of setting method.
I am open to writing a PR for that feature if necessary, but I'd like to hear if there was some design choice here I am not aware of.

NPM Installing seems to remove Fontawsome-free css

I have installed this plugin via Npm, and it seems to uninstall the FontAwsome-free modal,

After i install this modal, i have to rerun the npm to install the fontawsome-free package, could this be right ?

Dangling promise when stopping scan

Describe the bug
When a scan is active (i.e. const result = await BarcodeScanner.startScan();) and the scan gets stopped somewhere else (i.e. BarcodeScanner.stopScan();). The original promise is neither resolved nor rejected.

To Reproduce
Steps to reproduce the behavior:

  1. Start a scan and await the result.
  2. Stop the scan from somewhere else.
  3. Code after the await will not be executed and if it is in a try-catch block, the catch does not fire

Expected behavior
The 'scan promise' should either be resolved (i.e. with hasContent being false) or it should be rejected. Personally, I would prefer it to be resolved without content.

Version
v1.1.1

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: iPhone8 Plus
  • OS: iOS 14.4
  • Capacitor: 2.4.6

Add Support for Capacitor 3

Describe the bug
Compiling for iOS 11.0, but module 'Capacitor' has a minimum deployment target of iOS 12.0:

To Reproduce
Steps to reproduce the behavior:

Add same package to any project and try doing ng build
after
npx cap sync
npx cap open ios
Run Project a error will come as above

  • OS: iOS
  • Version 14

More info in the Opacity of the WebView section

I do not see the scanner open up when the method is fired. I think this is because the webview is blocking it, because I can see that background: 'transparent'; is applied but I guess it's not enough. I have tried applying background: 'transparent'; to other layers, like ion-app and ion-content, to no avail.

Any tips or examples of other plugins getting the webview transparent?

I am trying to use this in an Ionic Capacitor app. The scanner doesn't show up on Android or iOS.

Plugin example in ionic/angular project

Describe the bug

First of all thank you very much for the work you do for the community

I have been trying to integrate this plugin into a basic ionic v5 project, but have had some trouble getting the scanner to work.

The error that appears when I try it on an Android device is:

Error: Uncaught (in promise): Error: method not available in web Error: method not available in web

To Reproduce

  1. Create ionic project: ionic start
  2. Install plugin
  3. Add android platform
  4. Run on android device

Expected behavior
Barcode scanner plugin working in ionic or example

Version
Ionic v5
Plugin v1.1.1

  • OS: Android 9.0
  • Device: Xiaomi Redmi Note 5

image

[Android] Crash on App start

Describe the bug
I followed all steps of the installation guide but I can't start the app.
The app directly crashes because of a FATAL EXCEPTION.

To Reproduce
Steps to reproduce the behavior:

  1. Start the app

Expected behavior
It should be possible to start the app.

Screenshots
image

Version
2.0.1

Smartphone (please complete the following information):

  • Device: Redmi Note 10 Pro
  • OS: MIUI 12.5.4.0 (Android 11)
  • Browser Chrome

Issue when scanning a GS1-128 barcode

Description of the bug
When I process a GS1 DataMatrix like this one:
https://barcode.tec-it.com/en/GS1DataMatrix?data=0105000456013482172012001000001%5CF210000000003
I get the following result: \u001d0105000456013482172012001000001\u001d210000000003
The \F (FNC1) terminator is recognized and the \u001d character is added between values.
However when I do the following with a GS1-128 barcode like this one:
https://barcode.tec-it.com/en/EANUCC128?data=010500045611225310COV0109%5CF17220901%20
I get the following result: 010500045611225310COV010917220901
And the \F (FNC1) terminator is not recognized and the values are concatenated.

To Reproduce
Scan the barcodes from the links above.

Expected behavior
The plugin should recognize the group separator in a case of a GS1-128 barcode as well.

Version
2.0.1

BarcodeScanner is undefined

I'm trying to integrate this plugin into an Nx Workspace Capacitor monorepo. I've followed the described instructions on this repo, but with no success

Bellow you can see my configuration based on instructions from here:

// package.json in root project
 "dependencies": {
    "@capacitor-community/barcode-scanner": "^1.2.1",
    "@capacitor/core": "^2.4.5",
}
// package.json in capacitor project 
"dependencies": {
    "@capacitor-community/barcode-scanner": "^1.2.1"
  },

MainActivity

import com.dutchconcepts.capacitor.barcodescanner.BarcodeScanner;
import com.getcapacitor.BridgeActivity;
import com.getcapacitor.Plugin;

import java.util.ArrayList;

public class MainActivity extends BridgeActivity {
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Initializes the Bridge
    this.init(savedInstanceState, new ArrayList<Class<? extends Plugin>>() {{
      // Additional plugins you've installed go here
      // Ex: add(TotallyAwesomePlugin.class);
      add(BarcodeScanner.class);
    }});
  }
}

AndroidManifest

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.aleacontrol.acms.mobile">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:roundIcon="@mipmap/ic_launcher_round"
        android:supportsRtl="true"
        android:theme="@style/AppTheme"
        android:hardwareAccelerated="true">

        <activity
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
            android:name="com.aleacontrol.acms.mobile.MainActivity"
            android:label="@string/title_activity_main"
            android:theme="@style/AppTheme.NoActionBarLaunch"
            android:launchMode="singleTask">

            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
                <category android:name="android.intent.category.BROWSABLE" />
                <data android:scheme="@string/custom_url_scheme" />
            </intent-filter>

        </activity>

        <provider
            android:name="androidx.core.content.FileProvider"
            android:authorities="${applicationId}.fileprovider"
            android:exported="false"
            android:grantUriPermissions="true">
            <meta-data
                android:name="android.support.FILE_PROVIDER_PATHS"
                android:resource="@xml/file_paths"></meta-data>
        </provider>
    </application>

    <!-- Permissions -->
    <uses-sdk tools:overrideLibrary="com.google.zxing.client.android" />
    <uses-permission android:name="android.permission.INTERNET" />
    <!-- Camera, Photos, input file -->
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    <!-- Geolocation API -->
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-feature android:name="android.hardware.location.gps" />
    <!-- Network API -->
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <!-- Navigator.getUserMedia -->
    <!-- Video -->
    <uses-permission android:name="android.permission.CAMERA" />
    <!-- Audio -->
    <uses-permission android:name="android.permission.RECORD_AUDIO" />
    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS"/>
</manifest>

I've tried several times to sync, clean & build the project but without any success.
Am I doing something wrong or does this plugin not support Nx Capacitor

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.