Campaigns
Set Injector listener
This method sets callbacks for an injector module.
Declared In:
lib/modules/injector/injector_impl.dart
Related To:
InjectorListener
Class:
InjectorImpl
Declaration:
void listener(InjectorListenerFunction listenerFunction)
Discussion:
Learn more about the methods and their purpose of this listener here.
Set In-App Message listener
This method sets callbacks for in-app message campaigns.
Declared In:
lib/modules/injector/injector_impl.dart
Related To:
InjectorInAppMessageListener
Class:
InjectorImpl
Declaration:
void inAppMessageListener(InjectorInAppMessageListenerFunction listenerFunction)
Discussion:
Learn more about the methods and their purpose of this listener here.
Register for push notifications
This method passes the Firebase Token to Synerise for notifications.
API_BY_IDENTIFY_DEVICE_CLIENT_UPDATE
permission from the Client group.Declared In:
lib/modules/notifications/notifications_impl.dart
Class:
NotificationsImpl
Declaration:
Future<void> registerForNotifications(String registrationToken,
{bool? mobileAgreement,
required void Function() onSuccess,
required void Function(SyneriseError error) onError})
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
registrationToken | String | yes | - | Firebase Token |
mobileAgreement | bool | no | null | Agreement (consent) for receiving mobile push campaigns |
onSuccess | Function() | yes | - | Function to be executed when the operation is completed successfully |
onError | Function(SyneriseError error) | yes | - | Function to be executed when the operation is completed with an error |
Return Value:
No value is returned.
registerForPushWithoutAgreement
native method.
The registerForPushWithoutAgreement
method will be used when the mobileAgreement
parameter is not filled.Example:
FirebaseMessaging.instance.onTokenRefresh.listen((event) {
FirebaseMessaging.instance.getToken().then((token) {
if (token != null) {
firebaseToken = token;
Synerise.notifications.registerForNotifications(
firebaseToken!,
mobileAgreement: true,
onSuccess: () {},
onError: (error) {},
);
}
});
});
Handle Synerise push notification
This method handles a notification payload and starts activity.
Declared In:
lib/modules/notifications/notifications_impl.dart
Class:
NotificationsImpl
Declaration:
Future<bool> handleNotification(Map notification) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
notification | Map<String, dynamic> | yes | - | Notification’s key-value data object |
Return Value:
true if the notification is handled properly.
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
This method handles a notification payload with a user interaction and starts activity.
Declared In:
lib/modules/notifications/notifications_impl.dart
Class:
NotificationsImpl
Declaration:
Future<bool> handleNotificationClick(Map notification) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
notification | Map<String, dynamic> | yes | - | Notification’s key-value data object |
Return Value:
true if the notification is handled properly.
Example:
FirebaseMessaging.onMessage.listen((RemoteMessage message,) {
Synerise.notifications.handleNotification(message.toMap());
});
FirebaseMessaging.onMessageOpenedApp.listen((RemoteMessage message) {
Synerise.notifications.handleNotificationClick(message.toMap());
});
Check if push notification is from Synerise
This method verifies if a notification was sent by Synerise.
Declared In:
lib/modules/notifications/notifications_impl.dart
Class:
NotificationsImpl
Declaration:
Future<bool> isSyneriseNotification(Map notification) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
notification | Map | yes | - | Key-Value map of data |
Return Value:
true if the notification is provided by Synerise, otherwise returns false.
Example:
bool isSyneriseNotification = await Synerise.notifications.isSyneriseNotification(remoteMessageMap);
Check if push notification is a Simple Push Campaign
This method verifies if a notification’s sender is Synerise and if the notification is a Simple Push campaign
Declared In:
lib/modules/notifications/notifications_impl.dart
Class:
NotificationsImpl
Declaration:
Future<bool> isSyneriseSimplePush(Map notification) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
notification | Map | yes | - | Key-Value map of data |
Return Value:
true if the notification is Synerise Simple Push provided by Synerise, otherwise returns false.
Example:
bool isSyneriseSimplePush = await Synerise.notifications.isSyneriseSimplePush(remoteMessageMap);
Check if push notification is a Banner Campaign
This method verifies if a notification’s sender is Synerise and if the notification is a Banner campaign.
Declared In:
lib/modules/notifications/notifications_impl.dart
Class:
NotificationsImpl
Declaration:
Future<bool> isSyneriseBanner(Map notification) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
notification | Map | yes | - | Key-Value map of data |
Return Value:
true if the notification is Synerise Banner provided by Synerise, otherwise returns false.
Example:
bool isSyneriseBanner = await Synerise.notifications.isSyneriseBanner(remoteMessageMap);
Check if push notification is a Silent Command
This method verifies if a notification’s sender is Synerise and if the notification is a Silent Command.
Declared In:
lib/modules/notifications/notifications_impl.dart
Class:
NotificationsImpl
Declaration:
Future<bool> isSilentCommand(Map notification) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
notification | Map | yes | - | Key-Value map of data |
Return Value:
true if the notification is Synerise Silent Command provided by Synerise, otherwise returns false.
Example:
bool isSilentCommand = await Synerise.notifications.isSilentCommand(remoteMessageMap);
Check if push notification is a Silent SDK Command
This method verifies if a notification’s sender is Synerise and if the notification is a Silent SDK Command.
Declared In:
lib/modules/notifications/notifications_impl.dart
Class:
NotificationsImpl
Declaration:
Future<bool> isSilentSDKCommand(Map notification) async
Parameters:
Parameter | Type | Mandatory | Default | Description |
---|---|---|---|---|
notification | Map | yes | - | Key-Value map of data |
Return Value:
true if the notification is Synerise Silent SDK Command provided by Synerise, otherwise returns false.
Example:
bool isSilentSDKCommand = await Synerise.notifications.isSilentSDKCommand(remoteMessageMap);
Get Walkthrough
This method fetches a walkthrough.
CAMPAIGN_BACKEND_CAMPAIGN_READ
permission from the Campaign group.Declared In:
lib/modules/injector/injector_impl.dart
Class:
InjectorImpl
Declaration:
void getWalkthrough()
Return Value:
No value is returned.
Example:
Synerise.injector.getWalkthrough();
Show Walkthrough
This method shows a walkthrough when it is loaded.
Declared In:
lib/modules/injector/injector_impl.dart
Class:
InjectorImpl
Declaration:
void showWalkthrough()
Return Value:
No value is returned.
Example:
Synerise.injector.showWalkthrough();
Check if Walkthrough is loaded
This method checks if a walkthrough is loaded.
Declared In:
lib/modules/injector/injector_impl.dart
Class:
InjectorImpl
Declaration:
Future<bool> isWalkthroughLoaded()
Return Value:
true if the walkthrough is loaded, otherwise returns false.
Example:
var isLoaded = await Synerise.injector.isWalkthroughLoaded();
Check if is loaded Walkthrough unique
This method checks if the walkthrough is unique compared to the previous one.
Declared In:
lib/modules/injector/injector_impl.dart
Class:
InjectorImpl
Declaration:
Future<bool> isLoadedWalkthroughUnique()
Return Value:
true if the loaded walkthrough is unique, otherwise returns false.
Example:
var isLoaded = await Synerise.injector.isLoadedWalkthroughUnique();