setNotificationToken method

  1. @override
Future<void> setNotificationToken(
  1. String token
)
override

Sets the notification token for the Grouplink SDK. This method is used to register the device for push notifications.

Implementation

@override
Future<void> setNotificationToken(String token) async {
  if (Platform.isIOS) {
    try {
      await iOSSDKChannel.invokeMethod<String>(
        'setNotificationToken',
        {"token": token},
      );
    } on PlatformException catch (e) {
      log("Error setNotificationToken: ${e.message}");
      rethrow;
    }
  }
  if (Platform.isAndroid) {
    try {
      await methodChannel.invokeMethod(
        "setNotificationToken",
        {"token": token},
      );
    } on PlatformException catch (e) {
      log("Error setNotificationToken: ${e.message}");
      rethrow;
    }
  }
}