无法使用谷歌条码扫描仪

Mid*_*rty 5 android android-vision

我从https://github.com/googlesamples/android-vision尝试了谷歌条码阅读器

此示例不起作用.当我选择屏幕时,它总是会检测到

"没有检测到条形码"

调试原因:

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;
}
Run Code Online (Sandbox Code Playgroud)

graphic 变量总是如此 Null

看图像:

Android工作室上的图像

有谁遇到过这个问题?你能告诉我怎么解决吗?非常感谢!

Vie*_*134 2

所以我猜你是 Android Mobile Vision 的新手,在新版本的 Google Play 服务 (v9) 中,由于该功能存在严重错误,他们暂时禁用了该功能,你可以在此处查看发行说明:

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