registerTokenForPushNotification static method
Future<void>
registerTokenForPushNotification(
- String token, {
- required dynamic onSuccess(
- String response
- required dynamic onError(
- CometChatException excep
Registers the obtained FCM Token which will be used by the CometChat server to send message via push notification.
method could throw PlatformException with error codes specifying the cause
Implementation
static Future<void> registerTokenForPushNotification(String token,
{required Function(String response)? onSuccess,
required Function(CometChatException excep)? onError}) async {
try {
final result =
await channel.invokeMethod('registerTokenForPushNotification', {
'token': token,
});
if (onSuccess != null) onSuccess(result);
} on PlatformException catch (p) {
_errorCallbackHandler(null, p, null, onError);
} catch (e) {
_errorCallbackHandler(null, null, e, onError);
}
}