//下载到本地后执行安装
private voidinstallAPK(File file) {
if(!file.exists())return;
Intent intent =newIntent(Intent.ACTION_VIEW);
Uri uri = Uri.parse("file://"+ file.toString());
intent.setDataAndType(uri,"application/vnd.android.package-archive");
//在服务中开启activity必须设置flag
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}