Reputation: 4268
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
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
Reputation: 702
There are some open issues with Barcode detection
Upvotes: 1