Documentation
Table of contents

Thanks for downloading Dynamsoft Label Recognizer Package!

Your download will start shortly. If your download does not begin, click here to retry.

Dynamsoft Label Recognition - Android User Guide

System Requirements

  • Operating systems:
    • Supported OS: Android 5 or higher (Android 7 or higher recommended)
    • Supported ABI: armeabi-v7a, arm64-v8a, x86, x86_64

Installation

Download the Dynamsoft Label Recognition SDK from the Dynamsoft website and unzip the package. The package includes a free trial license valid for 30 days.

Getting Started: Hello World

  1. Create a new Android project in Android Studio.

  2. Import the DynamsoftLabelRecognitionAndroid.aar package into the new project. To manually import the .aar:

    i. Locate DynamsoftLabelRecognitionAndroid.aar in the downloaded android zip. ii. Put the .aar file under the libs directory in the project. iii. In the project, open build.gradle(Module: app) and add the following code:

     repositories {
         flatDir {
         dirs 'libs'
         }
     }
    

    iv. Add .aar reference in the dependencies:

     implementation(name: 'DynamsoftLabelRecognitionAndroid', ext: 'aar')
    

    v. Click Sync Now. After the synchronization completes, DynamsoftLabelRecognitionAndroid.aar is added to the project.

  3. Add the following code to initiate and use the Dynamsoft Label Recognition SDK.

     import com.dynamsoft.dlr.*;
     public class MainActivity extends AppCompatActivity { 
         private LabelRecognition mRecognition;
         @Override
         protected void onCreate(Bundle savedInstanceState)  {
             super.onCreate(savedInstanceState);
             setContentView(R.layout.activity_main);
             try {
                 mRecognition = new LabelRecognition("<insert DLR license key here>");
                 DLRResult[] results = mRecognition.recognizeByFile("<full image path>", "");
    
                 if (results != null && results.length > 0) {
                     String strCurResult = "";
                     for (int i = 0; i < results.length; i++) {
                         strCurResult += "["+i+"] :\n";
                         for (int j = 0; j < results[i].lineResults.length; j++) {
                             strCurResult += results[i].lineResults[j].text + "\n";
                         }
                     }
                     Log.i("DLR", strCurResult);
                 }
                 else {
                     Log.i("DLR", "No results returned.");
                 }
             } 
             catch (Exception ex) {
                 ex.printStackTrace();
             }
         }
     }
    

    Please replace <insert DLR license key here> with your DLR license key. If you do not have a valid license, please request a trial license through the customer portal.

    In the snippet above, <full image path> should also be replaced with the full path to the image you’d like to recognize.

  4. Run the project.

This page is compatible for:

Version 7.5.0

Is this page helpful?

YesYes NoNo

In this article:

version 1.2.1

  • Latest version
  • Version 2.2.20
  • Version 2.0.0
  • Version 1.2.1
  • Version 1.2
  • Version 1.0
Change +
© 2003–2024 Dynamsoft. All rights reserved.
Privacy Statement / Site Map / Home / Purchase / Support