Skip to main content

Using Multiple Push Providers

The SDK supports multiple push providers simultaneously.

Register additional Firebase Cloud Messaging (FCM) or Huawei Mobile Services (HMS) services using the registerMessagingService() method.

fun registerMessagingService(
messagingService: FirebaseMessagingService / HmsMessageService,
registrationOptions: FirebaseMessagingServiceRegistrationOptions / HuaweiMessagingServiceRegistrationOptions
)
  • messagingService is the service you want to register.
  • registrationOptions is a data class for configuring the registration. It has a single property that either includes or excludes notifications from SAP Engagement.
FirebaseMessagingServiceRegistrationOptions(
val includeEngagementCloudMessages: Boolean = false
)

Strategy for Using Multiple Providers

When supporting both FCM and HMS:

  • Detect the device ecosystem (GMS or HMS) at runtime. Register the relevant messaging service first.
  • Avoid registering both message services as they can lead to redundant tokens and message duplication.
  • Use the includeEngagementCloudMessages flag consistently across services.