registerForNotifications method

Future<void> registerForNotifications(
  1. String registrationToken, {
  2. bool? mobileAgreement,
  3. required void onSuccess(),
  4. required void onError(
    1. SyneriseError error
    ),
})

This function registers a device for notifications with a given registration token and mobile agreement.

Args: registrationToken (String): The registration token is a unique identifier that is generated by the device when a user installs an app that uses Firebase Cloud Messaging (FCM) for push notifications. This token is used to identify the device and send push notifications to it. mobileAgreement (bool): mobileAgreement is a boolean parameter that indicates whether the user has agreed to receive notifications on their mobile device.

Implementation

Future<void> registerForNotifications(String registrationToken,
    {bool? mobileAgreement,
    required void Function() onSuccess,
    required void Function(SyneriseError error) onError}) async {
  SyneriseResult<void> result = await _methods.registerForNotifications(
      registrationToken, mobileAgreement);
  result.onSuccess((result) {
    onSuccess();
  }).onError((error) {
    onError(error);
  });
}