Rectangle 27 1

Add the line:

<plugin name="BarcodeScanner" value="com.phonegap.plugins.barcodescanner.BarcodeScanner"/>

I am sure I did that already. I also add the following permission to the AndroidManifest.xml: <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.FLASHLIGHT" />

cordova - Cannot use the PhoneGap barcode scanner plugin in Android - ...

android cordova phonegap-plugins
Rectangle 27 159

An example via Matt Cutts -- "heres a barcode scanner written in six lines of Python code:

import android
droid = android.Android()
code = droid.scanBarcode()
isbn = int(code['result']['SCAN_RESULT'])
url = "" % isbn
droid.startActivity('android.intent.action.VIEW', url)

s/YES/meh. maybe/'s extremely limited. anything graphical or multi touch? a big NO.

@gcb you can't use the normal android widget set, but you can use "webviews" (which is what the native gmail application uses, for example).

import android as a;d=a.Android();d.startActivity('android.intent.action.VIEW',""%int(d.scanBarcode()['result']['SCAN_RESULT']))

@gdw2, surely the native Gmail app only uses WebViews to parse emails though, not for the actual UI. That makes the comparison a bit absurd.

This is SL4A (Scripting Layer for Android), formerly known as Android Scripting Environment (ASE), and mentioned in several other answers.

Is there a way to run Python on Android? - Stack Overflow

android python jython ase android-scripting
Rectangle 27 3

I think the question here concerns Barcode Scanner, rather than Android. Barcode Scanner (I'm a developer) parses all these fields. The issue is that the Android 1.x APIs do not let you specify all of the information you want to here as separate fields. Android 2.x does, to a much greater degree. Barcode Scanner must remain compatible with 1.5 for the moment since a small fraction of its users are still on 1.5 -- small fraction, but of 10 million people, so we can't just dump them.

It's conceivable, though quite painful, to write a version that uses one or the other API while still being 1.5-friendly.

Instead there is already a version that requires Android 2.2 and uses newer APIs. It's not going to be released for some time (see above) but you can give it a shot here:

If I might impose on your patience a little: it seems that you are saying that the communication between the barcode scanner and the OS is not a simple Intent registration (on "VCARD:"). It seems that you are saying that Barcode Scanner parses the text, determines the format, and explicitly picks which applications it thinks that format might be sent to (e.g. contacts, email, etc.). Is this correct?

The debug apk fails to install. I havea 2.2 on a Motorola Droid 1 and have allowed applications from unknown sources (as well as debugging and mock sources). Where should I look for more information? Thanks

You have to uninstall the Market version to install my debug version. They're signed with different certificates.

It is done with an Intent. The Intent does not support these fine-grained fields even in 2.x. It's possible to write code that writes the contact directly and sets these fields individually. However I like the idea of letting the user's preferred app take over this process before saving the contact.

android - QR Code import of vCard does not separate fields. Is it the ...

android qr-code vcard
Rectangle 27 5

If support for the iPad 2 or iPod Touch is important for your application, I'd choose a barcode scanner SDK that can decode barcodes in blurry images, such as our Scandit barcode scanner SDK for iOS and Android. Decoding blurry barcode images is also helpful on phones with autofocus cameras because the user does not have to wait for the autofocus to kick in.

Scandit comes with a free community price plan and also has a product API that makes it easy to convert barcode numbers into product names.

(Disclaimer: I'm a co-founder of Scandit)

iphone - How can I scan barcodes on iOS? - Stack Overflow

ios iphone ipad cocoa-touch barcode
Rectangle 27 4

I finally received a functional response from the Honeywell support:

I suspect that the application wants to receive the data as Keydown / Keyup events.

Can you please test the following?

On Wedge as Keys set: 9,10,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127

As it might take 15 minutes to do it manually, I have created this code that you can read inside the Wedge as keys field:

After reading the code please wait 10 seconds before saving and check if the data is correctly saved into that field by exiting and reentering the Scanner settings.

Finally, disable and re-enable the scanner (or reboot the device).

The terminal must use the latest version of the system to see the "Wedge as keys" field. Don't forget to set "\n" as suffix.

var BarcodesScanner = {
    barcodeData: '',
    deviceId: '',
    symbology: '',
    timestamp: 0,
    dataLength: 0

function onScannerNavigate(barcodeData, deviceId, symbology, timestamp, dataLength){
    BarcodesScanner.barcodeData = barcodeData;
    BarcodesScanner.deviceId = deviceId;
    BarcodesScanner.symbology = symbology;
    BarcodesScanner.timestamp = timestamp;
    BarcodesScanner.dataLength = dataLength;

BarcodesScanner.tmpTimestamp = 0;
BarcodesScanner.tmpData = '';
$(document).on('keypress', function(e){
    var keycode = (e.keyCode ? e.keyCode : e.which);
    if (BarcodesScanner.tmpTimestamp < - 500){
        BarcodesScanner.tmpData = '';
        BarcodesScanner.tmpTimestamp =;
    if (keycode == 13 && BarcodesScanner.tmpData.length > 0){
        onScannerNavigate(BarcodesScanner.tmpData, 'FAKE_SCANNER', 'WEDGE', BarcodesScanner.tmpTimestamp, BarcodesScanner.tmpData.length);
        BarcodesScanner.tmpTimestamp = 0;
        BarcodesScanner.tmpData = '';
    } else if (e.charCode && e.charCode > 0) {
        BarcodesScanner.tmpData += String.fromCharCode(e.charCode);

Now, you could listen the scanning event:

$(BarcodesScanner).on('scan', function(e){

Thank you for sharing, this is great stuff and I was looking into the very same thing. Hower, in my application the keyboard shows up each time I do a scan. Does this happen to you too? any advice on how to get rid of it?

Normally, the keyboard shows up only on input fields, so are you using the capture solution exposed in this answer or the text field buffer from the edit of the original question ? You can deactivate it with app like Null Keyboard ( ). What's your device ?

For Dolphin 75e users without the "Wedge as keys" option, you will need to contact Honeywell support to obtain the latest firmware, as it is not available on their website due to licensing issues. The relevant file is

android - Capture barcode reader (keyboard-wedge) events from javascri...

javascript android barcode-scanner honeywell keyboard-wedge
Rectangle 27 3

For what it's worth, I see a lot of errors from within the Android HTTP library. From Barcode Scanner I get stack traces from across about 35M people, and so I think I've seen one of everything. Here's all the weird stuff we just catch and swallow in the app, below. I recommend you work around it as a platform bug and fail gracefully.

private static int safelyConnect(String uri, HttpURLConnection connection) throws IOException {
    try {
    } catch (NullPointerException npe) {
      // this is an Android bug:
      Log.w(TAG, "Bad URI? " + uri);
      throw new IOException(npe.toString());
    } catch (IllegalArgumentException iae) {
      // Also seen this in the wild, not sure what to make of it. Probably a bad URL
      Log.w(TAG, "Bad URI? " + uri);
      throw new IOException(iae.toString());
    } catch (SecurityException se) {
      // due to bad VPN settings?
      Log.w(TAG, "Restricted URI? " + uri);
      throw new IOException(se.toString());
    } catch (IndexOutOfBoundsException ioobe) {
      // Another Android problem?!topic/google-admob-ads-sdk/U-WfmYa9or0
      Log.w(TAG, "Bad URI? " + uri);
      throw new IOException(ioobe.toString());
    try {
      return connection.getResponseCode();
    } catch (NullPointerException npe) {
      // this is maybe this Android bug:
      Log.w(TAG, "Bad URI? " + uri);
      throw new IOException(npe.toString());
    } catch (NumberFormatException nfe) {
      // Again seen this in the wild for bad header fields in the server response!
      Log.w(TAG, "Bad server status? " + uri);
      throw new IOException(nfe.toString());

There are many similar issues. I'm just suggesting that it is not something your app has done wrong. In that case there's not much to do except work around it gracefully.

I have different stack trace than I think it is something to do with https connection or amazons host url. Also openConnection() call succeeds but getInputStream() fails

Android HttpUrlConnection getInputStream throws NullPointerException -...

android nullpointerexception inputstream httpurlconnection
Rectangle 27 1

And are you using JQuery mobile or normal?

I'm using JQuery normal. I can capture barcode events as 'input' events on text fields, but not on the body.

I have 2 scanners on my desk (2d/barcode and credit card), developing couple of pages for kiosk. Your code works for both of them on my win7+chrome. I tried document.addEventListener("tap", function(e){alert(e)}); on my SG s5 - works ok. The android keyboard events (document.addEventListener("keydown",...)) is captured as well although I subscribed to document. I would try to connect bluetooth keyboard just to check if you can capture that, so it would mean scanner works not as keyboard.

The scanner works as a keyboard only when an input field has the focus.

android - Capture barcode reader (keyboard-wedge) events from javascri...

javascript android barcode-scanner honeywell keyboard-wedge
Rectangle 27 1

I'd look at some projects that do not have the problem, see how they define things in their manifest and string resources, and try to match them. Barcode Scanner (ZXing) is one such app. This sample app from one of my books also successfully has its two-word name split over two lines.

So your sample app just has a space in it, which strangely doesn't work for me. My app name looks like this: "12345678901 1234" so 11 characters in the first word and 4 characters in the second, separated by a space. I'm starting to wonder if this is some sort of Android bug.

It is very possible. I am surprised the 11 characters fit on one line -- StreamFurious, for example, gets that split over two lines even before any other words enter the picture.

Well, the 11th character of the first word gets cut off, but I don't care about that. Interesting that you mention StreamFurious. It doesn't split on two lines on my phone, just shows up as StreamFuri. I have a G1 running 1.6 What do you have?

Barcode Scanner doesn't have two lines on my Htc Magic though? Its scrolling through the one-line name.

android - Display app name on two lines below the app icon - Stack Ove...

android android-manifest
Rectangle 27 10

Ensure the assignment runs in Angulars zone:

import {Component, Input} from 'angular2/core';


constructor(public _viewCtrl: ViewController, _platform: Platform, private zone:NgZone){ ... }

... => this.barcode = result.text;);

I'm using this technique, but I can't help but asking if Angular does this automatically why do I need to do this? I mean half of the places it's working and half of the places it's not. Shall I wrap every assignment that needs to be reflected in view with this piece of code?

Angular uses zone.js to patch async calls like setTimeout and addEventListener to know when "something" happened and run change detection afterwards. If you interact (for example pass callbacks) with code that runs outside Angulars zone because the code was initialized outside your Angular application or because it uses some async API that is not covered by zone.js, then Angular doesn't get notified when "something" happenend and doesn't run change detection. With you "force" execution back into Angulars zone to get change detection executed.

typescript - Angular 2 + Ionic 2 + Barcode Scanner DOM not updating on...

typescript angular cordova-plugins ionic2
Rectangle 27 8

Add the following libraries to your Xcode project:

Select your target, and then display the Build Phases. Under Link Binary With Libraries, click the add button and then select the frameworks above.

Sign up for our newsletter and get our top new questions delivered to your inbox (see an example).

PhoneGap/Cordova Barcodescanner plugin for iPhone/iOS - Stack Overflow

ios cordova phonegap-plugins barcode
Rectangle 27 1

If you are using the iOS Simulator you can't test this plugin because the simulator does not support the camera. So you need to use a real device to test you app.

angular.module('starter.controllers', ['ngCordova'])

.controller('AppCtrl', function($scope, $ionicModal, $timeout, $stateParams, $http, $cordovaBarcodeScanner) {

  $scope.scanBarcode = function(){
    $cordovaBarcodeScanner.scan().then(function(barcodeData) {
      // Success! Barcode data is here
      alert('barcode scanned:' +  barcodeData.text);
    }, function(error) {
      // An error occurred

    <ion-item ng-click="scanBarcode()">
      Scan Barcode

I just tested it on my iphone 5S, it did not work..Can i debug the code while running on iphone to see what the errors are... works now..appreciate your help. I have one question. my hybrid ios app talks to java library which inturn gets data from mongoDB or some other REST service.. What is the best cloud service to host my java app and db.

cordova ionic barcode scanner error - Stack Overflow

cordova ionic-framework barcode-scanner
Rectangle 27 5

Safari for iOS doesn't trigger keyboard events on DOM elements that are not components of a form. This includes the document and body which are usually used to capture keystrokes anywhere on the page.

The only way to trigger a keystroke event on document or body of a page is to trigger it in an input or textarea. In that case, the event will correctly 'bubble' to the body and document.

However, this might be a problem because Safari for iOS doesn't allow us to give an element focus from javascript.

At the moment, we are using a solution where user has to click on an input field before starting the first scan, and the input field is then moved off-screen but retains focus.

If someone has a better solution, please share.

You can wrap the web app in phonegap and use this approach:

php - How can I add a Javascript listener to capture input from blueto...

javascript php jquery ipad barcode-scanner
Rectangle 27 1

It seems that your scanner is set to the wrong mode, which adds those suffixes to the bar codes.

For instance, you can program the Honeywell Genesis 7580g scanner in such a way, that it will add different suffixes to the barcodes, depending on the symbology. It's up to you, to add or not to add. But. You can set up the scanner interface so that it will add that suffixes no matter whether you want it or not.

That's what the "USB IBM SurePos" interface of the Genesis 7580g scanner will do. (AKA "USB Handheld Scanner - PAPSPH" command and "USB Tabletop Scanner - PAPSPT" command)

Each [command] bar code also programs the following suffixes for each symbology:

Symbology        Suffix
EAN 8            0C (decimal 12)
EAN 13           16 (decimal 22)
UPC A            0D
UPC E            0A

and so on for Code 39, Code 128 and Interleaved 2 of 5 symbologies. And it looks just like your case.

All you need if you had my scanner is to program just "USB HID" interface (command PAP131) instead of "USB IBM SurePos" interface (commands PAPSPH or PAPSPT).

C# read USB HID from BarCode Scanner - Stack Overflow

c# usb barcode hid
Rectangle 27 4

I use ZBar library but if you want you can change implementation to ZXingScannerView (the rest of the code is ok):

public class ZXingScannerView extends ScannerView {
public interface ResultHandler {
    public void handleResult(Result result);

private MultiFormatReader mMultiFormatReader;
private ResultHandler mResultHandler;

public ZXingScannerView(Context context) {

public ZXingScannerView(Context context, AttributeSet attributeSet) {
    super(context, attributeSet);

 * Specify recognized codes types.
 * @param codeTypes list of codes types from ZXing library
public void setCodeTypes(List<> codeTypes) {

private void setupScanner(List<> symbols) {
    Map<DecodeHintType,Object> hints = new EnumMap<DecodeHintType,Object>(DecodeHintType.class);
    // Add specific formats
    hints.put(DecodeHintType.POSSIBLE_FORMATS, symbols);
    mMultiFormatReader = new MultiFormatReader();

 * Register callback in order to receive data from scanner.
 * @param resultHandler
public void setResultHandler(ResultHandler resultHandler) {
    mResultHandler = resultHandler;

public void onPreviewFrame(byte[] data, Camera camera) {
    Camera.Parameters parameters = camera.getParameters();
    Camera.Size size = parameters.getPreviewSize();
    int width = size.width;
    int height = size.height;

    Result rawResult = null;
    PlanarYUVLuminanceSource source = buildLuminanceSource(data, width, height);

    if(source != null) {
        BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
        try {
            rawResult = mMultiFormatReader.decodeWithState(bitmap);
        } catch (ReaderException re) {

        } catch (NullPointerException npe) {

        } catch (ArrayIndexOutOfBoundsException aoe) {

        } finally {

    if (rawResult != null) {
        if(mResultHandler != null) {
    } else {

public PlanarYUVLuminanceSource buildLuminanceSource(byte[] data, int width, int height) {
    Rect rect = getFramingRectInPreview(width, height);
    if (rect == null) {
        return null;
    // Go ahead and assume it's YUV rather than die.
    PlanarYUVLuminanceSource source = null;

    try {
        source = new PlanarYUVLuminanceSource(data, width, height, rect.left,,
                rect.width(), rect.height(), false);
    } catch(Exception e) {

    return source;

How to decode a barcode from camera preview using zxing library in and...

android barcode zxing
Rectangle 27 1

If your barcode scanner is a keyboard wedge, you should be able to configure the trailing character to a TAB.

It seems like, by default, your scanner is trailing with an ENTER (carriage return).

Another option would be to also check for a LF (decimal 10) in your javascript code.

javascript - Changing focus from one input to the next with a barcode ...

javascript jquery barcode-scanner
Rectangle 27 1

You need to return false in order to prevent the enter key from submitting the form.

//Press Enter in INPUT moves cursor to next INPUT
    if ( e.which == 13 ) // Enter key = keycode 13
        $(this).next().focus();  //Use whatever selector necessary to focus the 'next' input
        return false;

I have tried to implement this as follows: $('#barcode1').find('input').keypress(function(e){ if ( e.which == 13 ) // Enter key = keycode 13 { $(this).next('input').focus(); return false; } }); It is successful in that it prevents the 'enter' from submitting the form, but focus does not pass to the next input. I have also tried selecting the .bcode class with next(), but it also does not seem to transfer focus.

There must be something with the way you are selecting it then. I'll check when I get home.

Someone with more jquery experience than I can explain why, but this seems to work:

As far as I know, next should select the next sibling with the selector you pass it, so passing just '.bcode' should select the next input you have...

That does work, thanks. I was surprised to see that there had to be two next() methods, one for label and one for input. It seems to suggest that label and input are not seen as siblings then - or something to that effect.

javascript - Changing focus from one input to the next with a barcode ...

javascript jquery barcode-scanner
Rectangle 27 1


To represent a new line for each \n character, you'll have to replace it with the Windows representation of a new line.

var input = GetInputFromScanner();
var cleanInput = input.Replace("\n", Environment.NewLine);
// Assign "cleanInput" to your "TextBox" instance

c# - text from barcode scanner being filtered out when entered into UW...

c# textbox uwp barcode-scanner
Rectangle 27 3

This is confused, and the approach you have accepted is harmful.

First, please do not copy our app wholesale, as we have repeatedly stressed here. It is not only discouraged, but violates our trademark if you clone the UI. Just don't do it.

Second, you are copying our code, but then are trying to use a scanner by Intent. Why? If you want to use Intents, you don't need to use any code.

Third, you are declaring your app to respond to our app Intent. You are intercepting calls intended for Barcode Scanner. If you can reply in exactly the same way, OK, but, I imagine you are not guaranteeing this. By doing so you're harming users of Barcode Scanner, the open source project you're profiting from.

android - Integrate ZXing without the use of a 3rd party scanner? - St...

android zxing
Rectangle 27 1

So, whoever do not want to use neither the app or the intent call can use one more activity provided in the library called CaptureActivity

Intent intent = new Intent(MyActivity.this, CaptureActivity.class);
    startActivityForResult(intent, 1);

This class is present in android folder of Zxing library which you have downloaded. Importing this android project into your application will integrate the Zxing library. Be careful about package names while importing.

It is very important to add core.jar or else you will be ending up with lot of errors.

Decoding bitmap using Zxing library in android - Stack Overflow

android zxing barcode-scanner
Rectangle 27 1

On my Symbol Tech barcode scanner, characters are sent as key strokes. For example, the group separator will emulate holding down the left_control key and then sending a right bracket. Your browser will handle the simulated key strokes as if you were trying to use CTRL+] as a shortcut.

javascript - Scanning a barcode with an ASCII control character into a...

javascript html ascii barcode