// 广播出去,由广播接收器来处理下载完成的文件
Intent sendIntent = new Intent("com.test.downloadComplete");
// 把下载好的文件的保存地址加进Intent
sendIntent.putExtra("downloadFile", file.getPath());
sendBroadcast(sendIntent);
public class DownLoadBR extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Intent install = new Intent(Intent.ACTION_VIEW); String pathString = intent.getStringExtra("downloadFile"); install.setDataAndType(Uri.fromFile(new File(pathString)), "application/vnd.android.package-archive"); install.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); context.startActivity(install); } }