GithubHelp home page GithubHelp logo

martindgadr / qreader Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nisrulz/qreader

0.0 1.0 0.0 426 KB

:white_square_button: [Android Library] Read QR codes using google's mobile vision api, but without the hassle

Home Page: http://nisrulz.github.io/qreader

License: Apache License 2.0

Java 100.00%

qreader's Introduction

Image

Specs

API

Badges/Featured In

Android Arsenal AndroidDev Digest

Show some ❤️

GitHub stars GitHub forks GitHub watchers GitHub followers Twitter Follow

Android library which makes use of Google's Mobile Vision API to enable reading QR Code.

The library is built for simplicity and ease of use. It not only eliminates most boilerplate code for dealing with setting up QR Code reading , but also provides an easy and simple API to retrieve information from QR Code quickly.

Requires Google Play Services

Changelog

Starting with 1.0.4, Changes exist in the releases tab.

#Integration QREader is available in the Jcenter, so getting it as simple as adding it as a dependency

  • For gradle version < 4.0

    compile 'com.github.nisrulz:qreader:{latest version}'
  • For gradle 4.0+

    implementation 'com.github.nisrulz:qreader:{latest version}'

where {latest version} corresponds to published version in Download

Usage Docs

Steps

  1. Add a SurfaceView to your layout
<SurfaceView
  android:id="@+id/camera_view"
  android:layout_width="match_parent"
  android:layout_height="match_parent"
  android:layout_above="@+id/info"
  />
  1. Setup SurfaceView and QREader in onCreate()
// QREader
private SurfaceView mySurfaceView;
private QREader qrEader;
..

@Override
protected void onCreate(final Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  ..
  ..

  // Setup SurfaceView
  // -----------------
  mySurfaceView = (SurfaceView) findViewById(R.id.camera_view);

  // Init QREader
  // ------------
  qrEader = new QREader.Builder(this, mySurfaceView, new QRDataListener() {
    @Override
    public void onDetected(final String data) {
      Log.d("QREader", "Value : " + data);
      text.post(new Runnable() {
        @Override
        public void run() {
          text.setText(data);
        }
      });
    }
  }).facing(QREader.BACK_CAM)
      .enableAutofocus(true)
      .height(mySurfaceView.getHeight())
      .width(mySurfaceView.getWidth())
      .build();

}
  1. Initialize and Start in onResume()
  @Override
  protected void onResume() {
    super.onResume();

    // Init and Start with SurfaceView
    // -------------------------------
    qrEader.initAndStart(mySurfaceView);
  }
  1. Cleanup in onPause()
  @Override
  protected void onPause() {
    super.onPause();

    // Cleanup in onPause()
    // --------------------
    qrEader.releaseAndCleanup();
  }
  1. Some provided utility functions which you can use
  • To check if the camera is running

    boolean isCameraRunning = qrEader.isCameraRunning()
  • To stop QREader

    qrEader.stop();
  • To start QREader

    qrEader.start();
Check the included sample app for a working example.

Pull Requests

I welcome and encourage all pull requests. It usually will take me within 24-48 hours to respond to any issue or request. Here are some basic rules to follow to ensure timely addition of your request:

  1. Match coding style (braces, spacing, etc.) This is best achieved using CMD+Option+L (Reformat code) on Mac (not sure for Windows) with Android Studio defaults.
  2. If its a feature, bugfix, or anything please only change code to what you specify.
  3. Please keep PR titles easy to read and descriptive of changes, this will make them easier to merge :)
  4. Pull requests must be made against develop branch. Any other branch (unless specified by the maintainers) will get rejected.
  5. Check for existing issues first, before filing an issue.
  6. Have fun!

Created & Maintained By

Nishant Srivastava (@nisrulz)

If you found this library helpful or you learned something from the source code and want to thank me, consider buying me a cup of ☕

  • PayPal
  • Bitcoin Address: 13PjuJcfVW2Ad81fawqwLtku4bZLv1AxCL

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.