bryantvu / Calculator-App-1

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Calculator App

Table of Contents

Introduction

This demo showcases the integration process and functions of Huawei IAP using the non-consumable product to remove ads and Huawei Push Kit.

The products in the demo are only used to demonstrate the purchase process, and will not be put into commercial use.

You can use the 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. For details about HMS Toolkit, please refer to the HMS Toolkit documentation.

Setup

This portion is for those that want to setup the demo with their own web host. Please use ‘app-release-signed.apk’ if you just want to test the demo as is.

Huawei Developer Account

A Huawei Developer Account is needed to access and configure Huawei IAP and Push Kit (optional). You will need to create an account if you don’t already have one. Please refer to this guide.

  1. Install Android Studio on your computer. Use Android Studio to open the project-level build.gradle file of the sample code.
  2. Create an app in AppGallery Connect and configure the app information. For details, please refer to Configuring App Information in AppGallery Connect.
  3. Create and configure your products in AppGallery Connect. For details, please refer to Configuring Your Products.
  4. Import the demo to Android Studio 3.0 or later and build the demo.
  5. Configure the sample code:
  • Download the agconnect-services.json file of your app from AppGallery Connect, and add the file to the app-level directory of the demo.
  • Add the signing certificate and add configurations to the app-level build.gradle file.
  • Open the AndroidManifest file and change the package name to your app package name.
  • Replace PUBLIC_KEY in the CipherUtil class with the public key of your app. For details about how to obtain the public key, please refer to Querying IAP Information.
  • Replace the products in this demo with your products.
  1. Run the sample code on an Android device or simulator.
  2. (Optional) For push messages:
  • Uncomment the following code inside of the getToken() method in MainActivity.java
     myClipboard = (ClipboardManager) getSystemService(CLIPBOARD_SERVICE);
     myClip = ClipData.newPlainText("Push token", pushtoken);  
     myClipboard.setPrimaryClip(myClip);

Environment Requirements

Minumum Android SDK 22 and JDK 1.8 are recommended.

License

This Android sample code is licensed under the Apache License, version 2.0

Acknowledgements

The code in this project has been modified from Huawei IAP Demo and Android Browser Helper. Their contributions are greatly appreciated.

Questions

If you have a questions - Stack Overflow is the best place for any programming inquiries. Be sure to include the tag huawei-mobile-services.

About

License:Apache License 2.0


Languages

Language:Java 88.4%Language:HTML 11.6%