registerPushToken static method

Future<PushTokenRegistrationStatus> registerPushToken(
  1. {required PushTokenType type,
  2. required String token,
  3. bool alwaysPush = false,
  4. bool unique = false}
)

Registers push token for the current User to receive push notification. To enable push notification and get a token, Push token registration succeeds only when the connection (connect) is made. Otherwise, callback will return with PushTokenRegistrationStatus.pending status. Then, you can register push token again by calling SendbirdChat.registerPushToken after the connection is done. This just adds token to the server. If you want to register this token and delete all the previous ones, refer to registerPushToken.

Implementation

static Future<PushTokenRegistrationStatus> registerPushToken({
  required PushTokenType type,
  required String token,
  bool alwaysPush = false,
  bool unique = false,
}) async {
  sbLog.i(StackTrace.current, 'PushTokenType: $type');
  return await _instance._chat.registerPushToken(
    type: type,
    token: token,
    alwaysPush: alwaysPush,
    unique: unique,
  );
}