Android 安装apk代码
2015-09-14 17:37
429 查看
/** * 跳转到安装APK安装包页面 * @param context context * @param apkFilePath apkFilePath * @return true or false(APK文件不存在返回false) */ public boolean installAPK(Context context, String apkFilePath) { File file = new File(apkFilePath); if(file.exists()) { Intent intent = new Intent(android.content.Intent.ACTION_VIEW); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setDataAndType(Uri.fromFile(file), "application/vnd.android.package-archive"); context.startActivity(intent); android.os.Process.killProcess(android.os.Process.myPid());//安装完成后显示完成、打开 return true; } return false; }
相关文章推荐
- Android.mk集成第三方jar与so的方法
- android SlidingUpPanel (一)
- android tools使用方式
- Android之SD卡文件浏览器实现
- Android 实现简单的帧动画
- Android之SD卡上的文件读取
- Android JNI NDK 全程配置和运行demo,总结csdn所有博客自己提炼!!!!最易懂
- 如何在Android上使用OpenGL ES 2.0绘制点。
- Android AsyncTask完全解析,带你从源码的角度彻底理解
- 去掉android二维码的边框
- android 开发第五弹---水波纹与自定义view实现绚丽粒子
- Android数据库安全解决方案,使用SQLCipher进行加解密
- 去除AndroidStudio中libpng关于iCCP的警告
- android.widget.FrameLayout$LayoutParams cannot be cast to android.widget.AbsListView$LayoutParams
- Android5.0新控件CardView的介绍和使用
- 深入理解Android之Gradle
- Android SDK 在线更新镜像服务器资源
- Android 让图片等比例缩放的三种方法
- android studio 代理配置
- android之Handler用法