【发布时间】:2012-06-12 04:04:57
【问题描述】:
我可以在不下载的情况下安装apk 文件吗? apk 文件在服务器上。我尝试了下面的代码,但它不起作用:
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);
}
其中uri 是http://192.168.43.1:6789/mobile_base/test.apk。
它返回一个错误:
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 }
【问题讨论】:
-
我也想安装 android 应用程序而不从我自己的服务器下载。你找到解决办法了吗?
-
意图意图=新意图(意图.ACTION_VIEW); intent.setDataAndType(Uri.fromFile(new File(downloadPath + fileName)), "application/vnd.android.package-archive");
标签: android streaming client-server