Skip to main content

Push Integration

The SAP Engagement Cloud SDK supports push messages with rich content such as long text, images, and actions. These actions include push-to-in-app campaigns, opening external URLs, custom event tracking, and more.

A device must meet the following prerequisites to receive push notifications:

  • The device registers with the platform-specific provider and, on success, receives a pushToken. The provider forwards messages sent with this token to the device.
  • The application asks the user for consent to display push messages. If the user denies consent, the application does not show notifications, even if the rest of the requirements are met.
  • The pushToken is registered to the contact profile by calling the registerToken method provided by the SDK.

Prerequisites

  • Add the required dependencies for the selected provider(s) to your project
  • If you support Android API levels above 26, set up your notification channels within your application.
  • To integrate multiple push providers, see Using Multiple Push Providers.
  • For FCM, download the google-services.json from Firebase and include it in the application.
  • For HMS, download the agconnect-services.json from Huawei and include it in the application.

Registering for Push Notifications

If you support Android API levels above 26, set up your notification channels within your application.

The SDK's FCM and HMS library modules include the required messaging service declarations in their own AndroidManifest.xml files. These are automatically merged into your application manifest by the Android build system — you do not need to declare them manually.

note

In case of HMS, the SDK automatically enables the hms-push-kit, you can overwrite it by following the Official Guide

note

For working push integration Google Services Plugin is required: verify that you have included Google Services Plugin (com.google.gms.google-services) in your app's build.gradle file's plugins section.

Once the SDK dependency is added, the application receives a pushToken when the application is started. By default the SDK tracks the pushToken automatically when enable is called.

Custom Push Notification Icon

By default, the SDK uses a built-in notification icon. To display your own custom icon for push notifications, add a meta-data entry inside the <application> tag of your AndroidManifest.xml:

<meta-data
android:name="com.sap.ec.small_notification_icon"
android:resource="@drawable/notification_icon" />

Replace @drawable/notification_icon with a reference to your own drawable resource.

Push Lifecycle

PhaseAndroid/iOSWeb
Permission PromptSystem dialogBrowser notification permission
Token FetchFCM/HMS/APNs callbackService worker subscription
RegistrationregisterTokenregisterToken
DeliveryOS routes and displaysService worker displays

Campaign Action Types

  • Launch activity or deep link
  • Open external URL
  • Trigger custom event
  • Show in-app message (push-to-inapp)

Reliability Practices

PracticeBenefit
Early token registrationEnsures campaigns reach first session
Channel importance audit (Android)Avoid silent demotion
Delegate chain verification (iOS)Prevent lost tracking

Rich Content Considerations

  • Validate image URL reachability (HEAD request) on the server side before sending.
  • Provide alternative fallback text for screens with limited space and for accessibility reasons.

Token Rotation Handling

On Android and iOS, token rotation is handled automatically via provider callbacks. On Web, browser subscription changes trigger re-registration. Do not poll for token updates.

Monitoring Recommendations

Track the following information internally:

  • Registration success timestamp
  • Last token change
  • Delivery success events (future event types)