React Native listeners

Initialization

A listener to handle the SDK lifecycle events.

Synerise.onReady(function() {
  ...
});

Synerise.onError(function(error) {
  ...
})



NotificationsListener

A listener to handle actions from the notifications module.

Synerise.Notifications.setListener({
  // The following method is called when Synerise receives a registration token from the native part of application
  // It is optional function
    onRegistrationToken: function(token) {
      ...
  },
  // The following method is called when registration for Push Notifications is needed.
  // It is optional function
  onNotification: function(payload) {
    ...
  },
  // The following method is called when Synerise receives a notification's payload from the native part of application.
  // It is optional function
  onRegistrationRequired: function() {
    ...
  }
});
Note: After invoking onRegistrationRequired() function, you must invoke the Synerise.Notifications.registerForNotifications(registrationToken, mobileAgreement, onSuccess, onError) method again.


ClientStateListener

A listener to handle customer’s sign-in state changes.

Synerise.Client.setClientStateListener({
  // The following method is called when a customer signs in.
  // It is optional function
  onClientSignedIn: function() {
    ...
  },
  // The following method is called when a customer signs out
  // It is optional function
  onClientSignedOut: function(reason) {
    ...
  }
});


InjectorListener

A listener to handle URL and deeplink actions from the injector module.

Synerise.Injector.setListener({
  // The following method is called when Synerise handles URL action from campaign activities
  // It is required function
  onOpenUrl: function(url) {
  	...
  },
  // The following method is called when Synerise handles deep link action from campaign activities
  // It is required function
  onDeepLink: function(deepLink) {
    ...
  }
});



InjectorInAppMessageListener

A listener to handle the states of in-app messages.

Synerise.Injector.setInAppMessageListener({
  shouldPresent: function(data) {
    return true;
  },
  // The following method is called after an in-app message appears
  onPresent: function (data) {
    ...
  },
  // The following method is called after an in-app message disappears
  onHide: function(data) {
    ...
  },
  // This method is called when a individual context for an in-app message is needed
  contextIsNeeded: function(data) {
    return {}
  },
  // This method is called when the SRInApp.openUrl(url) method is used in an in-app message.
  onOpenUrl: function (data, url) {
      ...
  },
  // This method is called when the SRInApp.openDeeplink(url) method is used in an in-app message.
  onDeepLink: function (data, deepLink) {
    ...
  },
  // This method is called when the
  // SRInApp.handleCustomAction(name, params) method is used in an in-app message.
  onCustomAction: function(data, name, parameters) {

  }
})
😕

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