Giter Club home page Giter Club logo

hms-scan-demo's Introduction

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.

hms-scan-demo's People

Contributors

bugfactory9527 avatar chenjingming1 avatar ferprieto avatar gwwhuawei avatar hms-mlkit avatar hms-scankit avatar huawei-mobile-services-core avatar luckyduby avatar mike-mei avatar tiantian0303 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.