{"id":13756541,"url":"https://github.com/dm77/barcodescanner","last_synced_at":"2025-05-10T03:32:18.441Z","repository":{"id":14439559,"uuid":"17150993","full_name":"dm77/barcodescanner","owner":"dm77","description":"Barcode Scanner Libraries for Android","archived":true,"fork":false,"pushed_at":"2020-07-01T15:06:59.000Z","size":10971,"stargazers_count":5456,"open_issues_count":0,"forks_count":1426,"subscribers_count":210,"default_branch":"master","last_synced_at":"2024-11-11T03:53:06.787Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dm77.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-02-24T21:14:09.000Z","updated_at":"2024-11-07T07:52:12.000Z","dependencies_parsed_at":"2022-06-26T02:30:19.743Z","dependency_job_id":null,"html_url":"https://github.com/dm77/barcodescanner","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dm77%2Fbarcodescanner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dm77%2Fbarcodescanner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dm77%2Fbarcodescanner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dm77%2Fbarcodescanner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dm77","download_url":"https://codeload.github.com/dm77/barcodescanner/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224911591,"owners_count":17390840,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-03T11:00:46.618Z","updated_at":"2024-11-16T11:31:52.898Z","avatar_url":"https://github.com/dm77.png","language":"Java","funding_links":[],"categories":["Java","Libs"],"sub_categories":["\u003cA NAME=\"Component\"\u003e\u003c/A\u003eComponent"],"readme":"Project Archived\n================\n**July 1 2020**\n\nThis project is no longer maintained. When I first started this project in late 2013 there were very few libraries to help with barcode scanning on Android. But the situation today is much different. We have lots of great libraries based on ZXing and there is also barcode scanning API in Google's MLKit (https://github.com/googlesamples/mlkit). So given the options I have decided to stop working on this project.\n\nIntroduction\n============\n\nAndroid library projects that provides easy to use and extensible Barcode Scanner views based on ZXing and ZBar.\n\nScreenshots\n===========\n\u003cimg src=\"https://raw.github.com/dm77/barcodescanner/master/screenshots/main_activity.png\" width=\"266\"\u003e\n\u003cimg src=\"https://raw.github.com/dm77/barcodescanner/master/screenshots/scanner.png\" width=\"266\"\u003e\n\u003cimg src=\"https://raw.github.com/dm77/barcodescanner/master/screenshots/scan_results.png\" width=\"266\"\u003e\n\n\nMinor BREAKING CHANGE in 1.8.4\n==============================\nVersion 1.8.4 introduces a couple of new changes:\n\n* Open Camera and handle preview frames in a separate HandlerThread (#1, #99): Though this has worked fine in my testing on 3 devices, I would advise you to test on your own devices before blindly releasing apps with this version. If you run into any issues please file a bug report.\n* Do not automatically stopCamera after a result is found #115: This means that upon a successful scan only the cameraPreview is stopped but the camera is not released. So previously if your code was calling mScannerView.startCamera() in the handleResult() method, please replace that with a call to mScannerView.resumeCameraPreview(this);\n\nZXing\n=====\n\nInstallation\n------------\n\nAdd the following dependency to your build.gradle file.\n\n```\nrepositories {\n   jcenter()\n}\nimplementation 'me.dm7.barcodescanner:zxing:1.9.13'\n```\n\nSimple Usage\n------------\n\n1.) Add camera permission to your AndroidManifest.xml file:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.CAMERA\" /\u003e\n```\n\n2.) A very basic activity would look like this:\n\n```java\npublic class SimpleScannerActivity extends Activity implements ZXingScannerView.ResultHandler {\n    private ZXingScannerView mScannerView;\n\n    @Override\n    public void onCreate(Bundle state) {\n        super.onCreate(state);\n        mScannerView = new ZXingScannerView(this);   // Programmatically initialize the scanner view\n        setContentView(mScannerView);                // Set the scanner view as the content view\n    }\n\n    @Override\n    public void onResume() {\n        super.onResume();\n        mScannerView.setResultHandler(this); // Register ourselves as a handler for scan results.\n        mScannerView.startCamera();          // Start camera on resume\n    }\n\n    @Override\n    public void onPause() {\n        super.onPause();\n        mScannerView.stopCamera();           // Stop camera on pause\n    }\n\n    @Override\n    public void handleResult(Result rawResult) {\n        // Do something with the result here\n        Log.v(TAG, rawResult.getText()); // Prints scan results\n        Log.v(TAG, rawResult.getBarcodeFormat().toString()); // Prints the scan format (qrcode, pdf417 etc.)\n\n        // If you would like to resume scanning, call this method below:\n        mScannerView.resumeCameraPreview(this);\n    }\n}\n\n```\n\nPlease take a look at the [zxing-sample](https://github.com/dm77/barcodescanner/tree/master/zxing-sample) project for a full working example.\n\nAdvanced Usage\n--------------\n\nTake a look at the [FullScannerActivity.java](https://github.com/dm77/barcodescanner/blob/master/zxing-sample/src/main/java/me/dm7/barcodescanner/zxing/sample/FullScannerActivity.java) or [FullScannerFragment.java](https://github.com/dm77/barcodescanner/blob/master/zxing-sample/src/main/java/me/dm7/barcodescanner/zxing/sample/FullScannerFragment.java) classes to get an idea on advanced usage.\n\nInteresting methods on the ZXingScannerView include:\n\n```java\n// Toggle flash:\nvoid setFlash(boolean);\n\n// Toogle autofocus:\nvoid setAutoFocus(boolean);\n\n// Specify interested barcode formats:\nvoid setFormats(List\u003cBarcodeFormat\u003e formats);\n\n// Specify the cameraId to start with:\nvoid startCamera(int cameraId);\n```\n\nSpecify front-facing or rear-facing cameras by using the `void startCamera(int cameraId);` method.\n\n\nFor HUAWEI mobile phone like P9, P10, when scanning using the default settings, it won't work due to the\n\"preview size\",  please adjust the parameter as below:\n\n```java\nmScannerView = (ZXingScannerView) findViewById(R.id.zx_view);\n\n// this paramter will make your HUAWEI phone works great!\nmScannerView.setAspectTolerance(0.5f);\n```\n\nSupported Formats:\n\n```java\nBarcodeFormat.UPC_A\nBarcodeFormat.UPC_E\nBarcodeFormat.EAN_13\nBarcodeFormat.EAN_8\nBarcodeFormat.RSS_14\nBarcodeFormat.CODE_39\nBarcodeFormat.CODE_93\nBarcodeFormat.CODE_128\nBarcodeFormat.ITF\nBarcodeFormat.CODABAR\nBarcodeFormat.QR_CODE\nBarcodeFormat.DATA_MATRIX\nBarcodeFormat.PDF_417\n```\n\nZBar\n====\n\nInstallation\n------------\n\nAdd the following dependency to your build.gradle file.\n\n```\nrepositories {\n   jcenter()\n}\nimplementation 'me.dm7.barcodescanner:zbar:1.9.13'\n```\n\nSimple Usage\n------------\n\n1.) Add camera permission to your AndroidManifest.xml file:\n\n```xml\n\u003cuses-permission android:name=\"android.permission.CAMERA\" /\u003e\n```\n\n2.) A very basic activity would look like this:\n\n```java\npublic class SimpleScannerActivity extends Activity implements ZBarScannerView.ResultHandler {\n    private ZBarScannerView mScannerView;\n\n    @Override\n    public void onCreate(Bundle state) {\n        super.onCreate(state);\n        mScannerView = new ZBarScannerView(this);    // Programmatically initialize the scanner view\n        setContentView(mScannerView);                // Set the scanner view as the content view\n    }\n\n    @Override\n    public void onResume() {\n        super.onResume();\n        mScannerView.setResultHandler(this); // Register ourselves as a handler for scan results.\n        mScannerView.startCamera();          // Start camera on resume\n    }\n\n    @Override\n    public void onPause() {\n        super.onPause();\n        mScannerView.stopCamera();           // Stop camera on pause\n    }\n\n    @Override\n    public void handleResult(Result rawResult) {\n        // Do something with the result here\n        Log.v(TAG, rawResult.getContents()); // Prints scan results\n        Log.v(TAG, rawResult.getBarcodeFormat().getName()); // Prints the scan format (qrcode, pdf417 etc.)\n\n        // If you would like to resume scanning, call this method below:\n        mScannerView.resumeCameraPreview(this);\n    }\n}\n\n```\n\nPlease take a look at the [zbar-sample](https://github.com/dm77/barcodescanner/tree/master/zbar-sample)  project for a full working example.\n\nAdvanced Usage\n--------------\n\n\nTake a look at the [FullScannerActivity.java](https://github.com/dm77/barcodescanner/blob/master/zbar-sample/src/main/java/me/dm7/barcodescanner/zbar/sample/FullScannerActivity.java) or [FullScannerFragment.java](https://github.com/dm77/barcodescanner/blob/master/zbar-sample/src/main/java/me/dm7/barcodescanner/zbar/sample/FullScannerFragment.java) classes to get an idea on advanced usage.\n\nInteresting methods on the ZBarScannerView include:\n\n```java\n// Toggle flash:\nvoid setFlash(boolean);\n\n// Toogle autofocus:\nvoid setAutoFocus(boolean);\n\n// Specify interested barcode formats:\nvoid setFormats(List\u003cBarcodeFormat\u003e formats);\n```\n\nSpecify front-facing or rear-facing cameras by using the `void startCamera(int cameraId);` method.\n\nSupported Formats:\n\n```\nBarcodeFormat.PARTIAL\nBarcodeFormat.EAN8\nBarcodeFormat.UPCE\nBarcodeFormat.ISBN10\nBarcodeFormat.UPCA\nBarcodeFormat.EAN13\nBarcodeFormat.ISBN13\nBarcodeFormat.I25\nBarcodeFormat.DATABAR\nBarcodeFormat.DATABAR_EXP\nBarcodeFormat.CODABAR\nBarcodeFormat.CODE39\nBarcodeFormat.PDF417\nBarcodeFormat.QR_CODE\nBarcodeFormat.CODE93\nBarcodeFormat.CODE128\n```\n\nRebuilding ZBar Libraries\n=========================\n\n```\nmkdir some_work_dir\ncd work_dir\nwget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz\ntar zxvf libiconv-1.14.tar.gz\n```\n\nPatch the localcharset.c file:\nvim libiconv-1.14/libcharset/lib/localcharset.c\n\nOn line 48, add the following line of code:\n\n```\n#undef HAVE_LANGINFO_CODESET\n```\n\nSave the file and continue with steps below:\n```\ncd libiconv-1.14\n./configure\ncd ..\nhg clone http://hg.code.sf.net/p/zbar/code zbar-code\ncd zbar-code/android\nandroid update project -p . -t 'android-19'\n```\n\nOpen jni/Android.mk file and add fPIC flag to LOCAL_C_FLAGS.\nOpen jni/Application.mk file and specify APP_ABI targets as needed.\n\n```\nant -Dndk.dir=$NDK_HOME  -Diconv.src=some_work_dir/libiconv-1.14 zbar-clean zbar-all\n```\n\nUpon completion you can grab the .so and .jar files from the libs folder.\n\nCredits\n=======\n\nAlmost all of the code for these library projects is based on:\n\n1. CameraPreview app from Android SDK APIDemos\n2. The ZXing project: https://github.com/zxing/zxing\n3. The ZBar Android SDK: https://github.com/ZBar/ZBar/tree/master/android (Previously: http://sourceforge.net/projects/zbar/files/AndroidSDK/)\n\nContributors\n============\n\nhttps://github.com/dm77/barcodescanner/graphs/contributors\n\nLicense\n=======\nLicense for code written in this project is: Apache License, Version 2.0\n\nLicense for zxing and zbar projects is here:\n* https://github.com/zxing/zxing/blob/master/LICENSE\n* https://github.com/ZBar/ZBar/tree/master/android\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdm77%2Fbarcodescanner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdm77%2Fbarcodescanner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdm77%2Fbarcodescanner/lists"}