Can I install apk
file without downloading? The apk
file is on the server. I tried the code below but it doesn't work:
public static void InstallProgram(Uri uri, Context context){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(uri,"application/vnd.android.package-archive");
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
context.startActivity(intent);
}
Where uri
is http://192.168.43.1:6789/mobile_base/test.apk
.
It returns an error:
android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.VIEW dat=http://192.168.43.1:6789/mobile_base/test.apk typ=application/vnd.android.package-archive flg=0x10000000 }