code: public static void connectHMS(Activity activity) {
      if (null == activity) {
        throw new IllegalArgumentException("[HMS] activity cannot be null.");
      }
      com.huawei.android.hms.agent.HMSAgent.connect(activity,
          new com.huawei.android.hms.agent.common.handler.ConnectHandler() {
            @Override
            public void onConnect(int rst) {
              LOGGER.d("[HMS] connect end:" + rst);
              com.huawei.android.hms.agent.HMSAgent.Push.getToken(
                  new com.huawei.android.hms.agent.push.handler.GetTokenHandler() {
                    @Override
                    public void onResult(int rst) {
                      LOGGER.d("[HMS] get token: end. returnCode=" + rst);
                    }
                  }
              );
            }
          });
    }
docs: 连接HMS SDK， 可能拉起界面(包括升级引导等)，建议在第一个界面进行连接。
  此方法可以重复调用，没必要为了只调用一次做复杂处理
  方法为异步调用，调用结果在主线程回调
  Connecting to the HMS SDK may pull up the activity (including upgrade guard, etc.), and it is recommended that you connect in the first activity.
  This method can be called repeatedly, and there is no need to do complex processing for only one call at a time
  Method is called asynchronously, and the result is invoked in the main thread callback