对于编程爱好者们来说,Android手机操作系统是一款非常实用的系统。他们可以进行各种Android应用程序的开发来满足自的应用需求。在这里我们就先来为大家讲解一下有关Android安装卸载程序的具体操作步骤。
创新互联专注于企业网络营销推广、网站重做改版、宁化网站定制设计、自适应品牌网站建设、H5场景定制、商城网站建设、集团公司官网建设、外贸营销网站建设、高端网站制作、响应式网页设计等建站业务,价格优惠性价比高,为宁化等各大城市提供网站开发制作服务。
在Android安装卸载程序的源码中我们知道:
- < activity android:name=".PackageInstallerActivity">
- < intent-filter>
- < action android:name="android.intent.action.VIEW" />
- < category android:name="android.intent.category.DEFAULT" />
- < data android:scheme="content" />
- < data android:scheme="file" />
- < data android:mimeType="application/vnd.android.package-archive" />
- < /intent-filter>
- < /activity>
- < activity android:name=".UninstallerActivity">
- < intent-filter>
- < action android:name="android.intent.action.VIEW" />
- < action android:name="android.intent.action.DELETE" />
- < category android:name="android.intent.category.DEFAULT" />
- < data android:scheme="package" />
- < /intent-filter>
- < /activity>
因为根据里面的权限我们可以 安装一个程序从sd卡:
- String fileName = Environment.getExternalStorageDirectory()
+ "/myApp.apk";- Intent intent = new Intent(Intent.ACTION_VIEW);
- intent.setDataAndType(Uri.fromFile(new File(fileName)),
"application/vnd.android.package-archive");- startActivity(intent);
Android安装卸载程序的操作中要想卸载一个程序;
- Uri packageURI = Uri.parse("package:com.android.myapp");
- Intent uninstallIntent = new Intent
(Intent.ACTION_DELETE, packageURI);- startActivity(uninstallIntent);
默认是不支持安装非市场程序的 因此判断一下
- int result = Settings.Secure.getInt(getContentResolver(),
Settings.Secure.INSTALL_NON_MARKET_APPS, 0);- if (result == 0) {
- // show some dialog here
- // ...
- // and may be show application settings dialog manually
- Intent intent = new Intent();
- intent.setAction(Settings.ACTION_APPLICATION_SETTINGS);
- startActivity(intent);
- }
Android安装卸载程序的具体实现方法就为大家介绍到这里。
网站标题:Android安装卸载程序具体操作方法解析
文章来源:http://www.mswzjz.cn/qtweb/news12/94362.html
攀枝花网站建设、攀枝花网站运维推广公司-贝锐智能,是专注品牌与效果的网络营销公司;服务项目有等
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 贝锐智能