Trombone0904
Trombone0904

Reputation: 4268

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?

Upvotes: 2

Views: 4657

Answers (2)

Akhil Ghatiki
Akhil Ghatiki

Reputation: 1208

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.

Upvotes: 4

Valamburi M
Valamburi M

Reputation: 702

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.

Upvotes: 1

Related Questions