updateHMSPushToken method
- @Deprecated("Use [bindDeviceToken] instead")
- String token
~english Updates the HMS push token.
Param token The HMS push token.
Throws A description of the issue that caused this exception. See EMError ~end
~chinese 更新华为推送 token。
Param token 要更新的华为推送 token。
Throws 如果有异常会在此抛出,包括错误码和错误信息,详见 EMError。 ~end
Implementation
@Deprecated("Use [bindDeviceToken] instead")
/// ~english
/// Updates the HMS push token.
///
/// Param [token] The HMS push token.
///
/// **Throws** A description of the issue that caused this exception. See [EMError]
/// ~end
///
/// ~chinese
/// 更新华为推送 token。
///
/// Param [token] 要更新的华为推送 token。
///
/// **Throws** 如果有异常会在此抛出,包括错误码和错误信息,详见 [EMError]。
/// ~end
Future<void> updateHMSPushToken(String token) async {
if (Platform.isAndroid) {
try {
Map req = {'token': token};
Map result = await Client.instance.pushManager
.callNativeMethod(ChatMethodKeys.updateHMSPushToken, req);
EMError.hasErrorFromResult(result);
} catch (e) {
rethrow;
}
} else {
return;
}
}