Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can not use Google Barcode scanner

I tried Google barcode-reader from https://github.com/googlesamples/android-vision

This example doesn't work. When I tab to screen it always detect

"no barcode detected"

Debug reason :

private boolean onTap(float rawX, float rawY) {

    //TODO: use the tap position to select the barcode.
    BarcodeGraphic graphic = mGraphicOverlay.getFirstGraphic();
    Barcode barcode = null;
    if (graphic != null) {
        barcode = graphic.getBarcode();
        if (barcode != null) {
            Intent data = new Intent();
            data.putExtra(BarcodeObject, barcode);
            setResult(CommonStatusCodes.SUCCESS, data);
            finish();
        }
        else {
            Log.d(TAG, "barcode data is null");
        }
    }
    else {
        Log.d(TAG,"no barcode detected");
    }
    return barcode != null;
}

graphic variable is always Null

See the image:

Image on android studio

Anyone faced this problem? Can you let me know how to resolve it? Thank you so much!

like image 302
MiduSparty Avatar asked May 22 '16 07:05

MiduSparty


People also ask

Why is my Google scanner not working?

If your Android device is not scanning a QR code, make sure the code is properly framed on your screen. Cleaning your camera lens and getting better lighting on the code are other potential solutions. You can also try using Google Lens or a third-party QR code app.

Why is my Google QR code not working?

If you're holding your phone too close or too far away, it won't scan the code. Try holding your phone about 30 cm (1 foot) away and slowly moving it towards the QR code. Some phone cameras can't focus as well as others close up, so you may have to hold your phone a bit further away.

Why is my barcode scanner not working on my phone?

Troubleshooting the Barcode Scanner You can try turning your mobile device off and back on. This will close any apps that were running in the background. Try accessing the barcode scanner again without any other apps open. You can also check to make sure camera permissions are granted for Lose It!.


2 Answers

So I guest you are new to Android Mobile Vision, in the new version of Google Play services (v9) they temporarily disabled the feature due to a serious bug in that feature, you can check the release note here:

https://developers.google.com/android/guides/releases#may_2016_-_v90

like image 112
Vietnt134 Avatar answered Oct 07 '22 01:10

Vietnt134


As @Vietnt134 have already answered, Android Mobile Vision is temporarily disabled.

You can follow this topic to know if something knew came up: https://github.com/googlesamples/android-vision/issues/98

People are pretty mad with Google about this. I hope they solve this quickly.

like image 30
Nom4d3 Avatar answered Oct 07 '22 01:10

Nom4d3