Skip to content

Huawei

The latest Huawei handsets such as the P40 family of phones do not use FCM for push notifications and instead use Huawei Cloud Messaging (HCM). If you want to message all of your Android users, including those using Huawei phones, then in addition to configuring FCM you also need to configure HCM as described in this section.

First, complete your integration as described in the Android SDK integration guide, then:

  1. Set up an app on the Huawei Mobile Developer Console
  2. Configure Push in the Kumulos Agency Console
  3. Add Huawei Mobile Services dependencies, files, and plugins to your project
  4. Add Huawei-specific manifest entries

All other push behavior & customization works identically to FCM.

Huawei Mobile Developer Console

To begin, configure a project on the Huawei Developer Console, and enable the Push feature by following the Push Kit developer guide step 1.

Note that your app needs a valid signing configuration for both debug and release builds. The SHA-256 fingerprint of your signing key is required to match the Huawei app configuration prior to continuing.

Once you have created the app, configure the HCM gateway in Kumulos. Expand 'Messaging' in the left menu and select 'Configuration' and click the cog next to the Huawei icon. You need to enter the App ID and App Secret from the Huawei Developer Console.

HMS AppGallery Connect Credentials

Integration

Once configured, now add the agconnect-services.json file (downloaded from the Huawei developer console) to your Android application directory.

Next, add the Huawei repository and plugin dependency to your root build.gradle:

buildscript {
    repositories {
        ...
        maven {
            url 'https://developer.huawei.com/repo/'
        }
    }
    dependencies {
        ...
        classpath 'com.huawei.agconnect:agcp:1.2.1.301'
    }
}

allprojects {
    repositories {
        ...
        maven {
            url 'http://developer.huawei.com/repo/'
        }
    }
}

Next, in your app-level build.gradle, add the HMS Push Kit dependency and apply the HMS plugin:

dependencies {
    ...
    implementation 'com.huawei.hms:push:6.1.0.300'
}

// Add to bottom of file
apply plugin: 'com.huawei.agconnect'

Finally, add the HMS push service to your AndroidManifest.xml:

<!-- Kumulos HMS Messaging Service -->
<service
    android:name="com.kumulos.android.HmsMessagingService"
    android:exported="false">
    <intent-filter>
        <action android:name="com.huawei.push.action.MESSAGING_EVENT" />
    </intent-filter>
</service>

Push registration should be performed as with FCM.

Troubleshooting

  • Whilst the Kumulos SDK minSdk is 16, when you use the HMS Push Kit, the minSdk will need to be 17 for your app
  • Ensure the app signing key fingerprint matches in the Huawei developer console
  • Ensure the app package matches the configuration in the Huawei developer console
  • Ensure the Push Kit service is enabled for your app in AppGallery Connect > App > Develop > Grow > Push Kit. You must enable the service and choose a data storage location.