HUAWEI HiAI is an open AI capability platform for smart devices, with 3-layer AI ecosystem that provides capabilities at chip, device and cloud level, thus accelerating your development cycle and making apps smarter.
HiAI Engine provides a wide range of open AI capabilities for app integration, including General Text Recognition which powers apps to:

For more information, please visit our official website at the following URL:

What You Will Create

In this codelab, you may use this API to develop an Android app that can extract text information from images.

For example:

What You Will Learn

What You Will Need

Hardware Requirements

Software Requirements

Step 1: Install

Click the File -> "Settings" -> "Plugins" -> "Marketplace"

Enter " HMS Toolkit " to search for the plugin and install it.

Step 2: Restart Android Studio

Click "Restart"

Step 1: Import the project from official site.

Download via the link below:


Step 2: Open up the TextDetectActivity in the project

Step 1: Open the Coding Assistant

Click "HMS" "Coding Assistant",and login to Huawei account

Step 2: Select "AI" "HUAWEI HiAI Engine"

Step 3: Click General Text Recognition to enter the detail page

Step 4: Drag the code to the project

Drag the code block 1.Initialization to the project initHiai(){ } method

Drag code block 2.API call to the project setHiAi (){ } method

After the project sync, select your device as deployment target, and click the "Run" icon to install and start sample application. You may start to experience and test now. See as follows:

Code copied