Android用代码安装APK,不用选择“打包安装程序”
16lz
2022-04-20
public static boolean InstallPkgByFile(Context context, String strFilePath,String strFileName) {File file = new File(strFilePath + File.separator + strFileName);if (file.exists()) {Intent intent = new Intent(Intent.ACTION_VIEW);//关键就是这儿了intent.setDataAndType(Uri.fromFile(file),"application/vnd.android.package-archive");context.startActivity(intent);return true;} else {return false;}}
更多相关文章
- 《Expert Android》关键点摘录之一:Exploring Custom Views
- 看Android(安卓)短信的一些关键字
- Java super关键字(android中常见)
- Android(安卓)短信的一些关键字
- android 对话框总结
- android中如何获取视频时长
- Android如何从服务器获取图片
- Android监听HOME键的最简单的方法
- Android服务监控