0

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?

Kara
  • 6,115
  • 16
  • 50
  • 57
  • 1
    possible duplicate of [Using Zxing and Google Goggles with my app](http://stackoverflow.com/questions/20247842/using-zxing-and-google-goggles-with-my-app) – rmtheis Mar 23 '14 at 15:59

1 Answers1

0

I have no idea about how to integrate your app with Google Goggles. However, if you looking for an app that provide OCR function, you may use my app: https://play.google.com/store/apps/details?id=sunbulmh.ocr

Here is a sample code that you can use in your app to get OCR service:

PackageManager pm = getPackageManager();
try {
    pm.getPackageInfo("sunbulmh.ocr", PackageManager.GET_ACTIVITIES);
    Intent LaunchIntent = pm.getLaunchIntentForPackage("sunbulmh.ocr");
    LaunchIntent.setFlags(0);
    startActivityForResult(LaunchIntent,5);
} catch (NameNotFoundException e) {
    Uri URLURI = Uri.parse("http://play.google.com/store/apps/details?id=sunbulmh.ocr");
    Intent intent = new Intent(Intent.ACTION_VIEW,URLURI);
    startActivity(intent);
}

Then, get the result in onActivityResult():

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {

    if (resultCode == RESULT_OK) {
        if(requestCode == 5){
            String ocr_txt = data.getStringExtra(Intent.EXTRA_TEXT);
            // ocr_txt contains the recognized text.




        }
    }
}
Sunbul M H
  • 21
  • 2