1.下载文件报错异常可以先建立临时空文件方便下次任务驱动下载

2.启动第三方应用需要建立新栈
This commit is contained in:
2026-02-06 18:50:35 +08:00
parent b8b8989166
commit 494d7e63ff
2 changed files with 9 additions and 0 deletions

View File

@@ -130,6 +130,14 @@ public class DownLoadTaskThread implements Runnable {
e.printStackTrace(); e.printStackTrace();
LogUtils.loge("download Exception===>"+e.getMessage()); LogUtils.loge("download Exception===>"+e.getMessage());
// TODO: 2025/12/17 异常检验-tmp是否存在不存在再建一个0KB临时空文件可保证 文件以后一定能下载下来 // TODO: 2025/12/17 异常检验-tmp是否存在不存在再建一个0KB临时空文件可保证 文件以后一定能下载下来
File file = new File(bean.getPath(), bean.getFileName()+"-tmp");
if(!file.exists()){
try {
file.createNewFile();
} catch (IOException ex) {
LogUtils.loge("exception happen before file create,must create tmp file");
}
}
if (observer != null) { if (observer != null) {
observer.onError(bean, bean.getTaskId(), e.getMessage()); observer.onError(bean, bean.getTaskId(), e.getMessage());
} }

View File

@@ -19,6 +19,7 @@ public class IntentUtil {
intent = context.getPackageManager().getLeanbackLaunchIntentForPackage(packageName); intent = context.getPackageManager().getLeanbackLaunchIntentForPackage(packageName);
} }
if(intent!=null){ if(intent!=null){
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent); context.startActivity(intent);
}else { }else {
Toast.makeText( context, tipmsg, Toast.LENGTH_SHORT).show(); Toast.makeText( context, tipmsg, Toast.LENGTH_SHORT).show();