Coder Social home page Coder Social logo

phonegap-plugin-barcodescanner's Introduction

PhoneGap Plugin BarcodeScanner

================================

Build Status

Cross-platform BarcodeScanner for Cordova / PhoneGap.

Follows the Cordova Plugin spec, so that it works with Plugman.

Installation

This requires phonegap 7.1.0+ ( current stable v8.0.0 )

phonegap plugin add phonegap-plugin-barcodescanner

It is also possible to install via repo url directly ( unstable )

phonegap plugin add https://github.com/phonegap/phonegap-plugin-barcodescanner.git

Optional variables: This plugin requires the Android support library v4. The minimum version is 24.1.0. Default value is 27.+. Check out the latest version here.

phonegap plugin add phonegap-plugin-barcodescanner --variable ANDROID_SUPPORT_V4_VERSION="27.1.1"

Supported Platforms

  • Android
  • iOS
  • Windows (Windows/Windows Phone 8.1 and Windows 10)
  • Browser

Note: the Android source for this project includes an Android Library Project. plugman currently doesn't support Library Project refs, so its been prebuilt as a jar library. Any updates to the Library Project should be committed with an updated jar.

Note: Windows 10 applications can not be build for AnyCPU architecture, which is default for Windows platform. If you want to build/run Windows 10 app, you should specify target architecture explicitly, for example (Cordova CLI):

cordova run windows -- --archs=x86

PhoneGap Build Usage

Add the following to your config.xml:

<!-- add a version here, otherwise PGB will use whatever the latest version of the package on npm is -->
<plugin name="phonegap-plugin-barcodescanner" />

On PhoneGap Build if you're using a version of cordova-android of 4 or less, ensure you're building with gradle:

<preference name="android-build-tool" value="gradle" />

Using the plugin

The plugin creates the object cordova.plugins.barcodeScanner with the method scan(success, fail).

The following barcode types are currently supported:

Barcode Type Android iOS Windows
QR_CODE
DATA_MATRIX
UPC_A
UPC_E
EAN_8
EAN_13
CODE_39
CODE_93
CODE_128
CODABAR
ITF
RSS14
PDF_417
RSS_EXPANDED
MSI
AZTEC

success and fail are callback functions. Success is passed an object with data, type and cancelled properties. Data is the text representation of the barcode data, type is the type of barcode detected and cancelled is whether or not the user cancelled the scan.

A full example could be:

   cordova.plugins.barcodeScanner.scan(
      function (result) {
          alert("We got a barcode\n" +
                "Result: " + result.text + "\n" +
                "Format: " + result.format + "\n" +
                "Cancelled: " + result.cancelled);
      },
      function (error) {
          alert("Scanning failed: " + error);
      },
      {
          preferFrontCamera : true, // iOS and Android
          showFlipCameraButton : true, // iOS and Android
          showTorchButton : true, // iOS and Android
          torchOn: true, // Android, launch with the torch switched on (if available)
          saveHistory: true, // Android, save scan history (default false)
          prompt : "Place a barcode inside the scan area", // Android
          resultDisplayDuration: 500, // Android, display scanned text for X ms. 0 suppresses it entirely, default 1500
          formats : "QR_CODE,PDF_417", // default: all but PDF_417 and RSS_EXPANDED
          orientation : "landscape", // Android only (portrait|landscape), default unset so it rotates with the device
          disableAnimations : true, // iOS
          disableSuccessBeep: false // iOS and Android
      }
   );

Encoding a Barcode

The plugin creates the object cordova.plugins.barcodeScanner with the method encode(type, data, success, fail).

Supported encoding types:

  • TEXT_TYPE
  • EMAIL_TYPE
  • PHONE_TYPE
  • SMS_TYPE
A full example could be:

   cordova.plugins.barcodeScanner.encode(cordova.plugins.barcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
            alert("encode success: " + success);
          }, function(fail) {
            alert("encoding failed: " + fail);
          }
        );

iOS quirks

Since iOS 10 it's mandatory to add a NSCameraUsageDescription in the Info.plist.

NSCameraUsageDescription describes the reason that the app accesses the user's camera. When the system prompts the user to allow access, this string is displayed as part of the dialog box. If you didn't provide the usage description, the app will crash before showing the dialog. Also, Apple will reject apps that access private data but don't provide an usage description.

To add this entry you can use the edit-config tag in the config.xml like this:

<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
    <string>To scan barcodes</string>
</edit-config>

Windows quirks

  • Windows implementation currently doesn't support encode functionality.

  • On Windows 10 desktop ensure that you have Windows Media Player and Media Feature pack installed.

Thanks on Github

So many -- check out the original iOS, Android and BlackBerry 10 repos.

Licence

The MIT License

Copyright (c) 2010 Matt Kane

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

phonegap-plugin-barcodescanner's People

Contributors

agrieve avatar basvanbeek avatar cepm-nate avatar cfjedimaster avatar claaslange avatar eccenux avatar eddyverbruggen avatar emarashliev avatar erisu avatar filmaj avatar huserben avatar jariztia avatar jaysonraymond avatar jcesarmobile avatar jlowe234 avatar macdonst avatar mlaponder avatar nadyaa avatar patrickbussmann avatar purplecabbage avatar renanbandeira avatar ryanwfiorini avatar sarangan12 avatar scheideman avatar sgrebnov avatar stevengill avatar stigok avatar timwindsor avatar umcsdon avatar vladimir-kotikov 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  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

phonegap-plugin-barcodescanner's Issues

stable v2.0.1 works better than current stable v3.0.0

my ios sdk is 8.4 and cordova 5.1.1.
i write two demo
demo1 with v2.0.1 and demo2 with v3.0.3

and i found demo1 is quickly than demo2 with a QR Code image(small and has an url on it)
i test many times,and get the result on my app.hope you to solve it.

Camera overlay

Hi,

I am just wondering whether this plug in can have the overlay layer on the camera. In my use case, I need to provide the custom text and a custom button when the camera open. How can I do it with this plug in.

Thanks
THomas

Distorted image on Portrait mode

When I call the scan method of the plugin in portrait mode the image gets squeezed, but it looks fine on landscape mode. I'm running Android 5.0.2 on HTC ONE. I also tested on Galaxy S5 and it shows the same problem. Is this a know issue? Any suggestions on how to fix it?

plugin.xml still on 3.1.2 for 4.0.0 version

I tried to download the plugin for a Meteor application which checks the version string in plugin.xml. As far as I can tell, plugin.xml still reports "3.1.2" for version "4.0.0", which lets the version check fail.

Configurable Overlay

Please make the Image, that is over-layed over the live Viewfinder-Image, configurable. So that a own graphic can be used.

Troubles with IOS

Hi, for me on IOS the scanner does not open every time (camera window freezes)

-> if it freezes than I can switch between front and back camera to "unfreeze" the window. Problem with this is that the success function is no longer called.
Luckily there is already a fix for that: wildabeast/BarcodeScanner#282 (working)

but this is only a workaround - any idea how to fix this?
(there is also a small thread here: wildabeast/BarcodeScanner#284)

Using "flash" mode

Please add a method to enable/disable the flash mode. By now the Windows Phone implementation "flashes" all the time but there's no "flash-mode" using the android implementation.

Windows Mobile - Memory Leaks on Nokia Lumia Phones

Tested on the Nokia Lumia 625
There are several significant memory leaks in the windows universal app implementation of the plugin. Specifically around the MediaCapture API and it's uses.

They have been identified by others see here and here and I have personally verified them.

The solution of clearing off the audio did not work for me.

The problem revolves around any attempt to take an image from the camera. I have created a fixed version of the plugin but it involved rewriting a substantial portion of the code and changing the mechanism by which it takes images. I would submit a pull request but I don't have another phone to test and I don't own the IP rights to this code.

See here for the doc on MediaCapture

There are serious leaks in
Insantiating a MediaCapture object
The CapturePhotoToStorageFileAsync method
The CapturePhotoToStreamAsync method

There appear to be no leaks (or very small leaks) in the API for obtaining the preview stream.

The solution
This is how I worked around these memory leaks.
First of all Instantiate a MediaCapture object on the first call and reuse that same object for all subsequent requests.

Currently the windows implementation feeds the preview stream into a video element, while in the background takes pictures every couple of seconds and analyses them for barcodes, this also has the annoying shutter sound too.

Instead of this, feed the stream into the video element then use canvas.drawImage to copy an image from the video element into an html canvas element. Then call getImageData() on the canvas and feed the byte array straight into the ZXing library.

Note that when using drawImage you MUST specify width and height otherwise you will get a black image - contrary to the HTML specification for this method.

Options - Front camera

Is there any way, one could define which camera should be used to scan the (bar)code?

Scanning crashes on device.

During testing on my Nexus 5, I would scan a barcode, get a message stating it found something at the bottom of the scan screen then it crashes completely out. I then tried it on other devices and it scanned. Here are my current results:

Android 5.1.1 -- Nexus 5 Crashes on scan.
Android 5.1.1 -- Nexus 6 Works fine.
Android 5.0 -- MotoX 2014 (Second Gen) works.

Plugin fails to build in Cordova project

Good day guys,

I have an issue where when I add the plugin to my project, the build fails, but when I remove it, it works just fine again.

The error result i get is the following:
Warning: [aapt] warning: string 'menu_settings' has no default translation.
Error: [dx] UNEXPECTED TOP-LEVEL EXCEPTION:
[dx] com.android.dex.DexException: Multiple dex files define Lcom/google/zxing/BarcodeFormat;
[dx] at com.android.dx.merge.DexMerger.readSortableTypes(DexMerger.java:596)
[dx] at com.android.dx.merge.DexMerger.getSortedTypes(DexMerger.java:554)
[dx] at com.android.dx.merge.DexMerger.mergeClassDefs(DexMerger.java:535)
[dx] at com.android.dx.merge.DexMerger.mergeDexes(DexMerger.java:171)
[dx] at com.android.dx.merge.DexMerger.merge(DexMerger.java:189)
[dx] at com.android.dx.command.dexer.Main.mergeLibraryDexBuffers(Main.java:454)
[dx] at com.android.dx.command.dexer.Main.runMonoDex(Main.java:302)
[dx] at com.android.dx.command.dexer.Main.run(Main.java:245)
[dx] at com.android.dx.command.dexer.Main.main(Main.java:214)
[dx] at com.android.dx.command.Main.main(Main.java:106)
[dx]
Error: /home/builder/BpcTooling/BuildScripts/node_build/node_modules/q/q.js:151
throw e;
^
[object Object]
Error: 'Build failed with error code 8'

Any help would be appreciated!

Regards

iOS: Cancel button not working

On iOS, there is a cancel button showing up. Yet, it does not have any function, it won't react on my taps. What am I doing wrong?

Make vibration and peep sound configurable

By now there are different implementations ... for example, the Android one does "peep" if it found a Barcode, the Windows Phone one does vibrate (and not peep).

Pleas make it configurable, if the scanner should "peep" or "vibrate" (or nothing of all).

BarcodeScanner on Platform Browser does not open Camera

Dear Barcode-Team,

when I add the BarcodePlugin to a cordova project with Platform Browser and Android it only provides the Fallback (Enter Barcode by Hand) and does not open the "Camera".

I start it with "cordova run browser".

Do you have any hints on what i am doing wrong?

KR
faithless

Updating ZXing Library

Would anyone be able to outline steps for updating the underlying ZXing library?

I believe many of the issues people are experiencing with this plugin are due to the zxing library
not being up to date.

I've used zxing outside of cordova framework and it works phenomonally.

Have iOS ignore 3rd .scan argument, debug why options scan_width, scan_height aren't used in Android.

For iOS, I don't include the 3rd argument as it makes the iOS app crash. :-(

On Android, the call looks like this:

cordova.plugins.barcodeScanner.scan( 
    function(a){console.log(a)}, 
    function(a){console.warn(a)}, 
    {
        SCAN_HEIGHT : 200, 
        SCAN_WIDTH  : 1200      // If this is over the device width, it is lowered automaically.
    }
);

This did work a few months ago, but I haven't been testing the scanning function each day, so do not know exactly when it switched back to the default size.

I dropped a breakpoint in cordova.js line 943, and the config arguments are getting sent to the plugin.

I've tried using plugin-barcodescanner versions 3.1.2, 3.1.1, 3.1.0, 3.0.1, but they all seem to ignore the options. The scanning window stays the same default size.

I've scanned through the pieces of code in the plugin that refer to the arguments being passed, and the only area that seems to be affecting this is in #4

Pull request #4 is all about screen rotation on android (very useful). Perhaps there is a conflict?

Anyone else run into this?

I'm not that familiar with the coding in src/android/LibraryProject/src/com/google/zxing/client/android/camera/CameraManager.java, but it looks like the .java file is expecting requestedFramingRectWidth / Height to be set somehow, or the setManualFramingRect() function to be called (looks like circular programming to me). Would someone mind looking into this and seeing if this function is called when SCAN_HEIGHT and SCAN_WIDTH are supplied?

Feature: Flashlight option (iOS)?

I've had some luck flicking the flashlight on in JS before launching the barcode scanner, and I've seen great results, is there a way we can add a button on the bottom left side to toggle the flashlight on/off from native code?

Looks like adding in functions from @EddyVerbruggen 's file would do the trick:

https://github.com/EddyVerbruggen/Flashlight-PhoneGap-Plugin/blob/master/src/ios/Flashlight.m

- (void)switchOn:(CDVInvokedUrlCommand*)command {
    CDVPluginResult* pluginResult;
    if ([self deviceHasFlashlight]) {
        AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
        [device lockForConfiguration:nil];
        [device setTorchMode:AVCaptureTorchModeOn];
        [device setFlashMode:AVCaptureFlashModeOn];
        [device unlockForConfiguration];
        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
    } else {
        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Device is not capable of using the flashlight. Please test with flashlight.available()"];
    }
    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

- (void)switchOff:(CDVInvokedUrlCommand*)command {
    CDVPluginResult* pluginResult;
    if ([self deviceHasFlashlight]) {
        AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
        [device lockForConfiguration:nil];
        [device setTorchMode:AVCaptureTorchModeOff];
        [device setFlashMode:AVCaptureFlashModeOff];
        [device unlockForConfiguration];
        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK];
    } else {
        pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsString:@"Device is not capable of using the flashlight. Please test with flashlight.available()"];
    }
    [self.commandDelegate sendPluginResult:pluginResult callbackId:command.callbackId];
}

-(BOOL)deviceHasFlashlight {
    if (NSClassFromString(@"AVCaptureDevice")) {
        AVCaptureDevice *device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo];
        return [device hasTorch] && [device hasFlash];
    }
    return false;
}

Not automatically linking binaries

  1. I uninstalled the wildebeast version using cordova plugin remove ...
  2. Installed this one with cordova plugin add <github url>
  3. Get this error:
Ld /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos/Glow.app/Glow normal armv7
    cd /Users/contact/DevWeb/glow/glow-app-2/platforms/ios
    export IPHONEOS_DEPLOYMENT_TARGET=6.0
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch armv7 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -L/Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos -L/Users/contact/DevWeb/glow/glow-app-2/platforms/ios/Glow/Plugins/com.danielcwilson.plugins.googleanalytics -L/Users/contact/DevWeb/glow/glow-app-2/platforms/ios/GoogleConversionTrackingSDK-iOS-3.2.0 -F/Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos -F/Users/contact/DevWeb/glow/glow-app-2/platforms/ios/HockeySDK-iOS/HockeySDK.embeddedframework -filelist /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Intermediates/Glow.build/Debug-iphoneos/Glow.build/Objects-normal/armv7/Glow.LinkFileList -dead_strip -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -force_load /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos/libCordova.a -ObjC -v -fobjc-arc -fobjc-link-runtime -miphoneos-version-min=6.0 -framework AdSupport -framework SystemConfiguration -framework UIKit -framework Security -framework QuickLook -framework Foundation -framework CoreText -framework AssetsLibrary /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos/libCordova.a -framework CoreGraphics -framework MobileCoreServices -framework CoreLocation -weak_framework ImageIO -lGoogleAnalyticsServices -framework CoreData -lz -lsqlite3.0 -weak_framework Social -lGoogleConversionTracking -weak_framework MessageUI -framework CoreTelephony -Xlinker -dependency_info -Xlinker /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Intermediates/Glow.build/Debug-iphoneos/Glow.build/Objects-normal/armv7/Glow_dependency_info.dat -o /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos/Glow.app/Glow

Apple LLVM version 6.1.0 (clang-602.0.53) (based on LLVM 3.6.0svn)
Target: arm-apple-darwin14.0.0
Thread model: posix
 "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch armv7 -dead_strip -force_load /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos/libCordova.a -iphoneos_version_min 6.0.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk -ObjC -o /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos/Glow.app/Glow -L/Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos -L/Users/contact/DevWeb/glow/glow-app-2/platforms/ios/Glow/Plugins/com.danielcwilson.plugins.googleanalytics -L/Users/contact/DevWeb/glow/glow-app-2/platforms/ios/GoogleConversionTrackingSDK-iOS-3.2.0 -filelist /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Intermediates/Glow.build/Debug-iphoneos/Glow.build/Objects-normal/armv7/Glow.LinkFileList -weak_framework CoreFoundation -weak_framework UIKit -weak_framework AVFoundation -weak_framework CoreMedia -weak-lSystem -framework AdSupport -framework SystemConfiguration -framework UIKit -framework Security -framework QuickLook -framework Foundation -framework CoreText -framework AssetsLibrary /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos/libCordova.a -framework CoreGraphics -framework MobileCoreServices -framework CoreLocation -weak_framework ImageIO -lGoogleAnalyticsServices -framework CoreData -lz -lsqlite3.0 -weak_framework Social -lGoogleConversionTracking -weak_framework MessageUI -framework CoreTelephony -dependency_info /Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Intermediates/Glow.build/Debug-iphoneos/Glow.build/Objects-normal/armv7/Glow_dependency_info.dat -framework Foundation -lobjc -lstdc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/6.1.0/lib/darwin/libclang_rt.ios.a -F/Users/contact/Library/Developer/Xcode/DerivedData/Glow-frcsbvangzeicmbymruopkljntep/Build/Products/Debug-iphoneos -F/Users/contact/DevWeb/glow/glow-app-2/platforms/ios/HockeySDK-iOS/HockeySDK.embeddedframework
Undefined symbols for architecture armv7:
  "_iconv_open", referenced from:
      zxing::qrcode::DecodedBitStreamParser::append(std::string&, unsigned char const*, unsigned long, char const*) in zxing-all-in-one.o
  "_iconv", referenced from:
      zxing::qrcode::DecodedBitStreamParser::append(std::string&, unsigned char const*, unsigned long, char const*) in zxing-all-in-one.o
  "_iconv_close", referenced from:
      zxing::qrcode::DecodedBitStreamParser::append(std::string&, unsigned char const*, unsigned long, char const*) in zxing-all-in-one.o
  "_kCVPixelBufferPixelFormatTypeKey", referenced from:
      -[CDVbcsProcessor setUpCaptureSession] in CDVBarcodeScanner.o
  "_OBJC_CLASS_$_CIContext", referenced from:
      objc-class-ref in CDVBarcodeScanner.o
  "_OBJC_CLASS_$_CIFilter", referenced from:
      objc-class-ref in CDVBarcodeScanner.o
  "_CVPixelBufferLockBaseAddress", referenced from:
      -[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
      -[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
  "_AudioServicesCreateSystemSoundID", referenced from:
      -[CDVbcsProcessor initWithPlugin:callback:parentViewController:alterateOverlayXib:] in CDVBarcodeScanner.o
  "_CVPixelBufferGetBytesPerRow", referenced from:
      -[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
      -[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
  "_CVPixelBufferGetWidth", referenced from:
      -[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
      -[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
  "_CVPixelBufferGetBaseAddress", referenced from:
      -[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
      -[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
  "_AudioServicesDisposeSystemSoundID", referenced from:
      -[CDVbcsProcessor dealloc] in CDVBarcodeScanner.o
  "_AudioServicesPlaySystemSound", referenced from:
      ___47-[CDVbcsProcessor barcodeScanSucceeded:format:]_block_invoke in CDVBarcodeScanner.o
  "_OBJC_CLASS_$_CATransaction", referenced from:
      objc-class-ref in CDVBarcodeScanner.o
  "_AudioServicesRemoveSystemSoundCompletion", referenced from:
      -[CDVbcsProcessor dealloc] in CDVBarcodeScanner.o
  "_CVPixelBufferGetHeight", referenced from:
      -[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
      -[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
  "_CVPixelBufferUnlockBaseAddress", referenced from:
      -[CDVbcsProcessor getLuminanceSourceFromSample:imageBytes:] in CDVBarcodeScanner.o
      -[CDVbcsProcessor getImageFromSample:] in CDVBarcodeScanner.o
ld: symbol(s) not found for architecture armv7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I had to manually add:

  • CoreImage
  • QuartzCore
  • libiconv.dlyib
  • AVFoundation
  • CoreVideo

to get it working

Always returning cancelled on android cordova 5.1.1 on Android

Upon scanning notice of "Found Plain Text" appears after scanning however when processing the success function the response object returns with: { text: "", format:"" cancelled: true }.

After modifying the plugin with logs to see if the scan result was being return post the scan activity however the log was triggered on failure before the scanner intent is completed.

Error cordova building with barcodescanner

Hi,
I'm trying to use phonegap-plugin-barcodescanner, i install it with the command line :
cordova plugin add com.phonegap.plugins.barcodescanner

and it works without problem, but when i try to build my project i have this error :
:processDebugResources FAILED

FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':processDebugResources'.

    com.android.ide.common.internal.LoggedErrorException: Failed to run command:
    /home/pascall/www/android/android-sdk-linux/build-tools/22.0.1/aapt package -f --no-crunch -I /home/pascall/www/android/android-sdk-linux/platforms/android-22/android.jar -M /.........../platforms/android/build/intermediates/manifests/full/debug/AndroidManifest.xml -S /.........../platforms/android/build/intermediates/res/debug -A /.........../platforms/android/build/intermediates/assets/debug -m -J /.........../platforms/android/build/generated/source/r/debug -F /.........../platforms/android/build/intermediates/res/resources-debug.ap_ --debug-mode --custom-package io.cordova.hellocordova -0 apk --output-text-symbols /.........../platforms/android/build/intermediates/symbols/debug
    Error Code:
    132

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 43.013 secs

/.........../platforms/android/cordova/node_modules/q/q.js:126
throw e;
^
Error code 1 for command: /.........../platforms/android/gradlew with args: cdvBuildDebug,-b,/.........../platforms/android/build.gradle,-Dorg.gradle.daemon=true
ERROR building one of the platforms: Error: /.........../platforms/android/cordova/build: Command failed with exit code 8
You may not have the required environment or OS to build this project
Error: /.........../platforms/android/cordova/build: Command failed with exit code 8
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23)
at ChildProcess.EventEmitter.emit (events.js:98:17)
at maybeClose (child_process.js:735:16)
at Process.ChildProcess._handle.onexit (child_process.js:802:5)

any idea ?

Thanks for your help
Best Regards
Pascall

Missing object

Hello, first of all, thanks for the plugin!

I've tried to use this on iPhone through phonegapp, but i got this error:

[console.error] Error: undefined is not an object (evaluating 'cordova.plugins.barcodeScanner')

Windows Mobile - Ionic - Preview stuck behind application

When using the windows 8.1 version of the plugin while using the Ionic framework, the canvas element that the preview is rendered to is behind the content.

The solution is to set a z-index on the canvas and the control elements so that it is in front of the content.

Crashing phonegap app on iOS 8.3

The first call to SCAN results in a query "Allow app to use camera?" then the app crashes.
From that point on, all calls to SCAN result in the app crashing.
This happens on the iPad Air, as well as all of our iPhones (6, 5, 4s).
I'm using version 3.1.2 of phonegap-plugin-barcodescanner.

Here are the other plugins I'm using:

    <gap:plugin name="cordova-plugin-whitelist"         source="npm" />
    <gap:plugin name="cordova-plugin-statusbar"         source="npm" />
    <gap:plugin name="cordova-plugin-splashscreen"      source="npm" />
    <gap:plugin name="cordova-plugin-dialogs"           source="npm" />
    <gap:plugin name="cordova-plugin-sqlite"            source="npm"    version="0.9.0" />
    <gap:plugin name="phonegap-plugin-barcodescanner"   source="npm"    version="3.1.2" />
    <gap:plugin name="ionic-plugin-keyboard"            source="npm"    version="1.0.4" />
    <gap:plugin name="cordova-plugin-datepicker"        source="npm"    version="0.8.0" />
    <gap:plugin name="cordova-plugin-appversion"        source="npm"    version="1.0.0" />
    <gap:plugin name="nl.madebymark.share"  version="0.1.1" />

I'll dig around a bit and see if I can find which, if any, are conflicting with barcode scanning.

I'll comment on this thread when I find something. Until then, has anyone else run into the app crashing on iOS?

Changes in .java files don't apply

I want to change the Barcode scanner plugin for Cordova a bit, so forked it and changed something rather simple for testing purposes.

On line 87 of URIResultHandler.java, I changed the result_uri to result_text . This way, when I would scan a URL, the information would say I scanned plain text.

Then, I added this plugin to my Ionic project, using cordova plugin add https://github.com/binoculars88/phonegap-plugin-barcodescanner .

Browsing to the files in my text editors does show my edits. But... when I run the application on my device, it keeps saying "URL Found".

It's like my changes don't apply... Anyone knows what to do?
I've tried removing android platform and reinstalling the plugin, but that didn't work.

Update:
I've tried changing the text itself in the strings.xml file, just for testing.
I've noticed that this indeed needs a remove and re-add of the platform. After that, the text is changed.

So changes in strings.xml do apply, but the original problem remains: changes in a .java file don't seem to apply.

The ultimate goal of this testing, is to make the duration time after a code is scanned (and the result text is shown) smaller. In CaptureActivity.java, I've changed DEFAULT_INTENT_RESULT_DURATION_MS = 1500L to DEFAULT_INTENT_RESULT_DURATION_MS = 15L , but the duration time stays the same, even after removing and re-adding android platform.

iOS scan never returns

When I try to scan a barcode on iOS (8.1.3) the camera comes up. But it never recognizes the barcode. Same barcode works fine on Android devices. Any ideas?

iOS error NSInvalidArgumentException

When running my phonegap app on the device (iPhone 5 running iOS 8), via Xcode 7 beta, I get the following error (logged to Xcode) and no other feedback. The camera doesn't initialise at all.

The app is using version 4.0.1 of the plugin and Phonegap CLI 5.2.0.
Android works fine.

*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '[__NSDictionaryM length]: unrecognized selector sent to instance 0x16ec2c20'

Support for PDF417

I know you probably get asked this quite frequently, but is there any possibility of PDF417 support in iOS soon? If not, care to explain why? Maybe I could give it a shot and offer a pull request. Thanks!

App closes after scanning a Barcode

Hi,

i got the problem that the scanner correctly detectes the barcode but closes the app without any error messages on Android. I scan Barcodes with a length of 4 characters and want to navigate to the productdetails of the scanned productno.

I use cordova and Ionic for the programming.

This is my Code snippet:

 $scope.scanBarcode = function(){
    cordova.plugins.barcodeScanner.scan(
        function ( resultCode ){
            var productno = resultCode.text;
            Product.get( productno ).then(
                function onSuccess( result ){
                    if(result.rows.length == 0){
                        $scope.popup = $ionicPopup.alert({
                            title: 'Fehler',
                            template: 'Artikel konnte nicht gefunden werden.'
                        });
                        return;
                    }
                    $state.go('app.product.detail', {productId: productno})
                }, function onError(){

                }
            );
    }, function( error ){
        console.log("Fehler aufgetreten -> " + error);
    });
};

Thanks in advance

barcode scanner is not working in window8.1 metro apps

Environment Setup:-

Window 8.1
cordova 4.1.2 & 5.1.1
Issue description:-
I have create simple cordova windows8 application through below commands in command line prompt.
Cmd:-
cordova create hello com.example.hello HelloWorld
cd hello
cordova platform add windows
cordova plugin add https://github.com/hypery2k/cordova-barcodescanner-plugin.git

I have added new method called scan in index.js and added below code into it.
image

Also I have added button with click even mapping to scan method in index.js as shown below.
image

After creating the application I opened the project and created installable package AppPackage folder by following below link instructions of "To create an app package for local testing and distribution"
https://msdn.microsoft.com/en-us/library/hh975357.aspx

Now When I installed the application in windows surface. the application installed and opened. But when I click the scan button. The application behaves like below.

  1. camera ui opened without scanning overlay/ square aniamtion.
  2. I can see only cancel button. That too after clicking on the cancel it hangs.
  3. Always opens front camera.
    Expected Result:-
  4. When we click scan button camera opens with scan overlay or animation.
  5. There should be a button to switch cameras between front and back
  6. Should have scan and cancel button.
  7. On click of scan button should scam the barcode which is in infornt of the camera And on click of the cancel button should go back to the application

Impossible to scan on Windows Phone 8.1 (Universal). No autofocus.

Using Lumia 830 and Samsung Ativ S I get the same result.

Code for activating Auto focus or Continuous focus is not working.
BarcodeScannerProxy.js (lines 69 - 78)

If however I put a button that triggers autofocus with the same code - autofocus is activated:
controller.focusControl.focusAsync();

wp8 with scan method but trigger "nothing"

hi all
for now I am using this version in PGB 3.7

<gap:plugin name="phonegap-plugin-barcodescanner" source="npm" version="3.1.2" />

when I use scan method in wp8,it seem can scan the QR CODE perfectly,but after scan,nothing happened...
no trigger on alert,just "nothing"

Scanning failed: Class not found

Hi !
I have a problem with the barcode scanner plugin on Android. It works perfectly when I build the app with the CLI but not when I'm using PGB which is strange (or not?). When I press scan I have the alert presents in the title.
Thanks in advance

Scan not returning to application

Sometimes when scanning a barcode, it doesn't go back. After the bip, the capture screen remains open and I have to scan the barcode again so it will finally go back to my application. It then returns {"text: "", "format": "", "cancelled": true}

Any idea of why this is happening? Any suggestions on how to debug this?

Android 5.0.2 on HTC One

Won't scan any Code 128 or Med-High density Code 39 codes on ios

I've tested on several ios 8 devices and out of the six barcodes seen here, the only one that I can get to scan is the low density code 39. They scan just fine on android.

I've compared the code in zxing/Code39Reader.cpp to the corresponding Code39 section in zxing-all-in-one.cpp and the important bits seem to be the same. Has anyone else experienced this?

ReferenceError: cordova is not defined

Hi all. A bit of a newbie here to Cordova so please be patient. I am happy to write a getting started guide etc for folks like me if I can get this to work. Thanks in advance.

My code fails in both the browser and my Nexus 4.
My index.html contains this:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
</head>
<body>

<script src="lib/jquery.js"></script>
<script src="lib/handlebars.js"></script>
<script src="js/services/memory/EmployeeService.js"></script>
<script src="js/app.js"></script>
<script src="cordova.js"></script>
</body>
</html>

In app.js I have the following:

(function () {
  scan();
    /* ---------------------------------- Local Variables ---------------------------------- */
    var homeTpl = Handlebars.compile($("#home-tpl").html());
    var employeeListTpl = Handlebars.compile($("#employee-list-tpl").html());

    var service = new EmployeeService();
    service.initialize().done(function () {
      renderHomeView();
    });

    /* --------------------------------- Event Registration -------------------------------- */
    //$('.search-key').on('keyup', findByName);
    /*$('.help-btn').on('click', function() {
        alert("Employee Directory v3.4");
    });*/

    document.addEventListener('deviceready', function () {
      StatusBar.overlaysWebView( false );
      StatusBar.backgroundColorByHexString('#ffffff');
      StatusBar.styleDefault();

      if (navigator.notification) { // Override default HTML alert with native dialog
        window.alert = function (message) {
          navigator.notification.alert(
            message,    // message
            null,       // callback
            "Workshop", // title
            'OK'        // buttonName
          );
        };
      }
    }, false);


    /* ---------------------------------- Local Functions ---------------------------------- */
    function findByName() {
      service.findByName($('.search-key').val()).done(function (employees) {
        $('.content').html(employeeListTpl(employees));
      });
    }

    function renderHomeView() {
      $('body').html(homeTpl());
      $('.search-key').on('keyup', findByName);
    }

    /* ---------------------------------- Barcode Scanner ---------------------------------- */
    function scan() {
      alert("Scanning start: ");
      cordova.plugins.barcodeScanner.scan( //<------------- The code breaks at the word cordova
        function (result) {
          alert("We got a barcode\n" +
          "Result: " + result.text + "\n" +
          "Format: " + result.format + "\n" +
          "Cancelled: " + result.cancelled);
        },
        function (error) {
          alert("Scanning failed: " + error);
        }
      );
    }
}());

hint-text and beep config

There should be an option to disable the "beep" that sounds when a barcode is scanned as well as the option to remove the "Place your barcode inside the viewfinder rectangle to scan it" text.

Taken from the old repo.

The ngCordova documentation links to the old repo. Should I open an issue in ngCordova repo to fix the link?

Remove Check Digit

Is there any way to remove the Check Digit from UPC format so that the result text would only be 11 digits and not 12

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.