Android applications may leverage on OCR Plugin to capture text from real books and newspapers.
You as Android developer may send a request from your Android application to the OCR plugin to capture a word. The request has to be sent via a specific intent towards the OCR plugin.

Your application has to create an intent with an action equal to livio.intent.action.CAPTURE, using the package name of the OCR plugin and adding the required parameters to the intent.
The following parameters can be added to the request:

parameterdescriptionexample valuesupport
version (optional)required version
an error is returned if you specify an unsupported version
1any version
language (optional)language code (ISO 639-1)enany version
regexp (optional)regular expression used to validate text
syntax is described in Pattern class
[\\p{L}]*any version
ignore (optional)characters to discard, can be either 'numeric' or 'numeric|special' or 'special'specialany version
mode (optional)capture mode (reserved, not implemented yet)

The OCR Plugin may return the recognized text (if any), an empty result or an error.

In case text has been identified, OCR Plugin returns the following information:

result codeparameterdescription
RESULT_OKversion (mandatory)supported version
text (mandatory)recognized text
language (optional)language code (reserved, not implemented yet)

In case no text has been identified or an error occured, OCR Plugin returns the following information:

result codeparameterdescription
RESULT_CANCELEDversion (optional)supported version
reason (optional)explanation of the error, if any


Here is an example to capture a text without numbers. Make sure to install the latest version of the OCR plugin on your Android device.

General documentation about developing Android applications is available in Android Developers web site.

We create an intent to activate the OCR Plugin:

Intent intent = new Intent("livio.intent.action.CAPTURE");
intent.putExtra("ignore", "numeric");
if (isIntentAvailable(this, intent)) // check if intent is available ?
    startActivityForResult(intent, REQUEST_CAMERA_INPUT);
else {ask the user to install the OCR Plugin}

Note that in case the intent is not available, you may insert a dialog suggesting the user to download the OCR Plugin.

Now we have to handle the response returned by OCR Plugin:

  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode == REQUEST_CAMERA_INPUT) {
      if ((resultCode == RESULT_OK) && (data != null)) {//got text!
        String text = data.getStringExtra("text");
        //now capture text is stored in 'text', do whatever is needed...
      } else if (resultCode == RESULT_CANCELED) {//cancelled or error
        if (data != null) {
          String reason = data.getStringExtra("reason");
          if (reason != null) {
          //print the error, if needed
Share Share on Facebook Share on Twitter Bookmark on Reddit Share via mail
Terms and conditions | Privacy policy