Push notifications


Register for Push Notifications


Use this method to pass the Firebase Token to Synerise for notifications.

Declared In

lib/modules/notifications/notifications_impl.dart

Method

void registerForNotifications(String registrationToken, bool mobileAgreement)

Parameters

Parameter Type Mandatory Default Description
registrationToken String yes - Firebase Token
mobileAgreement bool yes - Agreement (consent) for mobile push campaigns

Return Value

There is no return value.

Example

FirebaseMessaging.instance.onTokenRefresh.listen((event) {
  FirebaseMessaging.instance.getToken().then((value) {
    if (value != null) {
      Synerise.notifications.registerForNotifications(value, true);
    }
  });
});
FirebaseMessaging.instance.getToken().then((value) {
  if (value != null) {
    Synerise.notifications.registerForNotifications(value, true);
  }
});

Handle Synerise Push Notification


Handles a notification payload and starts activity.

Declared In

lib/modules/notifications/notifications_impl.dart

Method

Future<bool> handleNotification(Map notification) async

Parameters

Parameter Type Mandatory Default Description
notification Map yes - Notification’s key-value data object

Return Value

There is no return value.

Example

FirebaseMessaging.onMessage.listen((RemoteMessage message,) {
  Synerise.notifications.handleNotification(message.toMap());
});

FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
  Synerise.notifications.handleNotificationClick(message.toMap());
});

Handle Synerise Push Notification Click


Handles a notification payload with user interaction and starts activity.

Declared In

lib/modules/notifications/notifications_impl.dart

Method

Future<bool> handleNotificationClick(Map notification) async

Parameters

Parameter Type Mandatory Default Description
notification Map yes - Notification’s key-value data object

Return Value

There is no return value.

Example

FirebaseMessaging.onMessage.listen((RemoteMessage message,) {
  Synerise.notifications.handleNotification(message.toMap());
});

FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
  Synerise.notifications.handleNotificationClick(message.toMap());
});
😕

We are sorry to hear that

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

😉

Awesome!

Thank you for helping improve out documentation. If you need help or have any questions, please consider contacting support.

Close modal icon Placeholder alt for modal to satisfy link checker