Esempio n. 1
0
  @Override
  public void run() {
    try {
      if (NetUtil.hasNetwork(this)) {
        BaseParser<Version> jsonParser = new VersionParser();
        RequestVo vo = new RequestVo(R.string.url_version, this, null, jsonParser);
        version = (Version) NetUtil.get(vo);
        if (version != null) {
          String v = version.getVersion();

          Logger.d(TAG, "获取当前服务器版本号为 :" + v);
          if (clientVersion.equals(v)) {
            gotoHome();
          } else {
            Message.obtain(handler, SHOW_UPDATE_DIALOG).sendToTarget();
          }
        } else {
          gotoHome();
        }
      } else {
        gotoHome();
      }
    } catch (Exception e) {
      Logger.e(TAG, e);
      gotoHome();
    }
  }
Esempio n. 2
0
  /** 从服务器下载新的Apk */
  private void downApk() {

    initProgressDialog();
    file = new File(ECApplication.getCacheDirPath(), "lazyman.apk");
    downLoadTask = new DownLoadTask(version.getUrl(), file.getAbsolutePath(), 5);
    downLoadTask.setListener(this);
    ThreadPoolManager.getInstance().addTask(downLoadTask);
  }