我已将另一个应用程序的.apk文件存储在我的/ res/raw目录中,并希望为用户提供安装提示。这里是我当前的代码:以编程方式安装位于/ res/raw的.apk文件
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File("android.resource://" + getPackageName() + "/res/raw/myapk.apk")), "application/vnd.android.package-archive");
startActivity(intent);
然而,当意图运行,我得到一个解析错误:There is a problem parsing the package.
的.apk文件是在Eclipse中/ bin目录下创建当我运行其他的一个应用。
我该如何正确完成本地编程的本地安装?
谢谢!但更好地使用Environment.getExternalStorageDirectory()而不是硬编码“/ sdcard” – ligi 2014-01-27 10:52:26