bindDeviceToken method

Future<void> bindDeviceToken({
  1. required String notifierName,
  2. required String deviceToken,
})

更新推送 token。

Param token 要更新的推送 token。

Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 ChatError

Implementation

Future<void> bindDeviceToken(
    {required String notifierName, required String deviceToken}) async {
  try {
    Map req = {'notifierName': notifierName, 'deviceToken': deviceToken};
    Map result = await platform_interface.Client.instance.pushManager
        .callNativeMethod(ChatMethodKeys.bindDeviceToken, req);
    ChatError.hasErrorFromResult(result);
  } catch (e) {
    rethrow;
  }
}