【发布时间】:2016-04-28 06:39:07
【问题描述】:
我正在尝试从usb storage 获取apk 文件并将internal storage 保存在我的应用中。
我使用以下方法保存了 apk 文件:
FileOutputStream fout = _context.openFileOutput(filePath, Context.MODE_PRIVATE);
然后我尝试使用以下方式安装 apk:
private void installApk(String path) {
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(path)),"application/vnd.android.package-archive");
startActivity(intent);
}
但是我遇到了一个错误。
There is a Problem Parsing the Package
我尝试使用:
FileOutputStream fout = _context.openFileOutput(filePath, Context.MODE_WORLD_READABLE);
而且效果很好。
为什么MODE_PRIVATE会导致配对错误?
【问题讨论】:
标签: android installation apk