예제 #1
0
  public JSONObject checkUpdate(String clientVersionName) {

    // 服务器上 app 最新版本号
    String currentVersionName = getCurrentVersionName();

    // 若客户端已经是最新版本,则不需要更新
    if (currentVersionName.equals(clientVersionName)) {
      JSONObject result = new JSONObject();
      result.put("needUpdate", false);
      return result;
    }

    // 获取对应的差分包地址
    AppDiff appDiff =
        appDiffDao.findOneByVersionNameAndClientVersionNameAndDeleteFlag(
            currentVersionName, clientVersionName, 0);
    JSONObject result = new JSONObject();
    result.put("needUpdate", true);
    result.put("diff", appDiff.getDiff());

    String apkPath = explodedPath + File.separator + "app.apk";
    File apk = new File(apkPath);
    String md5Sign = MD5Utils.getMd5ByFile(apk);
    result.put("md5Sign", md5Sign);

    return result;
  }
 public static String makeTempFilePath(String cmd) throws UnsupportedEncodingException {
   String dir_path = PathUtils.getTempFolderPath() + File.separator + ParamCommons.SERVICE_PORT;
   File dir = new File(dir_path);
   if (!dir.exists()) {
     dir.mkdirs();
   }
   return dir_path + File.separator + MD5Utils.MD5Hash(cmd, charCode) + ".sh";
 }
예제 #3
0
 public void setOrientation(Vector3f vec) {
   this.orientation = MD5Utils.calculateQuaternion(vec);
 }