4 Star 69 Fork 21

华为移动服务 / hms-scan-demo

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
Cancel
Notice: Creating folder will generate an empty file .keep, because not support in Git
Loading...
README.md

HMS Core Scan Kit Sample Code (Android)

English | 中文

Contents

Introduction

The sample code shows how to quickly build barcode scanning functions into an app using the capabilities in HMS Core Scan Kit.

You can use HMS Toolkit to quickly run the sample code. HMS Toolkit supports one-stop kit integration, and provides functions such as free app debugging on remote real devices. To learn more about HMS Toolkit, please refer to the HMS Toolkit documentation.

Preparations

  1. Create an app and configure its information in AppGallery Connect. For details, please refer to Configuring App Information in AppGallery Connect.

  2. Add the AppGallery Connect configuration file of your app.

  3. Configure the Maven repository address for the HMS Core SDK.

Environment Requirements

Android Studio 3.0 or later and JDK 1.8.211 or later A device that runs EMUI 3.0 or later and is compatible with HMS Core (APK) 4.0.0.200 or later

Sample Code

The demo shows the following modes for barcode scanning in different scenarios:

  1. Default View

In this mode, your app will call activities provided by this kit and obtain the scanning result through an asynchronous callback API. Users will be able to scan barcodes directly with the camera or from local images imported to the app.

Find the sample code for this mode in example/scankitdemo/MainActivity.java.

  1. Customized View

In this mode, your app will create a RemoteView object and obtain the scanning result through an asynchronous callback API. Users will be able to scan barcodes directly with the camera or from local images imported to the app.

Find the sample code for this mode in example/scankitdemo/DefinedActivity.java.

  1. Bitmap

In this mode, your app will implement bitmap-based barcode scanning and obtain the scanning result through related APIs. Your app will be able to obtain bitmaps by starting the camera or importing local images, and decode the bitmaps by calling decodeWithBitmap.

Find the sample code for this mode in example/scankitdemo/CommonActivity.java and example/scankitdemo/CommonHandler.java.

  1. MultiProcessor

When working together with ML Kit, Scan Kit provides the capability of detecting both barcodes and human faces. Frame data is transmitted and decoded through MultiProcessor APIs.

Find the sample code for this mode in example/scankitdemo/CommonActivity.java and example/scankitdemo/CommonHandler.java.

  1. Generating barcodes

Call the buildBitmap API to generate barcodes.

Find the sample code for barcode generation in example/scankitdemo/GenerateCodeActivity.java.

Result

Technical Support

You can visit the Reddit community to obtain the latest information about HMS Core and communicate with other developers.

If you have any questions about the sample code, try the following:

  • Visit Stack Overflow, submit your questions, and tag them with huawei-mobile-services. Huawei experts will answer your questions.
  • Visit the HMS Core section in the HUAWEI Developer Forum and communicate with other developers.

If you encounter any issues when using the sample code, submit your issues or submit a pull request.

License

The sample code is licensed under Apache License 2.0.

About

华为统一扫码服务示例代码。提供便捷的条形码和二维码扫描、解析、生成能力,支持Default View、Customized View、Bitmap和MultiProcessor等四种扫码方式和生成码方式。 expand collapse
Java and 2 more languages
Apache-2.0
Cancel

Releases

No release

hms-scan-demo

Contributors

All

Activities

Load More
can not load any more
Java
1
https://toscode.gitee.com/hms-core/hms-scan-demo.git
git@toscode.gitee.com:hms-core/hms-scan-demo.git
hms-core
hms-scan-demo
hms-scan-demo
master

Search