Как программно запустить из assets apk? чтобы появилось окно установки.
try{
Intent intent = new Intent(Intent.ACTION_VIEW);
File file=new File(getFilesDir()+"/apk");
copyInputStreamToFile(getAssets().open("SuperUser.apk"),file);
if (file.exists()){
Log.e("asd","DA");
}else {
Log.e("asd","NET");
}
intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive");
startActivity(intent);
} catch (IOException e) {
e.printStackTrace();
}
private void copyInputStreamToFile( InputStream in, File file ) {
try {
OutputStream out = new FileOutputStream(file);
byte[] buf = new byte[2048];
int len;
while((len=in.read(buf))>0){
out.write(buf,0,len);
}
out.close();
in.close();
} catch (Exception e) {
e.printStackTrace();
}
}