Project Name | Stars | Downloads | Repos Using This | Packages Using This | Most Recent Commit | Total Releases | Latest Release | Open Issues | License | Language |
---|---|---|---|---|---|---|---|---|---|---|
Zxing Android Embedded | 5,260 | 7 months ago | 6 | October 25, 2021 | 100 | apache-2.0 | Java | |||
Barcode scanner library for Android, based on the ZXing decoder | ||||||||||
Barcodescanner | 5,233 | 5 | 3 years ago | 27 | August 19, 2017 | other | Java | |||
Barcode Scanner Libraries for Android | ||||||||||
Lbxscan | 3,014 | 110 | 3 years ago | 5 | October 22, 2018 | 148 | mit | Objective-C | ||
A barcode and qr code scanner (二维码、扫码、扫一扫、ZXing、ZBar、iOS系统AVFoundation扫码封装,扫码界面效果封装) | ||||||||||
Zxinglite | 2,592 | a month ago | 4 | June 22, 2022 | 24 | apache-2.0 | Java | |||
🔥 ZXing的精简极速版,优化扫码和生成二维码/条形码,内置闪光灯等功能。扫描风格支持:微信的线条样式,支付宝的网格样式。几句代码轻松拥有扫码功能 ,ZXingLite让集成更简单。(扫码识别速度快如微信) | ||||||||||
Instascan | 2,365 | 55 | 6 | 3 years ago | 7 | April 26, 2017 | 177 | mit | JavaScript | |
HTML5 QR code scanner using your webcam | ||||||||||
Qrcodereaderview | 1,770 | 231 | 3 years ago | 2 | March 29, 2017 | 49 | Java | |||
Modification of ZXING Barcode Scanner project for easy Android QR-Code detection and AR purposes | ||||||||||
Zxing.net.mobile | 1,035 | 207 | 40 | 10 months ago | 47 | January 19, 2021 | 178 | mit | C# | |
Barcode Scanner for Xamarin.iOS, Xamarin.Android, UWP and Tizen | ||||||||||
Code Scanner | 848 | a year ago | 66 | mit | Java | |||||
Code scanner library for Android, based on ZXing | ||||||||||
Scanner | 841 | a year ago | 33 | Java | ||||||
二维码/条码识别、身份证识别、银行卡识别、车牌识别、图片文字识别、黄图识别、驾驶证(驾照)识别 | ||||||||||
Ngx Scanner | 581 | 45 | 6 | 22 days ago | 58 | June 17, 2022 | 49 | mit | TypeScript | |
Angular (2+) QR code, Barcode, DataMatrix, scanner component using ZXing. |
Barcode scanning library for Android, using ZXing for decoding.
The project is loosely based on the ZXing Android Barcode Scanner application, but is not affiliated with the official ZXing project.
Features:
A sample application is available in Releases.
By default, Android SDK 24+ is required because of zxing:core
3.4.x.
SDK 19+ is supported with additional configuration, see Older SDK versions.
Add the following to your build.gradle
file:
// Config for SDK 24+
repositories {
mavenCentral()
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
}
By default, only SDK 24+ will work, even though the library specifies 19 as the minimum version.
For SDK versions 19+, one of the changes below are required. Some older SDK versions below 19 may work, but this is not tested or supported.
repositories {
mavenCentral()
}
dependencies {
implementation('com.journeyapps:zxing-android-embedded:4.3.0') { transitive = false }
implementation 'com.google.zxing:core:3.3.0'
}
This option does not require changing library versions, but may complicate the build process.
This requires Android Gradle Plugin version 4.0.0 or later.
See Java 8+ API desugaring support.
Example for SDK 21+:
android {
defaultConfig {
minSdkVersion 21
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
}
SDK 19+ additionally requires multiDex. In addition to these gradle config changes, the Application class must also be changed. See for details: Configure your app for multidex.
android {
defaultConfig {
multiDexEnabled true
minSdkVersion 19
}
compileOptions {
// Flag to enable support for the new language APIs
coreLibraryDesugaringEnabled true
// Sets Java compatibility to Java 8
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'com.journeyapps:zxing-android-embedded:4.3.0'
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:1.1.5'
implementation "androidx.multidex:multidex:2.0.1"
}
Hardware acceleration is required since TextureView is used.
Make sure it is enabled in your manifest file:
<application android:hardwareAccelerated="true" ... >
Note: startActivityForResult
is deprecated, so this example uses registerForActivityResult
instead.
See for details: https://developer.android.com/training/basics/intents/result
startActivityForResult
can still be used via IntentIntegrator
, but that is not recommended anymore.
// Register the launcher and result handler
private final ActivityResultLauncher<ScanOptions> barcodeLauncher = registerForActivityResult(new ScanContract(),
result -> {
if(result.getContents() == null) {
Toast.makeText(MyActivity.this, "Cancelled", Toast.LENGTH_LONG).show();
} else {
Toast.makeText(MyActivity.this, "Scanned: " + result.getContents(), Toast.LENGTH_LONG).show();
}
});
// Launch
public void onButtonClick(View view) {
barcodeLauncher.launch(new ScanOptions());
}
Customize options:
ScanOptions options = new ScanOptions();
options.setDesiredBarcodeFormats(ScanOptions.ONE_D_CODE_TYPES);
options.setPrompt("Scan a barcode");
options.setCameraId(0); // Use a specific camera of the device
options.setBeepEnabled(false);
options.setBarcodeImageEnabled(true);
barcodeLauncher.launch(options);
See BarcodeOptions for more options.
While this is not the primary purpose of this library, it does include basic support for generating some barcode types:
try {
BarcodeEncoder barcodeEncoder = new BarcodeEncoder();
Bitmap bitmap = barcodeEncoder.encodeBitmap("content", BarcodeFormat.QR_CODE, 400, 400);
ImageView imageViewQrCode = (ImageView) findViewById(R.id.qrCode);
imageViewQrCode.setImageBitmap(bitmap);
} catch(Exception e) {
}
To customize the generated barcode image, use the setBackgroundColor
and setForegroundColor
functions of the
BarcodeEncoder
class with a @ColorInt
value to update the background and foreground colors of the barcode respectively. By default, the barcode has a
white background and black foreground.
To change the orientation, specify the orientation in your AndroidManifest.xml
and let the ManifestMerger
to update the Activity's definition.
Sample:
<activity
android:name="com.journeyapps.barcodescanner.CaptureActivity"
android:screenOrientation="fullSensor"
tools:replace="screenOrientation" />
ScanOptions options = new ScanOptions();
options.setOrientationLocked(false);
barcodeLauncher.launch(options);
See EMBEDDING.
For more advanced options, look at the Sample Application, and browse the source code of the library.
This is considered advanced usage, and is not well-documented or supported.
The camera permission is required for barcode scanning to function. It is automatically included as part of the library. On Android 6 it is requested at runtime when the barcode scanner is first opened.
When using BarcodeView directly (instead of via IntentIntegrator / CaptureActivity), you have to
request the permission manually before calling BarcodeView#resume()
, otherwise the camera will
fail to open.
./gradlew assemble
To deploy the artifacts the your local Maven repository:
./gradlew publishToMavenLocal
You can then use your local version by specifying in your build.gradle
file:
repositories {
mavenLocal()
}
Licensed under the Apache License 2.0
Copyright (C) 2012-2022 ZXing authors, Journey Mobile
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.