enablePushEngagementTracking method
Enable push notification engagement tracking.
onNotificationTapped is called when the user taps a notification.
The callback receives a RelevaNotificationAction with parsed navigation
fields (target, screen, url, parameters). The app must handle
navigation based on these fields.
Engagement tracking always happens automatically before the callback.
Implementation
Future<void> enablePushEngagementTracking({
required Function(RelevaNotificationAction) onNotificationTapped,
}) async {
await EngagementTrackingService.instance.initialize(
onNotificationTapped: onNotificationTapped,
);
// Subscribe to FCM token rotation and lifecycle resume events so the
// backend's record stays in sync with FCM's silently-rotating token.
// Without this, a backgrounded-then-resumed app (no cold start) never
// re-uploads, which is the most common cause of "registration-token-not-
// registered" when sending pushes to iOS.
await PushTokenRefresher.instance.initialize(this);
}