# Huawei Push Kit

This is the guide for using [Huawei Push Kit](https://developer.huawei.com/consumer/en/hms/huawei-pushkit/) to receive notifications from Stream Chat.

## Configuring Notifications on the Stream Dashboard

To be able to receive notifications from Stream, you need to [provide your Huawei credentials to Stream](https://getstream.io/docs/platform/push-providers/).

Go to the [Huawei Console](https://developer.huawei.com/consumer/cn/service/josp/agc/index.html#/myProject), and select the project your app belongs to.

<Admonition type="info">

If you don't have a Huawei project yet, you'll have to create a new one.

</Admonition>

Click on **Project settings** and navigate to the **General information** tab. Under **App Information**, locate the **App ID** and **App secret**, and copy them:

![Locating your Huawei credentials](https://getstream.io/docs-assets/images/c53b873f9f3c.png)

Open the [Stream Dashboard](https://getstream.io/signin/?product=video). Navigate to the Chat **Overview** page for your app.

![Navigating to the Chat Overview page on the Stream Dashboard](https://getstream.io/docs-assets/images/3f58a7d5c327.png)

Scroll down and enable the **Huawei** switch. Paste your **App ID** and **App secret**, and click **Save** to confirm your changes.

![Setting up your Huawei App ID and App Secret on the Stream Dashboard](https://getstream.io/docs-assets/images/cf234579b34d.png)

With that, you're done setting up on the dashboard. Next, you need to add the client-side integration.

## Receiving Notifications in the Client

Start by [adding Huawei to your Android project](https://developer.huawei.com/consumer/en/doc/development/AppGallery-connect-Guides/agc-get-started-android-0000001058210705). You only need to set up the Huawei Push Kit dependencies and add a _agconnect-services.json_ file to your project source directory.

Stream Video for Android ships an artifact that allows quick integration of Huawei Push Kit messages. Add the following dependency to your app's `build.gradle` file:

```groovy
repositories {
    maven { url 'https://developer.huawei.com/repo/' }
}

dependencies {
    implementation "io.getstream:stream-android-push-huawei:$stream_version"
}
```

Then, add a `HuaweiPushDeviceGenerator` to your `NotificationConfig`, and pass that into `StreamVideoBuilder` when initializing the SDK:

<Tabs>

<Tab value="kotlin" label="Kotlin">

```kotlin {3-7,15}
val notificationConfig = NotificationConfig(
    pushDeviceGenerators = listOf(
        HuaweiPushDeviceGenerator(
            context = context,
            appId = "YOUR HUAWEI APP ID",
            providerName = "huawei",
        )
    )
)
StreamVideoBuilder(
    context = context,
    user = user,
    token = token,
    apiKey = apiKey,
    notificationConfig = notificationConfig,
).build()
```

</Tab>

<Tab value="java" label="Java">

```java
List<PushDeviceGenerator> pushDeviceGeneratorList = Collections.singletonList(new HuaweiPushDeviceGenerator(context, "YOUR HUAWEI APP ID", "huawei"));
NotificationConfig notificationConfig = new NotificationConfig(pushDeviceGeneratorList);
new StreamVideoBuilder(
        context,
        user,
        token,
        apiKey,
        notificationConfig,
    ).build();
```

</Tab>

</Tabs>

<Admonition type="warning">

Make sure that _StreamVideo_ is always initialized before handling push notifications. We highly recommend initializing it in the `Application` class.

</Admonition>

That's all you have to do to integrate the Huawei push provider artifact.

### Using a Custom Huawei Messaging Service

The Stream Huawei push provider artifact includes `ChatHuaweiMessagingService`, an `HmsMessageService` implementation that sends new Huawei tokens to Stream and forwards incoming push messages to `StreamVideo` to handle.

<Admonition type="info">
The `Chat` prefix in the class name is legacy naming. This service works with all Stream SDKs including Video and Chat. The naming will be updated in a future release.
</Admonition>

If you're using Huawei notifications for other purposes inside your app as well, you will need your own custom service to replace `ChatHuaweiMessagingService`. Here, you have to call `HuaweiMessagingDelegate`'s `registerHuaweiToken` and `handleRemoteMessage` methods, like so:

<Tabs>

<Tab value="kotlin" label="Kotlin">

```kotlin {6,14}
class CustomHuaweiMessagingService : HmsMessageService() {

    override fun onNewToken(token: String) {
        // Update device's token on Stream backend
        try {
            HuaweiMessagingDelegate.registerHuaweiToken(token, "huawei")
        } catch (exception: IllegalStateException) {
            // StreamVideo was not initialized
        }
    }

    override fun onMessageReceived(message: com.huawei.hms.push.RemoteMessage) {
        try {
            if (HuaweiMessagingDelegate.handleRemoteMessage(message)) {
                // RemoteMessage was from Stream and it is already processed
            } else {
                // RemoteMessage wasn't sent from Stream and it needs to be handled by you
            }
        } catch (exception: IllegalStateException) {
            // StreamVideo was not initialized
        }
    }
}
```

</Tab>

<Tab value="java" label="Java">

```java
public final class CustomHuaweiMessagingService extends HmsMessageService {
    @Override
    public void onNewToken(String token) {
        // Update device's token on Stream backend
        try {
            HuaweiMessagingDelegate.registerHuaweiToken(token, "huawei");
        } catch (IllegalStateException exception){
            // StreamVideo was not initialized
        }
    }

    @Override
    public void onMessageReceived(com.huawei.hms.push.RemoteMessage remoteMessage) {
        try {
            if (HuaweiMessagingDelegate.handleRemoteMessage(remoteMessage)) {
                // RemoteMessage was from Stream and it is already processed
            } else {
                // RemoteMessage wasn't sent from Stream and it needs to be handled by you
            }
        } catch (IllegalStateException exception){
            // StreamVideo was not initialized
        }
    }
}
```

</Tab>

</Tabs>

<Admonition type="note">

Your custom service needs to have an [`<intent-filter>` priority](https://developer.android.com/guide/topics/manifest/intent-filter-element#priority) higher than `-1` to replace our default service. (This priority is `0` by default.)

</Admonition>

### Push Notification Payload

Push notifications are delivered as data payloads that the SDK can use to convert into the same data types that are received when working with the APIs.

When a call is started, Stream Server kicks a job that sends a regular data message (as below) to configured push providers on your app. When a device receives the payload, it's passed to the SDK which connects to Stream Video Server to process the the call and show the notification to the final user.

This is the main payload which will be sent to each configured provider:

```javascript
{
  "sender": "stream.video",
  "type": "call.ring | call.notification | call.live_started",
  "call_display_name": "Jc Miñarro",
  "call_cid": "default:77501ea4-0bd7-47d1-917a-e8dc7387b87f",
  "version": "v2",
}
```


---

This page was last updated at 2026-08-17T13:13:31.877Z.

For the most recent version of this documentation, visit [https://getstream.io/video/docs/android/advanced/incoming-calls/push-providers/huawei/](https://getstream.io/video/docs/android/advanced/incoming-calls/push-providers/huawei/).