updatePushNickname method

Future<void> updatePushNickname(
  1. String nickname
)

~english Updates the push display nickname of the current user.

This method can be used to set a push display nickname, the push display nickname will be used to show for offline push notification. When the app user changes the nickname in the user profile use EMUserInfoManager.updateUserInfo be sure to also call this method to update to prevent the display differences.

Param nickname The push display nickname, which is different from the nickname in the user profile.

Throws A description of the issue that caused this exception. See EMError ~end

~chinese 更新推送通知收到时显示的昵称。

该昵称与用户信息中的昵称设置不同,我们建议这两种昵称的设置保持一致。更新用户属性昵称详见 EMUserInfoManager.updateUserInfo

Param nickname 推送通知收到时显示的昵称。

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

Implementation

Future<void> updatePushNickname(String nickname) async {
  Map req = {'nickname': nickname};
  Map result =
      await PushChannel.invokeMethod(ChatMethodKeys.updatePushNickname, req);
  try {
    EMError.hasErrorFromResult(result);
  } on EMError catch (e) {
    throw e;
  }
}