sgeraDocs
Push notifications

Huawei

Deliver notifications to Huawei devices using HMS Push Kit.

The Msgera Huawei SDK uses HMS Push Kit to deliver notifications to Huawei phones and tablets without Google Play Services.

1. Configure AppGallery Connect credentials

In Huawei AppGallery Connect, enable Push Kit for your project and copy your App ID and Client Secret into your Push App's Platforms → Huawei card in the Msgera dashboard. Place agconnect-services.json in app/src/main/assets/, or apply the AGConnect plugin. Declare the Maven repositories in settings.gradle.kts. New Android projects reject repositories declared in app/build.gradle.kts.

2. Add the Gradle dependency

dependencyResolutionManagement {
    repositories {
        google()
        mavenCentral()
        maven("https://jitpack.io")
        maven("https://developer.huawei.com/repo/")
    }
}

// app/build.gradle.kts
dependencies {
    implementation("com.github.msgera.push-sdks:android-huawei:1.1.0")
}

3. Initialize & request permission

The SDK reads client/app_id directly from agconnect-services.json when hmsAppId is omitted:

import android.app.Application
import io.msgera.push.huawei.MsgeraHuaweiPush

class MainApplication : Application() {
    override fun onCreate() {
        super.onCreate()
        MsgeraHuaweiPush.init(this, "YOUR_PUBLIC_ID")
    }
}