没有合适的资源?快使用搜索试试~ 我知道了~
本文实例讲述了Android实现用代码简单安装和卸载APK的方法。分享给大家供大家参考,具体如下: public class TestInstallAPK extends Activity { @Override protected void onCreate(Bundle savedInstanceState) { // TODO Auto-generated method stub super.onCreate(savedInstanceState); // this.unInstallFile(); installFile(); } /** * install APK
资源详情
资源评论
资源推荐
Android实现用代码简单安装和卸载实现用代码简单安装和卸载APK的方法的方法
本文实例讲述了Android实现用代码简单安装和卸载APK的方法。分享给大家供大家参考,具体如下:
public class TestInstallAPK extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
// this.unInstallFile();
installFile();
}
/**
* install APK code
*/
private void installFile(){
Intent intent = new Intent(Intent.ACTION_VIEW);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setAction(android.content.Intent.ACTION_VIEW);
// String type = getMIMEType(f);
// intent.setDataAndType(Uri.fromFile(f), type);
intent.setDataAndType(Uri.parse("file://" + "/sdcard/Android_gc.apk"),
"application/vnd.android.package-archive");
this.startActivity(intent);
}
/**
* uninstall APK code
*/
private void unInstallFile(){
Uri uri=Uri.parse("package:com.gameclient");
Intent intent = new Intent(Intent.ACTION_DELETE,uri);
this.startActivity(intent);
}
}
更多关于Android相关内容感兴趣的读者可查看本站专题:《Android开发入门与进阶教程》、《Android调试技巧与常见问题
解决方法汇总》、《Android多媒体操作技巧汇总(音频,视频,录音等)》、《Android基本组件用法总结》、《Android视图View
技巧总结》、《Android布局layout技巧总结》及《Android控件用法总结》
希望本文所述对大家Android程序设计有所帮助。
您可能感兴趣的文章您可能感兴趣的文章:Android 8.0安装apk的实例代码android 使用虚拟机安装apk(图文教程)android自动安装apk代码实例(不
使用apk安装器安装)Android简单判断某个APK是否已经安装的方法Android安装apk文件并适配Android 7.0详解Android apk无
法安装及闪退问题解决办法Android模拟器中安装apk的方法Android编程实现监控apk安装,卸载,替换的方法Android 8.0不
能自动安装APK问题的解决方法(完美适配)
weixin_38727980
- 粉丝: 3
- 资源: 931
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
评论0