# BGAQRCode-Android: ZXing and ZBar scanning views for Android apps

> BGAQRCode-Android packages two decoder backends, ZXing and ZBar, behind custom Android views for scanning, album decoding and QR generation. It is a library you embed, not an app you install, and its newest tag is v1.0.8 from 2016.

**bingoogolapple/BGAQRCode-Android** — QRCode 扫描二维码、扫描条形码、相册获取图片后识别、生成带 Logo 二维码、支持微博微信 QQ 二维码扫描样式

- Repository: https://github.com/bingoogolapple/BGAQRCode-Android
- Stars: 8,007 · Forks: 1,771
- Language: C
- License: not declared
- Published: 2026-09-22 · Updated: 2026-09-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/bingoogolapple-bgaqrcode-android

## What BGAQRCode-Android solves, and for whom

Android has no built-in barcode scanner API that a normal app can call, so any product that needs to read a code off a camera preview has to wire a decoder, a camera surface and a viewfinder overlay together itself. BGAQRCode-Android does that wiring once and exposes it as two view classes. The README says the project was written for the product needs of the author's previous company and adapted from barcodescanner, with changes large enough that no pull request back to that library was planned.

The intended reader is an Android developer embedding scanning into an existing app, most likely one that already has a Toolbar and a colour scheme to match. The feature list covers camera scanning for both ZXing and ZBar, decoding a code from a picture picked out of the gallery, and generating QR codes with custom colours and an embedded logo. ZBar support is listed with a note that its Chinese-character garbling problem is fixed, which is the one feature that is hard to reproduce with a thin wrapper over ZXing alone.

## How the ZXing and ZBar views differ under the hood

The repository is split into qrcodecore, zxing and zbar library modules plus zxingdemo and zbardemo sample apps. The core module holds the shared view logic and the custom attributes; each backend module supplies its own view class, cn.bingoogolapple.qrcode.zxing.ZXingView and cn.bingoogolapple.qrcode.zbar.ZBarView, and its own decoder. That split is why the two backends can be depended on separately: a project that only wants ZXing never pulls the ZBar native code.

The public surface is a QRCodeView with a setType method whose second argument differs by backend. ZXing takes a Map<DecodeHintType, Object> and ZBar takes a List<BarcodeFormat>, both required when the barcode type is BarcodeType.CUSTOM. Results arrive through setDelegate(Delegate delegate). The README points at the onClick method of TestScanActivity in each demo for the full usage, which means the real contract for format selection lives in sample code rather than in a written API reference.

The scan box is drawn by the view itself, and the custom attributes control it rather than any external layout. qrcv_isOnlyDecodeScanBoxArea decides whether the decoder sees the whole frame or only the rectangle, qrcv_isAutoZoom enlarges very small codes, and qrcv_isBarcode switches the box to the wide barcode shape with a default height of 140dp. Two attributes interact in a way worth noting: setting qrcv_isShowDefaultScanLineDrawable makes qrcv_scanLineSize stop having any effect, and setting qrcv_customScanLineDrawable disables qrcv_isShowDefaultScanLineDrawable, qrcv_scanLineSize and qrcv_scanLineColor together. Overriding the scan line therefore means giving up per-attribute control of it.

## Installing BGAQRCode-Android from JitPack and scanning your first code

The README gives JitPack as the distribution channel. Add the JitPack repository to the repositories block of the root build.gradle, then depend on the module you want. The README writes latestVersion as a placeholder and tells you to replace it with the version shown in the JitPack badge, so the exact string is something you read off the badge rather than copy from the documentation.

```groovy
dependencies {
    implementation 'com.github.bingoogolapple.BGAQRCode-Android:zxing:latestVersion'
}
```

Swap the artifact id to zbar to use the ZBar decoder instead. Next, place the view in your layout. The README's example sets the scan box 90dp below the toolbar and gives the corners a 20dp length in the primary dark colour.

```xml
<cn.bingoogolapple.qrcode.zxing.ZXingView
    android:id="@+id/zxingview"
    style="@style/MatchMatch"
    app:qrcv_animTime="1000"
    app:qrcv_borderColor="@android:color/white"
    app:qrcv_borderSize="1dp"
    app:qrcv_cornerColor="@color/colorPrimaryDark"
    app:qrcv_cornerLength="20dp"
    app:qrcv_cornerSize="3dp"
    app:qrcv_maskColor="#33FFFFFF"
    app:qrcv_rectWidth="200dp"
    app:qrcv_scanLineColor="@color/colorPrimaryDark"
    app:qrcv_scanLineSize="1dp"
    app:qrcv_topOffset="90dp" />
```

The README's first troubleshooting entry explains the layout constraint that trips people up: put the Toolbar or any other view on top of the ZXingView or ZBarView, and let the view fill the screen width and height. If it does not fill the screen, the preview gets compressed and some phones fail to decode at all. The second entry covers the lifecycle. Call mQRCodeView.onDestroy() from onDestroy and mQRCodeView.stopCamera() from onStop, or the camera can come back black, and the README says recovering from that state requires a phone restart.

## Where BGAQRCode-Android breaks down

The black-screen failure mode is the sharpest limitation, because it is not a degraded result but a stuck state. The README states plainly that if you miss the two lifecycle calls, restarting the phone is the only fix. That is a library whose camera resource is not released defensively, and it puts the burden on every activity that hosts a view.

The release history is the second problem. The most recent tagged release is v1.0.8, dated 2016-05-30, and the two before it are from April 2016. The repository is not archived and its last push was on 2026-07-11, so there is activity, but nothing in the repository shows that activity reaching a tag. Anyone adopting this should treat the JitPack artifact as a snapshot of a decade-old API and check which commit the badge resolves to. The README also does not document rollback, deprecation policy or a migration path between versions.

Two smaller gaps matter in practice. The licence field is unknown, and the README carries no licence section, so the terms you are accepting are not stated anywhere in the repository. And the API documentation is thin: for format selection the README defers to sample activity code, which is fine for reading but poor for auditing what formats a build actually enables.

## BGAQRCode-Android compared with Google's ML Kit barcode scanning

The alternative worth weighing is Google's ML Kit barcode scanning, which ships as an on-device API rather than a view hierarchy. The difference is where the work happens. BGAQRCode-Android gives you a configured view with a scan rectangle, a moving scan line, a mask and a set of qrcv_ attributes, and you inherit its camera handling and its lifecycle contract. ML Kit gives you a decoder and leaves the camera, the preview and the overlay to you, typically through CameraX. If your design does not look like the README's screenshots, the BGAQRCode-Android attributes become something to fight, and the two lifecycle calls remain mandatory regardless.

The other difference is the decoder itself. BGAQRCode-Android offers ZXing and ZBar as separate artifacts, and ZBar is the one whose Chinese-character handling the README calls out as fixed. Choosing ML Kit means giving up that specific ZBar path. Choosing BGAQRCode-Android means accepting a 2016 API surface and native libraries you have to ship and keep current yourself.

## Maintenance cost, licensing and what the repository actually ships

The last push to the default branch was on 2026-07-11, which is recent, but the newest release tag is v1.0.8 from 2016-05-30. Those two facts point in different directions, and the honest reading is that the codebase sees occasional commits while the published artifact has not moved in years. Plan for a dependency you may end up forking.

The repository layout is a standard Gradle multi-module Android build: settings.gradle, a root build.gradle, gradle.properties, the Gradle wrapper scripts, and an assembleDebug.sh at the top level. That script is the documented way to produce the demo builds locally, and it is the only build entry point named in the file listing. For ZBar specifically, the native code lives in the zbar module, and the primary language of the repository is C, so the jniLibs and their ABI coverage are part of your upgrade surface, not the library author's.

The licence is not identified in the repository and no licence file appears among the top-level entries. That is not a legal opinion, only the observation that you cannot confirm your obligations from the published contents, and it is a question to settle before shipping.

## Conclusion

Adopt BGAQRCode-Android if you are maintaining an existing Android app that already depends on it, or if you need ZBar's Chinese-character decoding and are willing to carry the jniLibs yourself. Do not adopt it for a new project that expects ongoing releases: the newest tagged release is v1.0.8 from 2016-05-30, even though the repository received a push on 2026-07-11. Before committing, verify three things in the source: that the zbar module's native libraries cover your target ABIs, that onDestroy() calls mQRCodeView.onDestroy() and onStop() calls stopCamera() in your activity, and that the jitpack latestVersion badge actually resolves to a commit you have reviewed.

## FAQ

### How do I install BGAQRCode-Android in an Android project?

Add maven { url 'https://jitpack.io' } to the repositories in your root build.gradle, then add an implementation dependency on either the zxing or the zbar artifact, replacing the latestVersion placeholder with the version shown in the JitPack badge.

### Why does BGAQRCode-Android show a black screen?

The README attributes it to missing lifecycle calls. Call mQRCodeView.onDestroy() from onDestroy and mQRCodeView.stopCamera() from onStop, and note that the README says recovering from an already black screen requires restarting the phone.

### Does BGAQRCode-Android support scanning barcodes as well as QR codes?

Yes. ZXing and ZBar both scan barcodes and QR codes, both can decode codes from images in the gallery, and ZXing additionally generates QR codes with custom colours and a logo plus one-dimensional barcodes.

### Can BGAQRCode-Android decode only the area inside the scan box?

Yes, through the qrcv_isOnlyDecodeScanBoxArea attribute, which defaults to false. The related qrcv_isAutoZoom attribute, also false by default, enlarges very small codes.

### Why is the scan preview compressed on some phones in BGAQRCode-Android?

The README's first FAQ entry says to place the Toolbar or other views on top of the ZXingView or ZBarView and let that view fill the screen width and height, and it links to the demo layout files for both backends.

### Does BGAQRCode-Android support two-finger zoom on the camera preview?

The feature list includes two-finger zooming of the preview, along with flashlight control, front-camera scanning and ambient-light detection that prompts the user to turn the flashlight on or off.

## Sources

- [bingoogolapple/BGAQRCode-Android on GitHub](https://github.com/bingoogolapple/BGAQRCode-Android)
- [Issues](https://github.com/bingoogolapple/BGAQRCode-Android/issues)
- [README](https://github.com/bingoogolapple/BGAQRCode-Android/blob/master/README.md)
- [Releases](https://github.com/bingoogolapple/BGAQRCode-Android/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/bingoogolapple-bgaqrcode-android
