smartDefaultBackgroundMessageHandler static method

Future<void> smartDefaultBackgroundMessageHandler(
  1. RemoteMessage message
)

Default background handler. Always displays via AwesomeNotifications for consistent behavior across Android versions, especially Android 13+ (API 33+) where FCM auto-display requires POST_NOTIFICATIONS and silently fails without it.

To avoid duplicate notifications on Android < 13, send data-only messages from your server (omit the notification field).

Implementation

@pragma('vm:entry-point')
static Future<void> smartDefaultBackgroundMessageHandler(
  RemoteMessage message,
) async {
  const Logger('DefaultNotificationHandler')
      .d('[SmartBackgroundHandler] Processing: ${message.messageId}');
  await DefaultNotificationHandler.I.showNotification(message);
}