Using Zxing and Google Goggles with my app

2019-07-06 16:40发布

问题:

I have an app, i used this code to integrate zxing

public Button.OnClickListener mScan = new Button.OnClickListener() {
    public void onClick(View v) {
        Intent intent = new Intent("com.google.zxing.client.android.SCAN");
        intent.putExtra("SCAN_MODE", "QR_CODE_MODE");
        startActivityForResult(intent, 0);
        }
    };

public void onActivityResult(int requestCode, int resultCode, Intent intent) {
    if (requestCode == 0) {
        if (resultCode == RESULT_OK) {
           String contents = intent.getStringExtra("SCAN_RESULT");
           String format = intent.getStringExtra("SCAN_RESULT_FORMAT");
           // Handle successful scan
        } else if (resultCode == RESULT_CANCELED) {
            // Handle cancel
        }
    }

I have both zxing scanner as well as google goggles installed in my mobile phone. When i start the app and try to scan, I get the option to choose either the barcode scanner or the goggle app. I thought, hey let's try and use the goggle app for doing other stuff as well like OCR. I select the goggle option but the app does not have the take picture option within it. How do I integrate goggles also with my app? with full functionality?

回答1:

Unfortunately you can't. Goggles will only provide the same core functionality as ZXing. I've spent hours researching the same question.