无法使用 huawei_push 获取令牌

Unable to get token using huawei_push

我已按照文档中的步骤在插件中配置 huawei_push 包。 我想集成推送通知。我在使用此代码时遇到错误

void _onTokenEvent(String event) {
    token = event;
    if (token != null) {
      print("TokenEvent: " + token!);
    }
  }

  void _onTokenError(PlatformException error) {
    print("TokenErrorEvent: " + error.toString());
  }

  static Future<void> getToken() async {
    try {
      Push.enableLogger();

      await Push.getToken("");

      print('Huawei push token ::  ${HosNotificationHelper.token} ');

      Push.disableLogger();
    } catch (e) {
      print(e.toString());
      print('THISIS EXCEPTION');
    }
  }

错误如下

I/HMSSDK_c(31657): The local secret is already in separate file mode.
E/HMSSDK_HMSPackageManager(31657): Failed to find HMS apk
I/HMSSDK_HMSBIInitializer(31657): Builder->biInitFlag :false
2
E/HMSSDK_HMSPackageManager(31657): Failed to find HMS apk
I/HMSSDK_HuaweiApi(31657): inner hms is empty,hms pkg name is com.huawei.hwid
I/HMSSDK_HuaweiApiManager(31657): sendRequest
I/HMSSDK_BaseHmsClient(31657): ====== HMSSDK version: 50300304 ======
I/HMSSDK_BaseHmsClient(31657): Enter connect, Connection Status: 1
I/HMSSDK_BaseHmsClient(31657): connect minVersion:30000000 packageName:com.huawei.hwid
I/HMSSDK_Util(31657): available exist: true
E/HMSSDK_HMSPackageManager(31657): Failed to find HMS apk
I/HMSSDK_AvailableAdapter(31657): HMS is not installed
I/HMSSDK_BaseHmsClient(31657): check available result: 1
I/HMSSDK_BaseHmsClient(31657): bindCoreService3.0 fail, start resolution now.

请帮忙

E/HMSSDK_HMSPackageManager(31657): Failed to find HMS apk I/HMSSDK_AvailableAdapter(31657): HMS is not installed

此错误表示本设备未安装HMS Core。 因此,建议您在phone的AppStore中搜索HMS Core,安装后重试。