version:1.9
fix: update:增加安装完成后删除文件,修复设备信息上传失败
This commit is contained in:
@@ -141,7 +141,7 @@ public class DownloadService extends Service {
|
||||
//在这里处理任务完成的状态
|
||||
ApkUtils.installApp(DownloadService.this, task.getFilePath());
|
||||
Log.e("taskComplete", task.getExtendField());
|
||||
Aria.download(this).load(task.getDownloadEntity().getId()).cancel();
|
||||
// Aria.download(this).load(task.getDownloadEntity().getId()).cancel();
|
||||
}
|
||||
|
||||
@Download.onTaskFail
|
||||
|
||||
@@ -14,6 +14,7 @@ import android.net.wifi.WifiInfo;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Binder;
|
||||
import android.os.Handler;
|
||||
import android.os.IBinder;
|
||||
import android.os.SystemClock;
|
||||
import android.provider.Settings;
|
||||
@@ -34,6 +35,7 @@ import com.fuying.sn.service.GuardService;
|
||||
import com.fuying.sn.service.StepService;
|
||||
import com.fuying.sn.utils.ApkUtils;
|
||||
import com.fuying.sn.utils.CacheUtils;
|
||||
import com.fuying.sn.utils.JGYUtils;
|
||||
import com.fuying.sn.utils.SPUtils;
|
||||
import com.fuying.sn.utils.TimeUtils;
|
||||
import com.fuying.sn.utils.ToastUtil;
|
||||
@@ -50,6 +52,7 @@ import com.trello.rxlifecycle4.android.RxLifecycleAndroid;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -121,7 +124,7 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
mPresenter.getAllApp();
|
||||
SPUtils.put(this, CommonConfig.JGY_FIRST_BOOT, 1);
|
||||
}
|
||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
sendDeviceInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -140,6 +143,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
@Override
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
|
||||
lifecycleSubject.onNext(ActivityEvent.CREATE);
|
||||
mPresenter = new MainSPresenter(this);
|
||||
mPresenter.setLifecycle(lifecycleSubject);
|
||||
@@ -155,7 +160,6 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
ApkUtils.writeAppPackageList(MainService.this, "");
|
||||
}
|
||||
mPresenter.getAllApp();
|
||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
|
||||
ApkUtils.UninstallAPP(this, "com.joytv.live");
|
||||
ApkUtils.UninstallAPP(this, "com.tencent.android.qqdownloader");
|
||||
@@ -175,9 +179,8 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
}
|
||||
versionIsUpdate();
|
||||
registerReceivers();
|
||||
NetworkUtils.registerNetworkStatusChangedListener(this);
|
||||
// ControlManager.getInstance().setDefaultUSBstate();
|
||||
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
||||
sendDeviceInfo();
|
||||
}
|
||||
|
||||
private void versionIsUpdate() {
|
||||
@@ -186,6 +189,14 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
Log.e(TAG, "onCreate: " + "upgrade successful");
|
||||
try {
|
||||
new CacheUtils().cleanApplicationUserData(this, "com.aoleyun.os");
|
||||
File file = new File(JGYUtils.getInstance().getDownLoadPath());
|
||||
Log.e(TAG, "versionIsUpdate: " + file.getAbsolutePath());
|
||||
String[] fileList = file.list();
|
||||
if (fileList != null) {
|
||||
for (String path : fileList) {
|
||||
Log.e(TAG, "versionIsUpdate: delete file " + path + " = " + new File(file.getAbsolutePath() + File.separator + path).delete());
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "onReceive: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
@@ -202,6 +213,17 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
SPUtils.put(this, CommonConfig.SN_VERSIONCODE, BuildConfig.VERSION_CODE);
|
||||
}
|
||||
|
||||
private void sendDeviceInfo() {
|
||||
Handler.getMain().postDelayed(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
}
|
||||
},10000);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int onStartCommand(Intent intent, int flags, int startId) {
|
||||
Log.e(TAG, "onStartCommand: " + System.currentTimeMillis());
|
||||
@@ -434,10 +456,11 @@ public class MainService extends Service implements MainSContact.MainView, Netwo
|
||||
NTPTimeTask task = new NTPTimeTask();
|
||||
task.execute("ntp.aliyun.com");
|
||||
NetInterfaceManager.getInstance().getAppWhiteList(() -> {
|
||||
Log.e("TimeObserver", "onNext: getAppWhiteList" );
|
||||
Log.e("TimeObserver", "onNext: getAppWhiteList");
|
||||
});
|
||||
mPresenter.getSnInfo();
|
||||
NetInterfaceManager.getInstance().SendAppInstallInfo();
|
||||
NetInterfaceManager.getInstance().updateAdminInfo();
|
||||
startService();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user