> For the complete documentation index, see [llms.txt](https://docs.payments.thalescloud.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/get-started/configuration/5.-push-notifications/configure-push-provider.md).

# Configure push provider

## Set up FCM

Follow Google’s guide: [Setting up a FCM client app on Android](https://firebase.google.com/docs/cloud-messaging/android/client).

At a high level:

1. Create a Firebase project and register your Android application.
2. Add Firebase to your Android project.
3. Implement a service extending `FirebaseMessagingService`:
   1. Override `onNewToken` to support the push token update
   2. Override `onMessageReceived` to handle push notification from NFC Wallet backend.
4. Declare the service in your application manifest.

{% code title="FcmService.java" expandable="true" %}

```java
public class FcmService extends FirebaseMessagingService {

    @Override
    public void onNewToken(@NonNull final String token) {
        super.onNewToken(token);

        // Notify the NFC Wallet SDK about the new token.
        updateToken(this, token);
    }

    @Override
    public void onMessageReceived(@NonNull final RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);

        // Route the push payload to your common handler.
        processIncomingMessage(this, remoteMessage.getData());
    }
}
```

{% endcode %}

## Set up HMS Push Kit

For Huawei devices without Google Play services, configure HMS Push Kit.

Follow Huawei’s guide: [HMS Push Kit (Android) Codelabs](https://developer.huawei.com/consumer/en/codelab/HMSPushKit).

{% hint style="warning" %}
To route messages correctly, prefix HMS tokens with `HMS:`.
{% endhint %}

At a high level:

1. Enable Push Kit for your application in [AppGallery Connect](https://developer.huawei.com/consumer/en/service/josp/agc/index.html).
2. Integrate HMS Core SDK into your **digital wallet application**.
3. Implement a service extending `HmsMessageService`:
   1. Override `onNewToken` to support the push token update
   2. Override `onMessageReceived` to handle push notification from NFC Wallet backend..
4. Declare the service in your application manifest.

{% code title="HmsService.java" expandable="true" %}

```java
public class HmsService extends HmsMessageService {

    // Use "HMS:" prefix for HMS Push Kit token
    private static final String HMS_TOKEN_PREFIX = "HMS:";

    @Override
    public void onNewToken(final @NonNull String token) {
        super.onNewToken(token);

        // Notify the NFC Wallet SDK about the new token.
        updateToken(this, HMS_TOKEN_PREFIX + token);
    }

    @Override
    public void onMessageReceived(@NonNull final RemoteMessage remoteMessage) {
        super.onMessageReceived(remoteMessage);

        // Route the push payload to your common handler.
        processIncomingMessage(this, remoteMessage.getDataOfMap());
    }
}
```

{% endcode %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.payments.thalescloud.io/nfc-wallet-sdk-android/get-started/configuration/5.-push-notifications/configure-push-provider.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
