6 Star 99 Fork 31

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

Create your Gitee Account
Explore and code with more than 8 million developers,Free private repositories !:)
Sign up
Clone or Download
contribute
Sync branch
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

This sample code shows how to quickly build barcode scanning functions into your app using the capabilities of the HMS Core Scan Kit. Currently, Scan Kit supports the following barcode formats:

Environment Requirements

Android Studio 3.6.1 or later and JDK 1.8.211 or later.

A Huawei device that runs EMUI 3.0 or later, compatible with HMS Core (APK) 4.0.0 or a generic device running Android 4.4 or later.

Sample Code

Barcode scanning and barcode generating can be achieved in different ways, showcased by the demo.

Default view

The default view mode will start a dedicated Activity provided by Scan Kit that will display a predefined UI, control the camera and pass back the scanning result via the onActivityResult() of the original activity (com.example.scankitdemo.MainActivity in the demo) .

Customized view

In customized view mode, you can define a custom UI, with the help of a com.huawei.hms.hmsscankit.RemoteView, and then obtain the scanning result through an asynchronous callback. As with the default view mode, you do not need to worry about developing the scanning process or controlling the camera. See com.example.scankitdemo.DefinedActivity.

Bitmap

Use this mode when you wish to have full control over the input to the scanning process and the moment when you wish to get the results back. In com.example.scankitdemo.CommonActivity , the demo will pass a Bitmap to com.huawei.hms.hmsscankit.ScanUtil.decodeWithBitmap() (definition).

Multi-processor

Recognize multiple barcodes at the same time. When working together with the HMS ML Kit, Scan Kit can detecting both barcodes and human faces. Frame data is transmitted and decoded through the multi-processor API. See com.example.scankitdemo.CommonActivity and read more about how it works.

Generating barcodes

Generate your own barcodes by calling com.huawei.hms.hmsscankit.ScanUtil.buildBitmap() (definition) in com.example.scankitdemo.GenerateCodeActivity.

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://gitee.com/hms-core/hms-scan-demo.git
git@gitee.com:hms-core/hms-scan-demo.git
hms-core
hms-scan-demo
hms-scan-demo
master

Search