setDeviceToken method

  1. @override
Future<bool> setDeviceToken(
  1. String token
)
override

Pass the device push token to the SDK.

This method should be called when you receive a push token from the platform's push notification service.

Parameters:

  • token - The device push token

Returns true if the token was set successfully, false otherwise.

Implementation

@override
Future<bool> setDeviceToken(String token) async {
  try {
    final result = await methodChannel.invokeMethod<bool>('setDeviceToken', <String, String>{
      'token': token,
    });
    return result ?? false;
  } on PlatformException catch (e) {
    debugPrint('Failed to set device token: ${e.message}');
    return false;
  }
}