unity 代码安装Android(安卓)apk
16lz
2021-01-26
android 在代码中安装apk的方法
第一步:保存apk文件到sdcard或者其他地方
第二步:修改apk文件的权限为可执行 ,例如chmod ‘777’ file:
String command = "chmod " + permission + " " + path;
Runtime runtime = Runtime.getRuntime();
runtime.exec(command);
第三步:使用Intent 调用安装:
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setDataAndType(Uri.parse("file://" + path),"application/vnd.android.package-archive");
context.startActivity(intent);
更多相关文章
- Android中简单调用图片、视频、音频、录音和拍照的方法
- android自定义title的方法
- 国内阉割版安卓手机无法使用google maps
- Failed to push the item
- 我的第一个Android程序——HelloWorld
- Android中关于sdcard的操作
- Android(安卓)Studio初体验
- android 设置控件的字体
- Android(安卓)SurfaceTexture解读