Requirements
Huawei mobile app.
PushBots account.
Android studio 2.3+
[optional] Huawei 2020 model or newer to test with.
Step 1: Get HMS credentials:
1. Open AppGallery connect dashboard.
2. Create new Project:
![](../https/downloadsintercomcdncom/i/o/251742337/d1131a33abb460ec2ab366a4/Screen+Shot+2020-10-01+at+18.42.29_1242725963.png)
And enter project name:
![](../https/downloadsintercomcdncom/i/o/251742396/eceafe9b3124b349099a720b/Screen+Shot+2020-10-01+at+18.42.49_390473752.png)
![](../https/downloadsintercomcdncom/i/o/251742529/7b4252271a30dda9323ad084/Screen+Shot+2020-10-01+at+18.43.10_1112309323.png)
Click on Add app, Enter package then fill details and click ok:
![](../https/downloadsintercomcdncom/i/o/251742794/0238fbf3844a6508128ecf7f/Screen+Shot+2020-10-01+at+18.43.47_1246175811.png)
Copy appId, and clientId to be used inside the applicaiton:
![](../https/downloadsintercomcdncom/i/o/251743102/4b14fec5dbb34cd2b9487f0b/Screen+Shot+2020-10-01+at+18.44.20_1195929880.png)
Generate SHA-256 key and add it in app settings:
From Android Studio open View > Tool Windows > Gradle
select app > Tasks > android > signingReport
Copy your
SHA-256
for yourrelease
variant.
Step 2: Enable Push kit:
Click on Push kit then click on Enable now
![](../https/downloadsintercomcdncom/i/o/251743713/aacd6a66e864df820a61d984/Screen+Shot+2020-10-01+at+18.58.46_1078667595.png)
![](../https/downloadsintercomcdncom/i/o/251743805/7232b327527918582be6e59e/Screen+Shot+2020-10-01+at+18.58.53_1178760000.png)
Step 4: Add Huawei Gradle Plugin and Dependencies
build.gradle (project)
allprojects { repositories { maven { url 'http://developer.huawei.com/repo/' } } }
Step 5: Import the PushBots library into your project:
Follow instructions in this link:
Open build.gradle (Module: app) file:
1. Comment firebases-messaging dependency:
//implementation 'com.google.firebase:firebase-messaging:20.2.4'
2. Add HMS push kit dependency, and make sure you're using pushbots-lib 3.3.5-beta2+ for HMS support:
implementation 'com.pushbots:pushbots-lib:3.3.5-beta2@aar'
implementation 'com.huawei.hms:push:5.0.0.300'
3. Replace senderid with HMS clientId:
new Pushbots.Builder(this)
.setLogLevel(Pushbots.LOG_LEVEL.DEBUG)
.setPushbotsAppId("5df0d5c74a6d71055f2ede44")
.setSenderId("HMS_CLIENT_ID")
.build();
4. Add HMS appid in manifest file inside <application tag:
<meta-data
android:name="com.huawei.hms.client.appid"
android:value="appid=HMS-APPID" />
Compile the application to release in appgallaery.