All Projects → ravi8x → Barcode Reader

ravi8x / Barcode Reader

Licence: bsd-3-clause
Android barcode reader using google vision library

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Barcode Reader

Zxing Barcode
A barcode scanner based on zxing for android
Stars: ✭ 206 (-26.69%)
Mutual labels:  barcode-scanner
smartscanner-core
ID scanning Android app and library. Supports MRZ, NFC, Barcodes, and ID PASS Lite cards.
Stars: ✭ 44 (-84.34%)
Mutual labels:  barcode-scanner
ai barcode
Barcode generation,Barcode scanning,qrcode,qrcode generation,qrcode creator,flutter barcode,flutter qrcode,support android iOS web platform
Stars: ✭ 99 (-64.77%)
Mutual labels:  barcode-scanner
Barcodescanner
Android手机客户端关于二维码扫描的源码,使用了zxing 3.1.1代码并对其进行了精简,支持低版本的sdk,实现了二维码和一维码的扫描、从图片解析一维码和二维码,闪光灯、调焦。。。
Stars: ✭ 246 (-12.46%)
Mutual labels:  barcode-scanner
android-zbar-sdk
🔗 android-zbar-sdk, provide jni source, so file and jar file used alone, gradle/maven remote dependencies.
Stars: ✭ 311 (+10.68%)
Mutual labels:  barcode-scanner
ZXingSample
Working sample app for a blog post on barcode scanning and generating with ZXing
Stars: ✭ 20 (-92.88%)
Mutual labels:  barcode-scanner
Flutter barcode scanner
Barcode scanner plugin for flutter. Supports barcode scanning for Android and iOS
Stars: ✭ 194 (-30.96%)
Mutual labels:  barcode-scanner
scannerX
ScannerX is a showcase app for demonstrating QR/Barcode scanning with CameraX and scanner libraries.
Stars: ✭ 54 (-80.78%)
Mutual labels:  barcode-scanner
barcode-server
Barcode Server for Barcode Client-Server android application
Stars: ✭ 40 (-85.77%)
Mutual labels:  barcode-scanner
pola-ios
Pola pomoże Ci odnaleźć polskie wyroby. Zabierając Polę na zakupy odnajdujesz produkty “z duszą” i wspierasz polską gospodarkę.
Stars: ✭ 17 (-93.95%)
Mutual labels:  barcode-scanner
barcode-detector
Spec compliant polyfill of the Barcode Detection API 🤳
Stars: ✭ 31 (-88.97%)
Mutual labels:  barcode-scanner
MlKitBarcodeScan
Sample project to explain the barcode scanning API from Firebase MLKit
Stars: ✭ 31 (-88.97%)
Mutual labels:  barcode-scanner
openfoodfacts-cordova-app
Open Food Facts mobile app, developed with Cordova, for iOS, Android, Windows Phone, FirefoxOS etc.
Stars: ✭ 24 (-91.46%)
Mutual labels:  barcode-scanner
React Native Barcode Mask
A barcode and QR scan layout for react-native applications with customizable styling
Stars: ✭ 230 (-18.15%)
Mutual labels:  barcode-scanner
barcode scan2
[reborned barcode_scan] A flutter plugin for reading 2D barcodes and QR codes.
Stars: ✭ 43 (-84.7%)
Mutual labels:  barcode-scanner
Quagga2
An advanced barcode-scanner written in Javascript and TypeScript - Continuation from https://github.com/serratus/quaggajs
Stars: ✭ 198 (-29.54%)
Mutual labels:  barcode-scanner
BarcodeReader
Simple multi-format barcode reader for Windows
Stars: ✭ 26 (-90.75%)
Mutual labels:  barcode-scanner
Nativescript Barcodescanner
🔎 NativeScript QR / barcode (bulk)scanner plugin
Stars: ✭ 280 (-0.36%)
Mutual labels:  barcode-scanner
Vision-Barcode-Scanner
Customized Google Vision API Barcode Scanner
Stars: ✭ 31 (-88.97%)
Mutual labels:  barcode-scanner
smartscanner-android-api
Convenience API for ID PASS SmartScanner to simplify the Intent call out process
Stars: ✭ 19 (-93.24%)
Mutual labels:  barcode-scanner

Barcode Reader - Google Mobile Vision

Android Barcode Reader library using Google Mobile Vision. This library is built on top of google mobile vision sample adding improvements and fixing few bugs.

Download Example

Demo

How to Use

  1. Include the barcode reader dependency in app's build.gradle
dependencies {
    // google mobile vision
    implementation 'com.google.android.gms:play-services-vision:11.0.2'

    // barcode reader
    implementation 'info.androidhive:barcode-reader:1.1.5'
}
  1. Add the barcode reader fragment to your activity
<fragment
        android:id="@+id/barcode_fragment"
        android:name="info.androidhive.barcode.BarcodeReader"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:auto_focus="true"
        app:use_flash="false" />
  1. Implement your activity from BarcodeReader.BarcodeReaderListener and override the necessary methods.
public class MainActivity extends AppCompatActivity implements BarcodeReader.BarcodeReaderListener {

    private BarcodeReader barcodeReader;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        barcodeReader = (BarcodeReader) getSupportFragmentManager().findFragmentById(R.id.barcode_fragment);
    }


    @Override
    public void onScanned(Barcode barcode) {
        // play beep sound
        barcodeReader.playBeep();
    }

    @Override
    public void onScannedMultiple(List<Barcode> list) {

    }

    @Override
    public void onBitmapScanned(SparseArray<Barcode> sparseArray) {

    }

    @Override
    public void onScanError(String s) {

    }
    
    @Override
    public void onCameraPermissionDenied() {
            Toast.makeText(getApplicationContext(), "Camera permission denied!", Toast.LENGTH_LONG).show();
    }
}

Adding Barcode Reader in Fragment

In fragment the barcode reader can be added easily but the scanner listener barcodeReader.setListener() has to be set manually.

Check the example fragment code in BarcodeFragment.java and BarcodeFragmentTestActivity.java

https://github.com/ravi8x/Barcode-Reader/tree/master/example/src/main/java/info/androidhive/barcodereader

Adding Scanner Overlay Scanning Indicator

The overlay animation indicator displays a horizontal line animating from top to bottom. This will be useful to to show some cool animation to indicate scanning progress.

To use it, add the info.androidhive.barcode.ScannerOverlay on top of barcode reader fragment using Relative or Frame layout.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout ...>

    <fragment
        android:id="@+id/barcode_fragment"
        android:name="info.androidhive.barcode.BarcodeReader"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        app:auto_focus="true"
        app:use_flash="false" />

    <info.androidhive.barcode.ScannerOverlay
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="#44000000"
        app:line_color="#7323DC"
        app:line_speed="6"
        app:line_width="4"
        app:square_height="200"
        app:square_width="200"/>

</RelativeLayout>

Additional Options

XML attribute for Barcode Reader

auto_focus - boolean, turn on/off auto focus. Default is true

use_flash - boolean, turn on/off flash. Default is false

XML attribute for Scanner Overlay Indicator

square_width - Width of transparent square

square_height - Height of transparent square

line_color - Horizontal line color

line_speed - Horizontal line animation speed


JAVA Methods

  • Play beep sound

You can play the beep sound when the barcode is scanned. This code is usually called in onScanned() callback.

@Override
    public void onScanned(final Barcode barcode) {
        Log.e(TAG, "onScanned: " + barcode.displayValue);
        barcodeReader.playBeep();
        });
    }
  • Change beep sound

You can change the default beep sound by passing the file name. You beep file should be in project's assets folder.

barcodeReader.setBeepSoundFile("shutter.mp3");
  • Pause scanning

The scanning can be paused by calling pauseScanning() method.

barcodeReader.pauseScanning();
  • Resume Scanning

The scanning can be resumed by calling resumeScanning() method.

barcodeReader.resumeScanning();

Know Issues

  • Camera stream is not smooth. It's because of camera resolution.
  • Sometimes screen turns black after Camera permission is granted.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].