Configure push provider
Last updated
Was this helpful?
Follow Google’s guide: Setting up a FCM client app on Android.
At a high level:
Create a Firebase project and register your Android application.
Add Firebase to your Android project.
Implement a service extending FirebaseMessagingService:
Override onNewToken to support the push token update
Override onMessageReceived to handle push notification from NFC Wallet backend.
Declare the service in your application manifest.
For Huawei devices without Google Play services, configure HMS Push Kit.
Follow Huawei’s guide: HMS Push Kit (Android) Codelabs.
To route messages correctly, prefix HMS tokens with HMS:.
At a high level:
Enable Push Kit for your application in AppGallery Connect.
Integrate HMS Core SDK into your digital wallet application.
Implement a service extending HmsMessageService:
Override onNewToken to support the push token update
Override onMessageReceived to handle push notification from NFC Wallet backend..
Declare the service in your application manifest.
Last updated
Was this helpful?
Was this helpful?
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());
}
}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());
}
}