English | 中文
In this sample code, you will use the created demo project to call APIs of Push Kit. Through the demo project, you will:
- Obtain a token of Push Kit.
- Receive notification messages or data messages from Push Kit.
For more information, please refer to Service Introduction.
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 the integration by HMS Toolkit, please refer to the related section.
- Register as a Huawei developer.
- Create an app and start APIs.
- Import your demo project to Android Studio (Chipmunk | 2021.2.1) or later. Download the agconnect-services.json file of the app from AppGallery Connect, and add the file to the app-level directory (java language is '/javaapp/', kotlin language is '/KotlinApp/') of your project. Generate a signing certificate fingerprint, add the certificate file to your project, and add the configuration to the build.gradle file. For details, please refer to the integration preparations.
To use the functions provided in the sample code, install HMS Core (APK) 4.0 on your phone in one of the following methods: Method 1: Compile and build the APK in Android Studio. Then, install the APK on your phone and debug it. Method 2: Generate the APK in Android Studio. Use the Android Debug Bridge (ADB) tool to run the adb install {YourPath/YourApp.apk} command to install the APK on your phone and debug it.
Android targetSdkVersion 33 or later and JDK 1.8.211 or later are recommended.
A computer (desktop or laptop) running Windows 10 or Windows 7 A Huawei phone with a USB data cable, which is used for debugging
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.
The sample code is licensed under Apache License 2.0.