Skip to content

Vicepredator/BarcodeReader

Repository files navigation

BarcodeReader

A simple barcode/Qrcode reader app for android

This app uses google api to recognise barcodes or QR codes.

I've also created some kind of library to use barcode reader functionality in your projects.

Library BarcodeReader.java

The library is called BarcodeReader.java and you can find that here BarcodeReader.java

To use that follow thoose simple steps:

  1. Add thoose two lines to your AndroidManifest.xml:
<meta-data android:name="com.google.android.gms.vision.DEPENDENCIES" android:value="barcode"/>
<uses-permission android:name="android.permission.CAMERA" />
  1. Add this other line to your build.gradle:
implementation 'com.google.android.gms:play-services-vision:10.0.0'
  1. Add a surface view to your activity to hold your camera preview
  2. Create a BarcodeReader object in your activity
BarcodeReader yourBarcodeReader = new BarcodeReader(yourActivity.this, yourSurfaceView);
  1. Set the BarcodeReaderListener, as shown in the example:
yourBarcodeReader.setBarcodeReaderListener(new BarcodeReader.BarcodeReaderListener() {
  @Override
  public void onCodeScanned(String yourReadedBarcode) {
     //Your code here
     //yourReadedBarcode contains the value of the barcode you have read
  }
});
  1. Finally add java yourBarcodeReader.start(); in your code to start the reader.

About

A simple barcode/Qrcode reader app for android

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages