HMS-Core / hms-wallet-clientdemo-android

Sample code encapsulates APIs of the HUAWEI Wallet Kit client. It provides many sample programs for your reference or usage.

Home Page:https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/wallet-guide-introduction?ha_source=hms1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

HMS Wallet Kit Sample

English | 中文

Table of Contents

Introduction

This sample code invokes HUAWEI Wallet Kit client APIs. It provides many sample methods for your reference or usage.

Installation

Before using the sample code, check whether the android environment has been installed. Decompress the sample code package.

Import the decompressed project to your Android Studio. Refresh and sync the project. Run the sample on Android device or emulator.

Supported Environments

Android Studio 3.X Java JDK(1.8 or later) SDK Platform(26 or later) Gradle(4.6 or later)

Sample Code

The sample code provides two methods for adding passes: Claiming passes by app, quick app, or HUAWEI Wallet CardStore and Claiming passes by web page, SMS message, email, or app.

  1. Claiming passes by app, quick app, or HUAWEI Wallet CardStore: Currently, this mode is available only in the Chinese mainland.
  • Applying for the Wallet Kit Service. Developers need to apply for the Wallet Kit Service. You should apply for a service ID and obtain a certificate, which is used to encrypt pass package. Chinese / English

  • The developer uses the server demo to generate a pass package. A developer needs to generate a voucher package using the server demo. For details about how to generate voucher packages using the server demo, see huawei-wallet-server-windows-passsdk-demo.zip

  • Push the pass package to the Huawei Pay app. The developer replaces createPassData() in TestUtil.java. This step is only used to simulate card adding. In the actual situation, the developer needs to obtain the card and pass package data from the developer server.

  1. Claiming passes by web page, SMS message, email, or app:
  • Applying for the Wallet Kit Service. Developers need to apply for the Wallet Kit Service. You should apply for a service ID and generate a pair of RSA keys (the private key is used to encrypt JWE data). Chinese / English

  • Push models to Huawei servers. This step needs to be performed before the developer uses the demo to add pass instances. For details, see the development guide. Chinese / English

  • Use the demo to convert a pass instance into JWE and push the JWE to the Huawei server. Developers need to replace the private key in Constant.java. The private key is obtained from step 1. The private key is used to encrypt JWE data. After JWE data is generated, it can be pushed to Huawei servers. After the push is successful, users can view the pass card in Huawei Pay.

Question or issues

If you want to evaluate more about HMS Core, r/HMSCore on Reddit is for you to keep up with latest news about HMS Core, and to exchange insights with other developers.

If you have questions about how to use HMS samples, try the following options:

  • Stack Overflow is the best place for any programming questions. Be sure to tag your question with huawei-mobile-services.
  • Huawei Developer Forum HMS Core Module is great for general questions, or seeking recommendations and opinions.

If you run into a bug in our samples, please submit an issue to the Repository. Even better you can submit a Pull Request with a fix.

License

Wallet Kit SDK sample is licensed under the Apache License, version 2.0.

About

Sample code encapsulates APIs of the HUAWEI Wallet Kit client. It provides many sample programs for your reference or usage.

https://developer.huawei.com/consumer/en/doc/development/HMS-Guides/wallet-guide-introduction?ha_source=hms1

License:Apache License 2.0


Languages

Language:Java 100.0%