我想知道是否有可能以编程方式触发卡上apk的安装?
发布于 2010-04-14 23:26:49
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(new File(fileName)), "application/vnd.android.package-archive");
startActivity(intent);(anddev.org提供)
发布于 2011-05-22 10:31:13
以防万一有人在找这些信息...如果你想安装一个apk,你也可以通过编程方式下载并存储在你的私人“文件”文件夹中(即:"/data/data/com.yourapp.name/files"),您需要先使用getFileStreamPath获取完整路径的uri,如下所示:
File fullPath = getFileStreamPath("name_of_downloaded_app.apk");
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.setDataAndType(Uri.fromFile(fullPath), "application/vnd.android.package-archive");
startActivity(intent);希望这能帮到你。
发布于 2010-04-14 22:16:31
看看这能不能帮上忙:install Apk via Intent。不过,我不确定这是不是正确的选择。
https://stackoverflow.com/questions/2637957
复制相似问题