Commit 5cf16966 by pye52

修改日志、下载APP路径到SD卡

parent 480ad683
......@@ -4,22 +4,25 @@ import android.app.Application;
import com.blankj.utilcode.util.CrashUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.PathUtils;
import com.blankj.utilcode.util.Utils;
import java.io.File;
public class RootApp extends Application {
private static final String LOG_PREFIX = "app";
private static final String LOG_DIR = "log";
@Override
public void onCreate() {
super.onCreate();
Utils.init(getApplicationContext());
String logDir = getApplicationContext().getFilesDir().getAbsolutePath() + File.separator + LOG_DIR;
String logDir = PathUtils.getExternalStoragePath() + File.separator + LOG_DIR;
CrashUtils.init(logDir);
LogUtils.getConfig()
.setDir(logDir)
.setLog2FileSwitch(true)
.setBorderSwitch(false);
.setBorderSwitch(false)
.setFilePrefix(LOG_PREFIX);
}
}
......@@ -11,6 +11,7 @@ import com.blankj.utilcode.util.AppUtils;
import com.blankj.utilcode.util.FileIOUtils;
import com.blankj.utilcode.util.FileUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.PathUtils;
import com.blankj.utilcode.util.Utils;
import com.google.gson.Gson;
......@@ -78,7 +79,7 @@ public class UpdateCommandHandler extends CommandHandler {
})
.build();
this.commandUpdate = gson.fromJson(command.getData(), CommandUpdate.class);
this.updateApk = new File(Utils.getApp().getCacheDir(), UPDATE_APK);
this.updateApk = new File(PathUtils.getExternalStoragePath(), UPDATE_APK);
}
private void init(Command command, Gson gson, CommandProgressCallback callback) {
......
......@@ -3,13 +3,27 @@ package com.bgycc.smartcanteen.daemon;
import android.app.Application;
import com.blankj.utilcode.util.CrashUtils;
import com.blankj.utilcode.util.LogUtils;
import com.blankj.utilcode.util.PathUtils;
import com.blankj.utilcode.util.Utils;
import java.io.File;
public class ServiceApplication extends Application {
private static final String LOG_PREFIX = "daemon";
private static final String LOG_DIR = "log";
@Override
public void onCreate() {
super.onCreate();
Utils.init(getApplicationContext());
CrashUtils.init();
String logDir = PathUtils.getExternalStoragePath() + File.separator + LOG_DIR;
CrashUtils.init(logDir);
LogUtils.getConfig()
.setDir(logDir)
.setLog2FileSwitch(true)
.setBorderSwitch(false)
.setFilePrefix(LOG_PREFIX);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment