4

I need to add a feature to capture a QR code in my application. I have used Google Play Services and I can read the QR code but I have some questions:

  • Is it compatible with all devices? I can use barcodeDetector.isOperational() to check if it is compatible, but that is not my option. I need to be sure it will work in all devices.
  • Some bar code readers I can get from Play Store, show the camera using all the device surface but in a darker background. In the middle of it, a lighter window is shown surrounded by a frame. That window has the sensibility to read the code, not everywhere in the surface. Is it possible to do that in Google Play Services? It's seems ZXING can do that, as shown in the URL: https://www.studytutorial.in/android-bar-code-qr-code-scanner-tutorial-using-zxing-scanner-library

enter image description here

Regards

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
jstuardo
  • 3,901
  • 14
  • 61
  • 136
  • Use the ML Kit provided in Firebase. Google vision is deprecated and no longer supported & Yes you can create a bounding box so only certain area scans not the entire surface. – Gautam Aug 21 '20 at 04:03
  • I was spend a lot of time trying to figure out about ML-Kit but there are no good tutorials about it. The closest one is https://developers.google.com/ml-kit/vision/barcode-scanning/android. After reading it I can realized that it is not that easy as Google Vision. When using ML Kit, I should first capture the image and then to process it with ML Kit. Am I right? – jstuardo Aug 27 '20 at 15:52

2 Answers2

7

First Question:

Is it compatible with all devices?

If you want to integrate Google ML Kit Barcode scanning into your app,

“ML Kit uses the com.google.android.gms namespace for libraries that depend on Google Play Services.”

But as some phones or other devices are without GMS installed, if you want your app to run on all devices, integrate Huawei Mobile Services (HMS). Scan Kit can be integrated into both Android and iOS systems.

Zxing is a common open-source SDK. However, it only implements basic operations of scanning the QR code and does not support more complex scanning environments such as strong light, bending, and deformation. Currently, the mainstream practice is to optimize the source code based on Zxing. Please kindly refer to this xda article: Comparison between Huawei Scan Kit and Zxing

  1. EMUI Version-Dependent Features of Scan Kit
  • Required EMUI Version (HUAWEI/HONOR Phones and Tablets): EMUI 3.0 or later
  • Required Android Version (Non-Huawei Phones): Android 4.4 or later
  1. Scan Kit provides two SDKs. You can select an SDK as required.

Scan Kit SDK-Plus

  • Recognition capability - Huawei phone:Excellent (using the enhanced recognition model in HMS Core (APK))
  • Recognition capability - Non-Huawei phone:Excellent (using the enhanced recognition model provided by the SDK)
  • SDK Size:≈3.3MB
  • Applicable to: Developers who are insensitive to the SDK size and want to have the best experience on all device models

Scan Kit SDK

  • Recognition capability - Huawei phone:Excellent (using the enhanced recognition model in HMS Core (APK))
  • Recognition capability - Non-Huawei phone:Good (using the common recognition model provided by the SDK)
  • SDK Size:≈0.8MB
  • Applicable to: Developers who are sensitive to the SDK size

Second question:

About Scanning UI

Scan Kit can be called in four ways, from which you can choose as needed. The Scanning UI of Default View is Provided by Scan Kit. The Scanning UI of Customized View Mode,Bitmap Mode and MultiProcessor Mode are Customized by yourself.

If you want to quickly build powerful barcode scanning capabilities into your app, Default View or Customized View is recommended. In either way, Scan Kit directly controls the camera to maximize capabilities such as zoom control, automatic exposure, and auto focus. Less workload is required, but scanning experience is dramatically improved. Customized View differs from Default View in that you can customize the scanning UI.

Please refer to this demo: https://github.com/HMS-Core/hms-scan-demo

zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
0
  1. If an Androd devices don't install Play Services(for example, some Huawei devices),the Google Play Services Vision will not work. ZXing is independent BarCode Scan library, and you can run all devices. But, according to my experiment, Google Vision is better than ZXing(Detect faster and Perform better at Fuzzy code).
  2. Google Vision and ZXing both detect the whole surface, this demo maybe help https://github.com/googlesamples/android-vision
yangfengfan
  • 141
  • 4