Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scanner (Barcode) Api for Android does not detect the barcode

I would like to make an app as an barcode scanner. I founded an barcode scanner api with the name android vision

I can start the app and hold my camera on a barcode. But the logs only says:

11-20 11:21:29.353 20243-20243/com.google.android.gms.samples.vision.barcodereader D/Barcode-reader: no barcode detected

Can anyone tell me, why no barcode is detected?

like image 330
Ghost108 Avatar asked Dec 01 '25 03:12

Ghost108


2 Answers

The barcodeDetector in google vision API is nor supported for all devices. I faced this problem. It didn't work on my phone (ASUS) when I tried on 1+ mobile, it worked great. To know whether it is supported in you phone or not, just try this piece of code in "onCreate" of your main activity.

if(!barcodeDetector.isOperational()){
            Toast.makeText(getApplicationContext(), "Sorry, Couldn't setup the detector", Toast.LENGTH_LONG).show();
            this.finish();
        }

If the toast appear before the activity is launched in your mobile, it simply means the barcodeDetector is not supported for your device.I guess, this is fixed in higher versions of google play vision API.

Try using google play vision API 9 and above.

like image 130
Akhil Ghatiki Avatar answered Dec 02 '25 15:12

Akhil Ghatiki


There are some open issues with Barcode detection

  1. No barcode detected #8 This issue has a solution here https://stackoverflow.com/a/32029162/2691974
  2. No Barcode detection #31 This is still a open issue in github
  3. There are other issues, some of them are due to focus problems, and some formats are not recognised properly.
like image 27
Valamburi M Avatar answered Dec 02 '25 16:12

Valamburi M



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!