Android - Barcode Scanning, Options? Zxing?

后端 未结 6 1984
北恋
北恋 2020-12-14 02:18

I want to create an application for Android that will be able to scan barcodes, get the information contained within the barcode and then be able to use that information in

相关标签:
6条回答
  • 2020-12-14 02:42

    I'd suggest you use Zxing through intents and redirect to Android Market page ("market://details?id=com.google.zxing.client.android") if it's not there (catching ActivityNotFoundException). Intents are great for inter-app communications like this.

    0 讨论(0)
  • 2020-12-14 02:45

    I have it working with this:

    repositories { mavenCentral()
        maven { url "https://raw.github.com/embarkmobile/zxing-android-minimal/mvn-repo/maven-repository/" }
    }
    
    compile 'com.google.zxing:core:3.2.1'
    compile 'com.embarkmobile:zxing-android-minimal:2.0.0@aar'
    compile 'com.embarkmobile:zxing-android-integration:2.0.0@aar'
    

    I recommend using the IntentIntegrator

    IntentIntegrator integrator = new IntentIntegrator(getActivity()); 
    integrator.forSupportFragment(this).initiateScan();
    

    The requestCode comes back with

    IntentIntegrator.REQUEST_CODE
    

    No need to install a separate scanner

    0 讨论(0)
  • 2020-12-14 02:48

    I recommend to use google barcode scan. It is pretty responsive. It is called Google Mobile Vision.

    The Barcode Scanner API detects barcodes in real time in any orientation. You can also detect and parse several barcodes in different formats at the same time.

    https://developers.google.com/vision/

    https://codelabs.developers.google.com/codelabs/bar-codes/#0

    0 讨论(0)
  • 2020-12-14 02:57

    Developer here. I think you're going to want to just integrate via Intent in the end. You get the improvements, bug fixes, and platform-specific workarounds for free. It's much less code too. But I understand you're asking for an alternative.

    You probably want to strip down Barcode Scanner (whose source is in android/ in the project) and strip out everything you don't need. That means leave only about the com.google.zxing.client.android and com.google.zxing.client.android.camera packages. The core decoding is in DecodeThread, but the other code in these packages implements the little callback dance that does the continuous scanning and gets the usual scanning UI.

    If you embed the code you need to follow the terms of the Apache License.

    0 讨论(0)
  • 2020-12-14 03:02

    Check out the new Google Play Services 7.8 API that includes Barcode tracking: https://developers.google.com/vision/barcodes-overview

    0 讨论(0)
  • 2020-12-14 03:08

    Download and extend the Zxing "Barcode Scanner" app by adding your own code. It's under an Apache 2.0 License.

    0 讨论(0)
提交回复
热议问题