CTHUAWEIPUSH.md

September 26, 2025 ยท View on GitHub

๐Ÿ‘‹ Introduction

(Back to top)

CleverTap Huawei Push SDK provides an out of the box service to use the Huwaei Push Kit.

ยฎ๏ธ Register

(Back to top)

The first step to access the Huawei cloud push is registered as a Huawei developer on the Huawei Website.

๐Ÿ”จ Enable Push Kit

(Back to top)

Once you login to the console, enable the Push Kit.

๐Ÿš€ Integration

(Back to top)

Download the agconnect-services.json file from the Huawei Console. Move the downloaded agconnect-services.json file to the app directory of your Android Studio project.

  • Add the following dependency to your Project-level build.gradle file
buildscript {
    repositories {
        // FOR HUAWEI ADD THIS
        maven {url 'http://developer.huawei.com/repo/'}
        
    }
    dependencies {
        // FOR HUAWEI ADD THIS
        classpath "com.huawei.agconnect:agcp:1.9.1.301"
    }
}

allprojects {
    repositories {
        // FOR HUAWEI ADD THIS
        maven {url 'https://developer.huawei.com/repo/'}
       }
}
  • Add the following to your appโ€™s build.gradle file
implementation "com.clevertap.android:clevertap-hms-sdk:1.5.1"
implementation "com.huawei.hms:push:6.11.0.300"

//At the bottom of the file add this
apply plugin: 'com.huawei.agconnect'

  • Add the following to your AndroidManifest.xml file of the application
<meta-data
    android:name="CLEVERTAP_PROVIDER_1"
    android:value="@string/hps_manifest_entry" />
  • Note: If you are using CleverTapAPI.instanceWithConfig for initialisation, make sure it is done in Application class before any activity is created.

  • If you are using Custom HmsMessageService class then inside the onNewToken method, pass the token to CleverTap using the following code

override fun onNewToken(token: String?, bundle: Bundle?) {
    super.onNewToken(token, bundle)
    if (token != null) {
        cleverTapAPIInstance.pushRegistrationToken(token, HmsConstants.HPS, true)
    }
}