APK后续进行更新升级。当用户将APk下载到手机上后,让app自动安装这个下载的新版本,代码如下:
// 新的APK的文件名 String str = "newUpdate.apk"; // 新APK在存储卡上的位置 String fileName = Environment.getExternalStorageDirectory() + str; // 通过启动一个Intent让系统来帮你安装新的APK Intent intent = new Intent(Intent.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive"); startActivity(intent);