PushMessagingService

Package 

com.salesforce.marketingcloud.pushfeature.push

Module 

Push Feature Module v2.0.0

SDK 

Salesforce Marketing Cloud Unified SDK 11.0.0


Class Declaration 

1class PushMessagingService : FirebaseMessagingService

Description 

A Firebase Cloud Messaging service implementation for handling push notifications within the PushFeature module.

This service extends FirebaseMessagingService to provide integration between Firebase Cloud Messaging and the PushFeature module, managing token refresh events and incoming push messages.

Key Responsibilities 

  • Handling new FCM token generation
  • Processing incoming push messages
  • Forwarding events to the PushFeature module
  • Logging and error handling for FCM events

Integration 

  • Extends FirebaseMessagingService for FCM integration
  • Integrates with PushFeature module for token management
  • Provides logging through SFMC SDK logging system
  • Supports testing through visible methods

Lifecycle 

This service is managed by the Android system and Firebase SDK. It will be automatically started when FCM events occur.

Since 

1.0.0

See Also 

  • FirebaseMessagingService
  • PushFeature
  • PushMessageManager

Constructors 

PushMessagingService 

1constructor()

Default constructor for the service.


Methods 

onMessageReceived 

1open override fun onMessageReceived(message: RemoteMessage)

Called when a new push message is received.

Parameters:

  • message: RemoteMessage - The incoming remote message from FCM

onNewToken 

1open override fun onNewToken(token: String)

Called when a new FCM token is generated.

Parameters:

  • token: String - The new FCM registration token

Usage Example 

To use this service in your Android application, add it to your AndroidManifest.xml:

1<service
2    android:name="com.salesforce.marketingcloud.pushfeature.push.PushMessagingService"
3    android:exported="false">
4    <intent-filter>
5        <action android:name="com.google.firebase.MESSAGING_EVENT" />
6    </intent-filter>
7</service>