setOnOpenedCallback method

void setOnOpenedCallback(
  1. NotificationCallback? callback
)

Sets the callback for notifications that open the app.

This callback will be called when a notification causes the app to open from a background or terminated state. This method allows changing the callback after initialization.

Parameters:

  • callback: Function that receives a RemoteMessage containing the notification data

Example:

SuperFCM.instance.setOnOpenedCallback((message) {
  print('App opened from notification: ${message.notification?.title}');
  // Navigate to appropriate screen based on notification data
});

Implementation

void setOnOpenedCallback(NotificationCallback? callback) {
  logger.d('Setting new onOpened callback');
  _onOpenedCallback = callback;
}