registerPush method

  1. @override
Future<TencentCloudChatPushResult> registerPush({
  1. int? sdkAppId,
  2. String? appKey,
})
override

Implementation

@override
Future<TencentCloudChatPushResult> registerPush({
  int? sdkAppId,
  String? appKey,
}) async {
  try {
    if (Platform.isIOS || Platform.isAndroid) {
      final res = await _methodChannel.invokeMethod("registerPush", {
        "sdkAppId": (sdkAppId ?? 0).toString(),
        "appKey": (appKey ?? ""),
      });
      return TencentCloudChatPushResult(code: 0, data: res);
    }
    return TencentCloudChatPushResult(code: -1);
  } on PlatformException catch (e) {
    return TencentCloudChatPushResult(
      code: int.tryParse(e.code) ?? -1,
      errorMessage: e.message,
    );
  }
}