本文实例讲述了Android实现用代码简单安装和卸载APK的方法。分享给大家供大家参考,具体如下: public class TestInstallAPK extends A
本文实例讲述了Android实现用代码简单安装和卸载APK的方法。分享给大家供大家参考,具体如下:
public class TestInstallAPK extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
// this.unInstallFile();
installFile();
}
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);
}
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问题的解决方法(完美适配)
--结束END--
本文标题: Android实现用代码简单安装和卸载APK的方法
本文链接: https://www.lsjlt.com/news/24303.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-01-21
2023-10-28
2023-10-28
2023-10-27
2023-10-27
2023-10-27
2023-10-27
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0