Skip to content

Standalone ZXing barcode/qrcode scanner library so that your users aren't forced to install another (ZXing Barcode Scanner) app separately.

License

Notifications You must be signed in to change notification settings

tarun0/ZXing-Standalone-library

Repository files navigation

Overview

This is the library modified from the original ZXing Project. The code is not modified in any way but is just compiled into a library so that the end user doesn't have to download the scanner app separately.

Adding the library

Add this line (if not already present there) in the project's build.gradle file

repositories {
    jcenter()
}

Add this statement in the dependencies block of app's build.gradle file

compile 'com.tarun0.zxing-standalone:zxing-standalone:1.0.0'

#Usage Send an intent when you need to scan, like on clicking on a button

Intent intent = new Intent(getApplicationContext(),CaptureActivity.class);
            intent.setAction("com.google.zxing.client.android.SCAN");
            intent.putExtra("SAVE_HISTORY", false);
            startActivityForResult(intent, 0);

Handle the result from the intent by overriding onActivityResult

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == 0) {
            if (resultCode == RESULT_OK) {
                String contents = data.getStringExtra("SCAN_RESULT");
                Log.d(TAG, "contents: " + contents);
            } else if (resultCode == RESULT_CANCELED) {
                Log.d(TAG, "RESULT_CANCELED");
            }
        }
    }

Notes

About

Standalone ZXing barcode/qrcode scanner library so that your users aren't forced to install another (ZXing Barcode Scanner) app separately.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published