//download the new app
private void downLoadNewApp(NewVersion.XianzaishiRfBean version) {
if (StringUtils.isEmpty(version.getUrl())) {
ToastUtils.showToast("新版本的APP url为空");
enterLoginActivity();
return;
}
final ProgressDialog dialog = new ProgressDialog(this);
dialog.setTitle("正在下载");
dialog.setMessage(version.getDes() + "");
dialog.setCancelable(false);
dialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dialog.show();
if (!NetUtils.hasNet(SplashActivity.this)) {
ToastUtils.showToast("请检查网络环境");
return;
}
System.out.println("SplashActivity.downLoadNewApp=" + version.getUrl());
OkHttpUtils
.get()
.url(version.getUrl())
.build()
.execute(new FileCallBack(Environment.getExternalStorageDirectory().getAbsolutePath(), Conts.NEW_APP_NAME) {
@Override
public void onError(Call call, Exception e, int id) {
enterLoginActivity();
System.out.println("SplashActivity.onError=哈哈哈");
ToastUtils.showToast("下载更新包失败");
}
@Override
public void inProgress(float progress, long total, int id) {
super.inProgress(progress, total, id);
dialog.setProgress((int) (100 * progress));
}
@Override
public void onResponse(File response, int id) {
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
intent.addCategory(Intent.CATEGORY_DEFAULT);
intent.setDataAndType(Uri.fromFile(response),
"application/vnd.android.package-archive");
startActivityForResult(intent, 0);
}
});
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有