日志清理一天执行一次

hdrplus
Matthew 12 months ago
parent a8df6e3094
commit 73a3ad7ba1

@ -86,6 +86,8 @@ public class MpMasterService extends Service {
private static final String FOREGROUND_CHANNEL_ID = "foreground_channel_id";
private SmsSendReceiver mSmsSnedReceiver;
private int mPrevDateForLogs = 0;
public static class STATE_SERVICE {
public static final int CONNECTED = 10;
public static final int NOT_CONNECTED = 0;
@ -247,6 +249,12 @@ public class MpMasterService extends Service {
public void cleanLogFiles() {
try {
Date dt = new Date();
if (dt.getDate() == mPrevDateForLogs) {
return;
}
String appPath = MicroPhotoContext.buildMasterAppDir(getApplicationContext());
String logPath = appPath + "logs";
File fi = new File(logPath);
@ -254,7 +262,7 @@ public class MpMasterService extends Service {
return;
}
Date dt = new Date();
mPrevDateForLogs = dt.getDate();
dt.setHours(0);
dt.setMinutes(0);
long millis = dt.getTime() - mTimeForKeepingLogs;

Loading…
Cancel
Save