处理下载网络异常导致的奔溃问题,和奔溃后进入助手下载状态显示错误问题
This commit is contained in:
@ -53,10 +53,13 @@ import com.gh.common.util.TimestampUtils;
|
||||
import com.gh.common.util.TokenUtils;
|
||||
import com.gh.common.util.TrafficUtils;
|
||||
import com.gh.common.util.Utils;
|
||||
import com.gh.download.DataChanger;
|
||||
import com.gh.download.DataWatcher;
|
||||
import com.gh.download.DownloadDao;
|
||||
import com.gh.download.DownloadEntity;
|
||||
import com.gh.download.DownloadManager;
|
||||
import com.gh.download.DownloadStatus;
|
||||
import com.gh.download.DownloadTask;
|
||||
import com.gh.gamecenter.db.info.ConcernInfo;
|
||||
import com.gh.gamecenter.db.info.GameInfo;
|
||||
import com.gh.gamecenter.db.info.SuspectedGameInfo;
|
||||
@ -171,7 +174,6 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
kv.put("版本", downloadEntity.getPlatform());
|
||||
kv.put("状态", "下载完成");
|
||||
|
||||
String entrance = downloadEntity.getEntrance();
|
||||
if (downloadEntity.isUpdate()) {
|
||||
DataUtils.onEvent(MainActivity.this, "游戏更新",
|
||||
downloadEntity.getName(), kv);
|
||||
@ -182,7 +184,7 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
Map<String, Object> kv2 = new HashMap<>();
|
||||
kv2.put("版本", downloadEntity.getPlatform());
|
||||
kv2.put("状态", "下载完成");
|
||||
kv2.put("位置", entrance + "-完成");
|
||||
kv2.put("位置", downloadEntity.getEntrance() + "-完成");
|
||||
DataUtils.onEvent(MainActivity.this, "游戏下载位置",
|
||||
downloadEntity.getName(), kv2);
|
||||
}
|
||||
@ -199,14 +201,19 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
map.put("game_id", downloadEntity.getGameId());
|
||||
if (downloadEntity.isPluggable()) {
|
||||
map.put("method", "插件化");
|
||||
map.put("btn_status", "插件化");
|
||||
} else if (downloadEntity.isUpdate()) {
|
||||
map.put("method", "更新");
|
||||
map.put("btn_status", "更新");
|
||||
} else {
|
||||
map.put("method", "正常");
|
||||
map.put("btn_status", "下载");
|
||||
}
|
||||
map.put("platform", PlatformUtils.getInstance(getApplicationContext())
|
||||
.getPlatformName(downloadEntity.getPlatform()));
|
||||
map.put("status", "完成");
|
||||
map.put("location", downloadEntity.getLocation());
|
||||
map.put("from", entrance);
|
||||
map.put("entrance", downloadEntity.getEntrance());
|
||||
map.put("network", NetworkUtils.getConnectedType(MainActivity.this));
|
||||
DataCollectionManager.onEvent(MainActivity.this, "download", map);
|
||||
|
||||
@ -419,6 +426,9 @@ public class MainActivity extends BaseFragmentActivity implements OnClickListene
|
||||
// 初始化PlatformUtils
|
||||
PlatformUtils.getInstance(getApplicationContext());
|
||||
|
||||
// 解决助手奔溃后导致的下载状态保留问题
|
||||
DownloadManager.getInstance(this).checkAll();
|
||||
|
||||
// 添加观察者
|
||||
DownloadManager.getInstance(this).addObserver(dataWatcher);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user