更新 taskInfo.java

This commit is contained in:
2023-08-09 20:14:29 +08:00
parent f921ea70b4
commit a4bacd9f6a

View File

@@ -23,7 +23,6 @@ public class taskInfo {
public static void getTask() { public static void getTask() {
String packageName = ""; String packageName = "";
String apkPath = "";
int code = -1; int code = -1;
// 检查目录是否存在 // 检查目录是否存在
File directory = new File("/sdcard/apks/"); File directory = new File("/sdcard/apks/");
@@ -47,13 +46,19 @@ public class taskInfo {
JSONObject json = new JSONObject(sb.toString()); JSONObject json = new JSONObject(sb.toString());
code = json.getInt("code"); code = json.getInt("code");
if (code == 1){ if (code == 1){
apkPath = json.getString("apkPath"); String apkPath = json.getString("apkPath");
packageName = json.getString("packageName"); packageName = json.getString("packageName");
Log.i(TAG, "getTask apkPath: "+apkPath); Log.i(TAG, "getTask apkPath: "+apkPath);
Log.i(TAG, "getTask packageName: "+packageName); Log.i(TAG, "getTask packageName: "+packageName);
// 拼接URL并启动下载
String downloadUrl = "http://39.103.73.250/tt/upload/ddj/" + apkPath; String downloadUrl = "http://39.103.73.250/tt/upload/ddj/" + apkPath;
downloadFile(downloadUrl, "/sdcard/apks/" + apkPath); // 拼接URL并启动下载
new Thread(new Runnable() {
@Override
public void run() {
downloadFile(downloadUrl, "" + apkPath);
// 执行其他下载操作
}
}).start();
} }
} }
} catch (Exception e) { } catch (Exception e) {