在Android安装卸载程序的源码中我们知道:
-
<activityandroid:name=".PackageInstallerActivity">
-
<intent-filter>
-
<actionandroid:name="android.intent.action.VIEW"/>
-
<categoryandroid:name="android.intent.category.DEFAULT"/>
-
<dataandroid:scheme="content"/>
-
<dataandroid:scheme="file"/>
-
<dataandroid:mimeType="application/vnd.android.package-archive"/>
-
</intent-filter>
-
</activity>
-
-
<activityandroid:name=".UninstallerActivity">
-
<intent-filter>
-
<actionandroid:name="android.intent.action.VIEW"/>
-
<actionandroid:name="android.intent.action.DELETE"/>
-
<categoryandroid:name="android.intent.category.DEFAULT"/>
-
<dataandroid:scheme="package"/>
-
</intent-filter>
-
</activity>
因为根据里面的权限我们可以 从sd卡安装一个程序:
-
StringfileName=Environment.getExternalStorageDirectory()+"/myApp.apk";
-
Intentintent=newIntent(Intent.ACTION_VIEW);
-
-
intent.setDataAndType(Uri.parse("file://"+filePath),"application/vnd.android.package-archive");
-
//或者
-
//intent.setDataAndType(Uri.fromFile(newFile(fileName)),"application/vnd.android.package-archive");
-
-
startActivity(intent);
Android安装卸载程序的操作中要想卸载一个程序;
-
UripackageURI=Uri.parse("package:com.android.myapp");
-
IntentuninstallIntent=newIntent(Intent.ACTION_DELETE,packageURI);
-
startActivity(uninstallIntent);
默认是不支持安装非市场程序的 因此判断一下
-
intresult=Settings.Secure.getInt(getContentResolver(),Settings.Secure.INSTALL_NON_MARKET_APPS,0);
-
if(result==0){
-
//showsomedialoghere
-
//...
-
//andmaybeshowapplicationsettingsdialogmanually
-
Intentintent=newIntent();
-
intent.setAction(Settings.ACTION_APPLICATION_SETTINGS);
-
startActivity(intent);
-
}
分享到:
相关推荐
Android APK的安装卸载 Android APK的安装卸载
android卸载已安装应用代码,提供点击打开应用功能,采用ListView显示所有已安装应用(剔除了原装应用)。 在此代码中可以学到,...调用系统卸载功能、打开已安装应用和如何判断已安装应用是否为预安装应用的方法!
Android模拟器中安装和卸载程序 模拟器安装 模拟器卸载 安装和卸载 有图片
卸载安卓手机上的已安装程序的代码,剔除了原装软件。主要实现了打开应用程序和卸载应用程序功能。
通过AIDL调用Android源码静默安装卸载APK....
Android应用卸载器源码,完整应用。
电脑上有腾讯管家,作为安卓开发,用真机测试的比较多,鄙人算一个,不喜欢用应用宝,当你卸载了应用...今天又死机了一次,决定做一个当应用宝安装后弹出卸载框的程序 来提示我们卸载这个可恶的应用宝,我用的是华为3x
内附apk 实现说明 是在linx系统环境下 源码下MM 编译实现方式
Android通过调用C来监听自己的程序被卸载。
一个非常方便小巧的Android程序卸载工具,只需要简单的双击需要卸载的软件即可启动卸载程序~~
Android中的监听应用程序如何安装和卸载
通过batch实现的android应用批量安装卸载工具,有代码,有使用说明,欢迎下载
android应用卸载提示 利用监控log机制监控自己被卸载,卸载时提示。
Android例子源码root后静默安装卸载应用
在程序中处理卸载apk,我是在这个情况下用到的与大家共享:开始apk上线用的是debug签名,后我换了台电脑,导致打包再上线报签名不一致的问题.后采用数字证书签名并修改了游戏的主类包名.解决签名不一致的问题. 这样导致...
Android10.0 静默安装、卸载接口
91手机助手forAndroid安装卸载软件教程借鉴.pdf
91手机助手forAndroid安装卸载软件教程整理.pdf
Android疯子卸载
android 实现自我自动静默卸载 妈妈再也不用担心我是流氓了 部分手机安装失败。本人三星i9108可以 小米安装失败。不知道为什么。同个程序。可能是小米没root,但是代码里面没有涉及root相关的 。只是修改了应用权限 ...