Giter VIP home page Giter VIP logo

cordova-barcodescanner-plugin's Introduction

BarcodeScanner

DISCONTINUED

If anybody wants to takeover the project feel free to contact me

Greenkeeper badge Build Status Build status Bountysource

cross-platform barcode scanner for cordova

Plugin is still WIP

NPM

Feel free to donate

Click here to lend your support and make a donation at www.pledgie.com ! Or donate Bitcoins: bitcoin:3NKtxw1SRYgess5ev4Ri54GekoAgkR213D

Bitcoin

Also via greenaddress

Supported Platforms

  • Android
  • iOS
  • Windows 8
  • Windows Phone 8

Installation

cordova plugin add cordova-plugin-barcodescanner

Or if you want to use the development version (nightly build), which maybe not stable!:

cordova plugin add cordova-plugin-barcodescanner@next

On Android you have to the following entry to config.xml

<config-file target="AndroidManifest.xml" parent="/*" mode="merge">
    <uses-permission android:name="android.permission.CAMERA" />
    <uses-feature android:name="android.hardware.camera" />
    <uses-feature android:name="android.hardware.camera.autofocus" />
</config-file>

Development

Running integration tests

execute the runIntegrationTests.sh script for a specific platform:

PLATFORM='android' ./runIntegrationTests.sh
PLATFORM='ios' ./runIntegrationTests.sh

Details

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

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 window.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(BarcodeScanner.Encode.TEXT_TYPE, "http://www.nytimes.com", function(success) {
            alert("encode success: " + success);
          }, function(fail) {
            alert("encoding failed: " + fail);
          }
        );

Windows8 quirks

Windows 8 implenemtation currently doesn't support encode functionality.

Windows Phone 8 quirks

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

Licence

The MIT License

Copyright (c) 2010 Matt Kane

Copyright (c) 2015 Martin Reinhardt

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.

cordova-barcodescanner-plugin's People

Contributors

agrieve avatar cfjedimaster avatar eccenux avatar emarashliev avatar filmaj avatar goya avatar greenkeeper[bot] avatar hypery2k avatar jaysonraymond avatar jgillich avatar orenagiv avatar purplecabbage avatar sgrebnov avatar stevengill 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cordova-barcodescanner-plugin's Issues

Browser support.

I've integrated QuaggaJS with cordova-barcodescanner-plugin for browser support of many barcode types (but not QR) and it works well. It's a WebRTC based "extension to ZXing" and "not yet another port of ZXing". It reads codes at weird angles! I've also integrated jsqrcode-edi9999 for WebRTC based QR code support and the browser platform, which is under Apache License 2.0.

The QuaggaJS license is MIT

What are the chances of having integrations like these added to the official cordova-barcodescanner-plugin so that it has support for browser platform instead of only a stub? I would like to be able to use the official plugin for hybrid applications.

Windows Phone 8.1 - Plugin Not Working (Phonegap Build)

Hi,

I've been using the plugin for a while on Android and iOS and the plugin has worked brilliantly. However I have noticed on Windows the scanner just doesn't work. The scanner does not appear and literally does nothing.. I have a onclick method which produces the scanner and uses the following:

cordova.plugins.barcodeScanner.scan(
function (result) {
alert("We got a barcode\n" +
"Result: " + result.text)
//"Format: " + result.format + "\n" +
//"Cancelled: " + result.cancelled)
{dialog.Object}.setValue('QRCode', result.text);
},
function (error) {
alert("Scanning failed: " + error);
}
);

Could anyone help?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38181819-windows-phone-8-1-plugin-not-working-phonegap-build?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github).

Build doesn't work after installing

Here is my process:

install:
cordova plugin add cordova-plugin-barcodescanner

add to config.xml:

 <config-file mode="merge" parent="/*" target="AndroidManifest.xml">
        <uses-permission android:name="android.permission.CAMERA" />
        <uses-feature android:name="android.hardware.camera" />
        <uses-feature android:name="android.hardware.camera.autofocus" />
    </config-file>

run:
cordova build android

Error:
Error: /Applications/MAMP/htdocs/hhFramework/app/platforms/android/gradlew: Command failed with exit code 1 Error output:
[Fatal Error] :12:352: The value of the attribute "prefix="xmlns",localpart="android",rawname="xmlns:android"" is invalid. Prefixed namespace bindings may not be empty.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring root project 'android'.

Exception while parsing the supplied manifest file /Applications/MAMP/htdocs/hhFramework/app/platforms/android/AndroidManifest.xml

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

barcode scanner window goes to top right in portrait mode

The camera orientation in Android phone is not correct for portrait scanning.
The camera is in portrait, but other things in pic like number 037 is rotated.
On clicking scan button, the window in camera goes on top right side.

Text Box not Updating From the Result

Scan Result Not Updating the View.

<label class="item item-input"><input type="text" id="txtNo" placeholder="Slip No" ng-model="Selected.barcode" /> </label>

Inside a Function, i call this but it's not getting update

cordova.plugins.barcodeScanner.scan( function (result) { $scope.Selected.barcode = result.text; }, function (error) { alert("Scanning failed: " + error); } );

$scope.Selected.barcode get the result text value but don't update the view. It will update when do the second scan time. Please help. I have used without the plugin it's work perfectly , but when i try to update in barcodeScanner success it's not working.

Scanning in Series

Hi, I just want to make a suggestion and hope it makes it into the plugin. It would be great if there was a way to scan in series. For example, to be able to scan a barcode, or qr code, run the callback function but still keep the camera open and ready to scan the next barcode/qr code.

Prefixed namespace bindings may not be empty

The value of the attribute "prefix="xmlns",localpart="android",rawname="xmlns:android"" is invalid

cordova version 7.1.0 on android

<activity
    android:label="@string/share_name"
    android:name="com.google.zxing.client.android.encode.EncodeActivity"
    xmlns:android="" <-- here
>
<activity 
    android:label="@string/share_name"
    android:name="com.google.zxing.client.android.HelpActivity" 
    xmlns:android="" <-- and here
>
            <intent-filter>
                <action android:name="android.intent.action.VIEW" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>
        </activity>

Adding integration tests

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/12364215-adding-integration-tests?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github).

add this plugin ,I loss my config.xml

> cordova plugin add cordova-plugin-barcodescanner  
Installing "cordova-plugin-barcodescanner" for android
Installing "cordova-plugin-compat" for android
Plugin doesn't support this project's cordova-android version. cordova-android: 7.0.0, failed version requirement: 
      <6.3.0
Skipping 'cordova-plugin-compat' for android
Android Studio project detected
Adding cordova-plugin-barcodescanner to package.json
Saved plugin info for "cordova-plugin-barcodescanner" to config.xml

> cordova build android
cp: copyFileSync: could not write to dest file (code=ENOENT):/opt/RondafulPDA/platforms/android/res/xml/config.xml

Parsing /opt/RondafulPDA/platforms/android/res/xml/config.xml failed
(node:8297) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: ENOENT: no such file or directory, open '/opt/RondafulPDA/platforms/android/res/xml/config.xml'
(node:8297) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Install Problem

Hi,
when I try to install i get this error:

Fetching plugin "phonegap-plugin-barcodescanner@phonegap-plugin-barcodescanner" via npm
Error: Failed to fetch plugin phonegap-plugin-barcodescanner@phonegap-plugin-barcodescanner via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: No compatible version found: phonegap-plugin-barcodescanner@'phonegap-plugin-barcodescanner'
Valid install targets:
["3.0.0","3.0.1","3.1.0","3.1.1","3.1.2","4.0.0","4.0.1","4.0.2","4.1.0","5.0.0","5.0.1","6.0.0","6.0.1","6.0.2",
"6.0.3","6.0.4","6.0.5"]

I have cordova version 6.5.0. Is not possibile install this plugin?

Thanks

[Question] PDF417 iOS Support

I was wondering if there's any chance to implement this on iOS, and maybe if i can, help with this.

do you have any guidelines ?

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Once you have installed CI on this repository, you’ll need to re-trigger Greenkeeper’s initial Pull Request. To do this, please delete the greenkeeper/initial branch in this repository, and then remove and re-add this repository to the Greenkeeper integration’s white list on Github. You'll find this list on your repo or organiszation’s settings page, under Installed GitHub Apps.

Back button close the app only in the horizontal mode

Hi!
I use:

  • "cordova-plugin-barcodescanner": "^0.7.0"
  • "cordova-android": "^6.2.3"

When I tap on the back button and I have tablet in horizontal mode the app closes.
If I use tablet in vertical mode this trouble doesn't happen.

How can I solve?

Not support codova-android 6.3

I build on codovar-andoid 6.3 then plugin alert:
Plugin doesn't support this project's cordova-android version. cordova-android: 6.3.0, failed version requirement: <6.3.0 Skipping 'cordova-plugin-compat' for android Installing "cordova-plugin-compat" for android Plugin doesn't support this project's cordova-android version. cordova-android: 6.3.0, failed version requirement: <6.3.0 Skipping 'cordova-plugin-compat' for android Error: Cannot find plugin.xml for plugin "cordova-test-app". Please try adding it again.

and not success

Issue with camera on Android 6.1

I am using this plugin to for scanner, but while testing the app in Android 6.1 it displays an error "Sorry, the camera encountered a problem. You may need to restart the device". How can i overcome this issue.

Doesn't work with Phonegap Build

Hello,
I'm trying to use this plugin in my ionic project compiled with PhoneGap Build.

When i try to use barcode scanner on iOS devices, my app open barcode correctly but doesn't scan (capture) qrcode.

My config.xml declaration is
gap:plugin name="cordova-plugin-barcodescanner" source="npm"

and my test code is:
cordova.plugins.barcodeScanner.scan( function (result) { if(result.cancelled) return; alert(result.text); }, function (error) { alert("Error scan"); });

Have you notice of the same problem.

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/30947259-doesn-t-work-with-phonegap-build?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github).

Custom box image

The current overlay (green and red box) may not conform to some brands, and implies a vertical barcode (when my app, for example, will only use QR). Can you add a feature to entrust developers to create their own overlay images instead of the default box?

Update Barcode Library

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/29551662-update-barcode-library?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github).

Plugin resolves phone numbers

When I scan a barcode that appears to have a phone number, there's a popup resolving that phone number on Android 4.1 (at least). As indicated in a separate issue, no data is sent back to the app on Android 4.1, so these problems might be related.

As there are still lots of Android 4.x phones on the market, a fix is relevant.

Minimum required android and ios versions.

I have an app using the plugin cordova-plugin-BarcodeScanner version 6.0.8 of the plugin, and cordova 7.0.0.

I've tested the application in android (SDK 23) and ios (10.0).It works fine.
I am targeting to deploy the same in all android api's greater than 14 and ios 4.x and above.
I couldn't find any specifications regarding the same in any of the documentations.
I've to make sure the app works fine in all the target devices before deployment.Could someone help me with this.

Thanks.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Android build fails because of duplicate uses-feature on camera

The pulgin.xml file has a uses-feature android.hardware.camera.

That's fine but it seems that this causes a duplicate entry. Probably because there is some other plugin that does the same thing. Removing that line from the plugin.xml allowed the build to complete.

I don't know enough about plugin.xml to suggest a correct fix, or I would put in a PR myself. Sorry.

PDF417

Hi
Scanner works fine on most barcodes, except it does not recognise PDF417 barcodes. Any reason why?
Thank you

Android/Nexus 5X camera upside-down bug

Plugin v0.7.0 suffers this issue, as described detailed here: http://www.xda-developers.com/why-images-in-some-camera-apps-are-upside-down-on-the-nexus-5x/
Is there a plan to update the plugin using the up2date camera2 api / zxing lib version?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/29534647-android-nexus-5x-camera-upside-down-bug?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github).

Scan as "portrait" instead of "landscape"

Hi,

The scan screen is in landscape mode.

cordova-barcodescanner-plugin

Is it possible to add the option to toggle / set it to portrait mode?

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/31116010-scan-as-portrait-instead-of-landscape?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12908089&utm_medium=issues&utm_source=github).

Camera freezes on iOS

On certain situations the camera freezes on iOS when calling cordova.plugins.barcodeScanner.scan();
Particularly I'm having this issue when calling it from within an Ionic popup.
If I switch to front camera and back it's fixed, but it always opens freezed.

Doesn't ask for camera permission

iOS Log
2017-07-23 13:54:57.846573+0300 Walled[803:261402] [access] This app has crashed because it attempted to access privacy-sensitive data without a usage description. The app's Info.plist must contain an NSCameraUsageDescription key with a string value explaining to the user how the app uses this data.
(lldb)


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

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.