By default, the Insider SDK displays a system notification when a push is received. However, some apps render their own in-app notification UI while the app is in the foreground. In such cases, you need a way to trigger push open tracking and deeplink handling without displaying a system notification.
The triggerPushProcessWithNotificationData method solves this by processing the push payload directly.
Usage
Call this method when the user taps your custom in-app notification UI:
// Inside your FirebaseMessagingService or custom notification handler
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
Map<String, String> data = remoteMessage.getData();
if (isAppInForeground()) {
// Show your own in-app notification UI
showInAppNotification(data);
} else {
// Let Insider handle the notification normally
Insider.Instance.handleFCMNotification(getApplicationContext(), remoteMessage);
}
}
// When the user taps your in-app notification
private void onInAppNotificationClicked(Map<String, String> notificationData) {
Insider.Instance.triggerPushProcessWithNotificationData(context, notificationData);
}
Parameters
Parameter | Type | Description |
|---|---|---|
context | Context | Android context (Activity or Application context) |
notificationData | Map<String, String> | The push notification payload data from the push provider |
Behavior
When triggerPushProcessWithNotificationData is called:
Validates the notification data: Checks that the payload is non-null and originates from Insider (source: "Insider").
Does not display a system notification.
If the app is in the foreground and the SDK state is valid (GDPR compliant, SDK not frozen):
Triggers push open tracking (push log).
Executes deep link and related actions.
Fires the push notification received callback.
If the app is in the background: Stores the notification data for processing on the next app launch.
This method only processes the notification payload. It does not render a system notification. Use the standard handleFCMNotification method if you need the SDK to display the notification
Comparison with handleFCMNotification
Feature | handleFCMNotification | triggerPushProcessWithNotificationData |
|---|---|---|
Displays system notification | Yes | No |
Triggers push open tracking | Yes | Yes |
Executes deeplink actions | Yes | Yes |
GDPR compliance check | Yes | Yes |
Background state handling | Yes | Yes |
Prerequisites
The notification data must contain "source": "Insider" to be recognized as an Insider push.
GDPR consent must be granted and the SDK must not be in a frozen state.