GithubHelp home page GithubHelp logo

wildabeast / barcodescanner Goto Github PK

View Code? Open in Web Editor NEW
966.0 75.0 748.0 5.01 MB

Official repository now at [phonegap/phonegap-plugin-barcodescanner](http://github.com/phonegap/phonegap-plugin-barcodescanner).

JavaScript 0.90% HTML 3.26% CSS 0.01% Java 60.28% Objective-C++ 1.79% C++ 32.85% C# 0.89% C 0.03%

barcodescanner's Introduction

PhoneGap Plugin BarcodeScanner

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

Build Status

Note: This repository is no longer maintained. The official repository is now at phonegap/phonegap-plugin-barcodescanner.

Cross-platform BarcodeScanner for Cordova / PhoneGap.

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

Installation

This requires phonegap 5.0+ ( current stable v3.0.0 )

phonegap plugin add phonegap-plugin-barcodescanner

Older versions of phonegap can still install via the deprecated id ( stale v2.0.1 )

phonegap plugin add com.phonegap.plugins.barcodescanner

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

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

Supported Platforms

  • Android
  • iOS
  • Windows 8
  • Windows Phone 8
  • BlackBerry 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.

Using the plugin

The plugin creates the object cordova/plugin/BarcodeScanner with the method scan(success, fail).

The following barcode types are currently supported:

Android

  • QR_CODE
  • DATA_MATRIX
  • UPC_E
  • UPC_A
  • EAN_8
  • EAN_13
  • CODE_128
  • CODE_39
  • CODE_93
  • CODABAR
  • ITF
  • RSS14
  • PDF417
  • RSS_EXPANDED

iOS

  • QR_CODE
  • DATA_MATRIX
  • UPC_E
  • UPC_A
  • EAN_8
  • EAN_13
  • CODE_128
  • CODE_39
  • ITF

Windows8

  • UPC_A
  • UPC_E
  • EAN_8
  • EAN_13
  • CODE_39
  • CODE_93
  • CODE_128
  • ITF
  • CODABAR
  • MSI
  • RSS14
  • QR_CODE
  • DATA_MATRIX
  • AZTEC
  • PDF417

Windows Phone 8

  • UPC_A
  • UPC_E
  • EAN_8
  • EAN_13
  • CODE_39
  • CODE_93
  • CODE_128
  • ITF
  • CODABAR
  • MSI
  • RSS14
  • QR_CODE
  • DATA_MATRIX
  • AZTEC
  • PDF417

BlackBerry 10

  • UPC_A
  • UPC_E
  • EAN_8
  • EAN_13
  • CODE_39
  • CODE_128
  • ITF
  • DATA_MATRIX
  • 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);
      }
   );

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);
          }
        );

Windows8 quirks

Windows 8 implementation currently doesn't support encode functionality.

Windows Phone 8 quirks

Windows Phone 8 implementation currently doesn't support encode functionality.

BlackBerry 10 quirks

BlackBerry 10 implementation currently doesn't support encode functionality. Cancelling a scan on BlackBerry 10 is done by touching the screen.

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.

barcodescanner's People

Contributors

agrieve avatar basvanbeek avatar cfjedimaster avatar claaslange avatar eccenux avatar eddyverbruggen avatar emarashliev avatar filmaj avatar goya avatar jaysonraymond avatar jgillich avatar khayong avatar mlaponder avatar orenagiv avatar sgrebnov avatar stevengill avatar thomaschaaf avatar timwindsor avatar trongrg avatar umcsdon avatar wildabeast 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

barcodescanner's Issues

iOS Code 39 Support

This can be marked as feedback/enhancement. When will Code 39 for iOS become supported? VIN barcodes on vehicles use Code 39. It would be awesome for this plugin to support such.

Orientation issue after using the BarcodeScanner plugin on Android with PhoneGap build

Hi,

I'm having an issue with the orientationchange event and window.orientation property after scanning a barcode in portrait mode.

Steps to reproduce:

  1. have the device in portrait (window.orientation = 0)
  2. initiate a barcode scanning (it will force the device to landscape, triggers an orientationchange and set window.orientation = -90, before starting the scanner)
  3. keep the device in portrait and return back to the app
  4. window.orientation remains at -90, no orientationchange is triggered even though the device is still physically in portrait.
  5. turn the device to landscape (-90), no orientationchange will be triggered as the device already thinks it's in that orientation
  6. after this the window.orientation and orientationchange works as normal again

Is there any workaround for this? I have the same issue in both 2.7, 3.0 and 3.1.

BarcodeScanner works in iOS 6.1.3 fails to launch on iOS 5.1.1

[Reposting from https://github.com/phonegap/phonegap-plugins/issues/1218]

I'm testing on two devices - works perfectly in iOS 6.1.3 but nothing happens when I try to launch on my other device(both are 4s) using 5.1.1.

The barcode scanner is supposed to work in 4.x and up right? Anyone encountered a similar problem?

It conflicts with PhoneGap native plugins

After installing BarcodeScanner via plugman PhoneGap splashscreen didn't work, I couldn't find out why. After removing splashscreen and installing it again it worked but BarcodeScanner didn't work. In both ways it throws cannot read property of undefined error.. Why is it happening?

Android: JS Exception After Scanning

Appreciate if you can take a look at this bug:

  • I could install, compile and activate the plugin on my testing Android device.
  • The scanner was brought up, and I could correct scan a QR-code and got the "BEEP" sound
  • but when the scanner modal view is closed, I got this exception in the Eclipse console (the last line of the console log below):
10-15 13:36:44.650: D/DecodeHandler(7471): Found barcode in 440 ms
10-15 13:36:44.760: D/dalvikvm(7471): GC_FOR_ALLOC freed 624K, 42% free 10118K/17287K, paused 60ms, total 60ms
10-15 13:36:44.900: D/CaptureActivityHandler(7471): Got decode succeeded message
10-15 13:36:46.670: D/CaptureActivityHandler(7471): Got return scan result message
10-15 13:36:47.120: D/CordovaActivity(7471): Request code = 195543262
10-15 13:36:47.520: E/Web Console(7471): Uncaught Error: Error calling method on NPObject. at file:///android_asset/www/phonegap.js:929

I've done my homework on figuring out what NSObject is supposed to mean, but still couldn't fix it. Please help!

import org.apache.cordova.api cannot be resolved with phonegap 3.0.0

Hi,

I'm working with the latest phonegap 3.0.0, I was trying to integrate BarcodeScanner in the Android app. The barcodescanner library is added successfully but I got the error as shown in the image below.

error

I was following the instruction : https://github.com/wildabeast/BarcodeScanner/tree/master/src/android , "Building with plugman" .

I use windows 7, ADT Eclipse, got Java and Ant, variables set. I really appreciate if you can give a suggestion of how to fix it.

Thank you

Cordova 3.0.0 iOS issue

I've installed the plugin in my cordova 3.0.0 project. I get the following error using the example:

ERROR: Method 'scan:' not defined in Plugin 'BarcodeScanner'

Is the plugin supposed to be compatible with cordova 3.0.0 or am I doing something wrong here?

[Android] Remove menu, it just crashes

[Edit] Renamed from 'Should menu work?'

Hello,

I am exploring QR code scanner and I have noticed that there is menu in Capture activity.
Now this menu will not work properly if all of the activities from Zxing are not included in app. plugin.xml declares currently just bare miniumum Capture activity and Encoding one.

This leads to the menu opening but none of the buttons work, not only that but the app closes with exception as the activities are missing.

Should there be the menu? And if it should, shouldn't all the activities be included in plugin.xml?

Evgeni

Plugman wrong syntax

Please change this line
"plugman --plugins_dir plugins --plugin com.phonegap.plugins.barcodescanner --platform android --project platforms\android"

to:

"plugman install --plugins_dir plugins --plugin com.phonegap.plugins.barcodescanner --platform android --project platforms\android"

Error using plugman and cordova 3.0

Hi,
when i use this command:
plugman --plugins_dir plugins --plugin barcodescanner --platform android --project platforms/android
I have this error:
grafting xml at selector "plugins" from "%projectDir%/platforms/android/res/xml/config.xml" during config install went bad :(

Android: scanning process does not finish

Scanning does not work for me. I copied the example code, when starting the scanning process the red bar appears and when I align to the barcode yellow circles flicker which gives the impression that it is doing something ... however nothing happens.

Is the scanning process supposed to finish itself or do I have to trigger it somehow?

cordova 3.0.9
barcodescanner 1.0.1

iOS question

Has been tested in iOS? When adding using plgman, it does not add the info from the plugin.xml file to my project. This is using Cordova 2.3.0

So I manually add required frameworks, etc based on xml file, but when I try to load the scanner with window.plugins.barcodeScanner.scan the scanner does not load and I get no success or fail response.

Nexus 7 / Android 4.1: "the Android camera encountered a problem"

This is a clone of https://github.com/phonegap/phonegap-plugins/issues/866 as I figure that issues should be filed now.

I have installed the Barcode Scanner Phonegap plugin.
It works very well except for my nexus 7 tablet with this error message :
"Sorry, the Android camera encountered a problem. You may need to restart the device."

I have restarted, but I have still the same problem.

Here is my error message in the logcat console

11-05 11:36:50.197: W/CaptureActivity(5517): java.io.IOException
11-05 11:36:50.197: W/CaptureActivity(5517): at com.google.zxing.client.android.camera.CameraManager.openDriver(CameraManager.java:128)
11-05 11:36:50.197: W/CaptureActivity(5517): at com.google.zxing.client.android.CaptureActivity.initCamera(CaptureActivity.java:606)
11-05 11:36:50.197: W/CaptureActivity(5517): at com.google.zxing.client.android.CaptureActivity.surfaceCreated(CaptureActivity.java:346)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.SurfaceView.updateWindow(SurfaceView.java:543)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.SurfaceView.access$000(SurfaceView.java:81)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.SurfaceView$3.onPreDraw(SurfaceView.java:169)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.ViewTreeObserver.dispatchOnPreDraw(ViewTreeObserver.java:671)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1820)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4214)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.Choreographer$CallbackRecord.run(Choreographer.java:725)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.Choreographer.doCallbacks(Choreographer.java:555)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.Choreographer.doFrame(Choreographer.java:525)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:711)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.os.Handler.handleCallback(Handler.java:615)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.os.Handler.dispatchMessage(Handler.java:92)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.os.Looper.loop(Looper.java:137)
11-05 11:36:50.197: W/CaptureActivity(5517): at android.app.ActivityThread.main(ActivityThread.java:4745)
11-05 11:36:50.197: W/CaptureActivity(5517): at java.lang.reflect.Method.invokeNative(Native Method)
11-05 11:36:50.197: W/CaptureActivity(5517): at java.lang.reflect.Method.invoke(Method.java:511)
11-05 11:36:50.197: W/CaptureActivity(5517): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
11-05 11:36:50.197: W/CaptureActivity(5517): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
11-05 11:36:50.197: W/CaptureActivity(5517): at dalvik.system.NativeStart.main(Native Method)

What should I do ?

Thanks for your answer.

Just to add: I'm seeing the exactly same issue. I suspect an upgrade to the latest zxing version fixes the problem as indicated in the pull request phonegap/phonegap-plugins#654

Encoding a Barcode: do not show data

When some data is encoded, one sees a screen with both the QR code and the raw data, in text.

It should be possible to choose not to show the original data, since it is often not useful.

Windows Phone/Windows 8 Support

Thanks for the awesome work!

We would now like to release our app on WP and/or Win8. What would it take to support those platforms? How could we help? Could you point us in the right direction?

Doesn't appear to work with Cordova 2.6 on iOS

Using this with Cordova 2.6 on iOS, I get some errors when compiling:

/CordovaLib/Classes/CDVPlugin.h:26:17: Default initialization of an object of const type 'NSString *const'
/CordovaLib/Classes/CDVPlugin.h:27:17: Default initialization of an object of const type 'NSString *const'
/CordovaLib/Classes/CDVPlugin.h:28:17: Default initialization of an object of const type 'NSString *const'
/CordovaLib/Classes/CDVPlugin.h:29:17: Default initialization of an object of const type 'NSString *const'

Looks like they change those constants recently:

apache/cordova-ios@709d607

I don't really know enough about objective-c to know what the fix is... any ideas?

IOS not fullscreen: very hard to scan CODE_39 codes

Using: latest barcodescanner (0.6.0)
Devices: tested on iPhone5 and iPad2 (both iOS6)

I'm having the issue where my Android devices are able to scan rather long barcodes (CODE_39), even from quite a distance, but iOS devices aren't.

I'm building my app through the Phonegap Build API, with the following line in config.xml: <gap:plugin name="com.phonegap.plugins.barcodescanner" version="0.6.0" />

I think the problem is that the scanner window is smaller compared to previous versions. This means you have to keep your device farther away, making it very hard for the system to recognise the code. An older version of the barcode scanner filled the screen and recognised the same codes right away.

Old (working): Image
New (not working): Image

Any ideas what's wrong here?

Scanner loads slowly on iOS.

Hi everyone,

I am working on iOS version and the scanner seems to work fine apart from the issue that it loads very slowly (1-2 seconds). That means that when I call the scan function it opens but it takes a while.

Also, I am getting a warning on Xcode:
WARNING: -[<AVCaptureVideoPreviewLayer: 0x1e8b7af0> isOrientationSupported] is deprecated. Please use AVCaptureConnection's -isVideoOrientationSupported

Do you know any reasons for that? Is this warning related or something else?

Thanks.

Enable continuous scanning

Hi there..

Is there any way to enable continuous scanning using this plugin??

Regards,
Devon Britton.

Build Failed on Xcode

Message from xcode 5, Cordova 3.1.0:

Undefined symbols for architecture i386:
"OBJC_CLASS$_CATransaction", referenced from:
objc-class-ref in CDVBarcodeScanner.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Uncaught TypeError: Cannot read property 'barcodeScanner' of undefined

I added the files using plugman as described in the Android README. It installed it without any errors, but it doesn't work:
Uncaught TypeError: Cannot read property 'barcodeScanner' of undefined
Here is how I call it:

window.plugins.barcodeScanner.scan(function(result) { ... });

Is it possible that I forgot something?

Running Cordova 3.1, Android 4.2

Intent clash with PhoneGap apps

The problem is the scan intent name is the same for all applications built with PhoneGap.

Reproducing:

  1. Build and install app on Android.
  2. Build and install different app (with different id in widget id) on the same device.
  3. Scan code.

Result:
Android will show a menu to choose application. This might be confusing to the user. Not a big issue if all apps use the same version of the plugin and phonegap. If apps use different versions and the user choose default action then every other app will fail.

Two places need changing:

  1. In plugin.xml:
    <action android:name="com.phonegap.plugins.barcodescanner.SCAN"/>
  2. In BarcodeScanner.java:
    SCAN_INTENT = "com.phonegap.plugins.barcodescanner.SCAN";

Problem is both should be changed to add application (widget) id. Not sure if plugman allows this.

BarcodeScanner Android 4.1.2

Hello... I'm using the phonegap build with BarcodeScanner plugin.
But I'm very worried about using this plugin.
I did some tests on Android version 4.1.2
But the app crashes with the message: "Sorry, the Android camera encountered a problem. You may need to restart the device"
I tried to capture the error using try/catch and then asking for the code to the user. But the app crashes anyway. Any suggestions? Here is my code:
I'm worried because I need to deliver the app on this week

config.xml (gap:plugin name="com.phonegap.plugins.barcodescanner" version="0.6.0")

try {
var scanner = cordova.require("cordova/plugin/BarcodeScanner");
scanner.scan( function (result) {
if (result.cancelled==true)
{
return;
}
codigo_lido = result.text;
alert(codigo_lido);

    }, function (error) 
    {
                        AskUser();
    });

} catch (ex)
{
AskUser();
}

barcodescanner does not work

Hello,

newbie to phonegap.
I am using phonegap version 3.1.0-0.15.0.
I have the following plugins installed:

[phonegap] com.phonegap.plugins.barcodescanner
[phonegap] org.apache.cordova.core.camera
[phonegap] org.apache.cordova.core.device
[phonegap] org.apache.cordova.core.dialogs
[phonegap] org.apache.cordova.core.file
[phonegap] org.apache.cordova.core.file-transfer
[phonegap] org.apache.cordova.core.inappbrowser
[phonegap] org.apache.cordova.core.network-information

I copied the barcodescanner.js file into the www folder in which the index.html resides.

config.xml:
<gap:plugin name="com.phonegap.plugins.barcodescanner" />

index.html:
right after the body tag:
<script type="text/javascript" src="jquery-1.8.3.js"></script>
<script type="text/javascript" src="jquery.mobile-1.3.2.js"></script>
<script type="text/javascript" src="phonegap.js"></script>
<script type="text/javascript" src="barcodescanner.js"></script>
at bottom, right before
"app.initialize();
<script type="text/javascript" src="index.js"></script>

index.js:
var barCodeScanner = cordova.plugins.barcodeScanner;

the function calling the scan (if it would load):

function scanBarCodeNow() {
if (ALerror) console.error('scanBarCodeNow: ');
barCodeScanner.scan(
function (result) {
if (ALerror) console.error('scanBarCodeNow in plugin function: ');
alert("We got a barcode\n" +
"Result: " + result.text + "\n" +
"Fomat: " + result.format + "\n" +
"Cancelled: " + result.cancelled);
},
function (error) {
alert("Scanning failed: " + error);
}
);
};

And finally the error I am seeing:

10-12 15:20:59.745: E/Web Console(12710): Uncaught ReferenceError: module is not defined at file:///android_asset/www/barcodescanner.js:86
10-12 15:20:59.784: E/Web Console(12710): Uncaught TypeError: Cannot read property 'barcodeScanner' of undefined at file:///android_asset/www/index.js:27

I would expect that it is a detail that I am missing, so any pointers would be appreciated.

Thanks a bunch.

Use alternate overlay

The original plugin had the option to use an alternate overlay during scan. Could this be achieved somehow in 3.0.0?

BarcodeScanner and InAppBrowser clash

Hi

Just after scanning a barcode tag I cannot open the Phonegap InAppBrowser via the callback function. It only works after setting a sleep break with around 400 ms. By any chance you know what could cause this behaviour?

Regards,
Mat

Scanner appears to "freeze".

I managed to get the plugin installed on PhoneGap 3.0.0, using plugman. I'm using XCode 4.6.1. My device is an iPhone 4S, running 6.1.3.

When the scanner starts on my device (obviously not the sim, since the sim doesn't emulate capture), it looks like it takes a single still, and then "freezes". The "Cancel" button works, but the scanner doesn't appear to be doing anything.

I see these errors:

WARNING: -[<AVCaptureVideoPreviewLayer: 0x210963b0> isOrientationSupported] is deprecated.  Please use AVCaptureConnection's -isVideoOrientationSupported
WARNING: -[<AVCaptureVideoPreviewLayer: 0x210963b0> setOrientation:] is deprecated.  Please use AVCaptureConnection's -setVideoOrientation:
WARNING: -[<AVCaptureVideoPreviewLayer: 0x210963b0> setOrientation:] is deprecated.  Please use AVCaptureConnection's -setVideoOrientation:
Warning: Attempt to present <CDVbcsViewController: 0x2108fa90> on <MainViewController: 0x1fd6ff90> while a presentation is in progress!
Warning: Attempt to present <CDVbcsViewController: 0x210b15b0> on <MainViewController: 0x1fd6ff90> whose view is not in the window hierarchy!
Warning: Attempt to present <CDVbcsViewController: 0x210b27b0> on <MainViewController: 0x1fd6ff90> whose view is not in the window hierarchy!

Is there something I can do to get this working? The code itself is entirely vanilla.:

        var scanner = cordova.require("cordova/plugin/BarcodeScanner");

        //cordova.plugin.barcodeScanner.scan(
        scanner.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);
          }

I appreciate anyone taking the time to look at this, and I'm happy to provide more info as necessary.

Restrict scan to specific bar-code type

In an application I'm developing, I'm only interested in reading qr-codes. I suppose it is common that one particular app only reads one kind of codes.

The problem is that I could not find any way of restricting scanning to a specific code type, and thus had to do a unrestricted scan.

In my setup, it happens that qr-codes are wrongly interpreted as 1d codes. The code scan is obviously wrong.

To avoid such wrong scans, it should be possible to restrict scans to specific code types, upon service launch.

EAN13 Barcode only works in Portrait

On iPhone iOS6.0 the scanning of the ean13 barcode only works in portrait mode. The red line has to be vertical, which is kind of unintuitive.

Android:Scanning area really small

I am using the plugin from within PhoneGap build.

The plugin works fine, only the scanning area is REALLY small.
It's only a small part of the total screen.
This makes it hard to scan larger barcodes.

Is there a way to config the size of the scanning area within PhoneGap build?

Call to unknown plugin: BarcodeScanner

Hi,

With the help of Eccenux I was able to install the plugin and to build an APK.
But when I deploy and I launch the scan, I have an error :
Scanning failed: Class not found.

And when I open DDMS, I have the following problem :
"exec() call to unknown plugin barcodescanner"

Is it a problem of dependencies of the plugin ?

Build fails using cordova build

Doing

cordova plugin add ../BarcodeScanner
cordova prepare
cordova build android

Fails with:

[buildconfig] No need to generate new BuildConfig.

-pre-compile:

-compile:
    [javac] Compiling 3 source files to /home/jose/phonegap-nfc-test/platforms/android/bin/classes
    [javac] /home/jose/phonegap-nfc-test/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:19: cannot find symbol
    [javac] symbol  : class Plugin
    [javac] location: package org.apache.cordova.api
    [javac] import org.apache.cordova.api.Plugin;
    [javac]                              ^
    [javac] /home/jose/phonegap-nfc-test/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:25: cannot find symbol
    [javac] symbol: class Plugin
    [javac] public class BarcodeScanner extends Plugin {
    [javac]                                     ^
    [javac] /home/jose/phonegap-nfc-test/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:101: cannot find symbol
    [javac] symbol  : class Plugin
    [javac] location: class com.phonegap.plugins.barcodescanner.BarcodeScanner
    [javac]         this.cordova.startActivityForResult((Plugin) this, intentScan, REQUEST_CODE);
    [javac]                                              ^
    [javac] /home/jose/phonegap-nfc-test/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:101: cannot find symbol
    [javac] symbol  : variable cordova
    [javac] location: class com.phonegap.plugins.barcodescanner.BarcodeScanner
    [javac]         this.cordova.startActivityForResult((Plugin) this, intentScan, REQUEST_CODE);
    [javac]             ^
    [javac] /home/jose/phonegap-nfc-test/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:123: cannot find symbol
    [javac] symbol  : method success(org.apache.cordova.api.PluginResult,java.lang.String)
    [javac] location: class com.phonegap.plugins.barcodescanner.BarcodeScanner
    [javac]                 this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
    [javac]                     ^
    [javac] /home/jose/phonegap-nfc-test/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:133: cannot find symbol
    [javac] symbol  : method success(org.apache.cordova.api.PluginResult,java.lang.String)
    [javac] location: class com.phonegap.plugins.barcodescanner.BarcodeScanner
    [javac]                 this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback);
    [javac]                     ^
    [javac] /home/jose/phonegap-nfc-test/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:135: cannot find symbol
    [javac] symbol  : method error(org.apache.cordova.api.PluginResult,java.lang.String)
    [javac] location: class com.phonegap.plugins.barcodescanner.BarcodeScanner
    [javac]                 this.error(new PluginResult(PluginResult.Status.ERROR), this.callback);
    [javac]                     ^
    [javac] /home/jose/phonegap-nfc-test/platforms/android/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java:150: cannot find symbol
    [javac] symbol  : variable cordova
    [javac] location: class com.phonegap.plugins.barcodescanner.BarcodeScanner
    [javac]         this.cordova.getActivity().startActivity(intentEncode);
    [javac]             ^
    [javac] 8 errors

BUILD FAILED
/home/jose/adt-bundle-linux-x86_64-20130219/sdk/tools/ant/build.xml:713: The following error occurred while executing this line:
/home/jose/adt-bundle-linux-x86_64-20130219/sdk/tools/ant/build.xml:727: Compile failed; see the compiler error output for details.

Total time: 5 seconds
]

Modify CaptureActivity scanner project (Android)

Since PhoneGap release 3.0, the CLI process of adding plugins is easier but it created one problem: You are not able to modify the plugins anymore. On previous versions you would have a library project on Eclipse where you would use on your android project. Now you just use a .jar file of CaptureActivity. How can I modify that jar file? I tried recreating it, but it does not work. Anyone has already tried to do it?

PGB Crash

Appears to only happen on Android.

Steps to Reproduce:

  1. Open app and start scanner, point it at a white piece of paper so that the red scanner line does not show, but the app scanner window remains open.
  2. After X (10-20) amount of seconds, the scanner windows closes and the app redirects back to a blank black page.
  3. Then crashes with "Unfortunately [App Name] Has Closed Unexpectedly."

Related Link:
http://community.phonegap.com/nitobi/topics/barcodescanner_crashes_app_after_2_uses

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.