Android安装卸载程序解析

上传人:hs****ma 文档编号:559374967 上传时间:2022-10-08 格式:DOC 页数:2 大小:20.50KB
返回 下载 相关 举报
Android安装卸载程序解析_第1页
第1页 / 共2页
Android安装卸载程序解析_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

《Android安装卸载程序解析》由会员分享,可在线阅读,更多相关《Android安装卸载程序解析(2页珍藏版)》请在金锄头文库上搜索。

1、在Android安装卸载程序的源码中我们知道:Java代码戸1. activityandroid:name=.PackageInstallerActivity2. 3. 4. 5. 6. 7.8. 9. 10.10. 11. 12. 13. 14. 15. 17.18.因为根据里面的权限我们可以从sd卡安装一个程序:Java代码1. StringfileName=Environment.getExternalStorageDirectory()+/myApp.apk;2. Intentintent=newIntent(Intent.ACTION_VIEW);3.3. intent.setDat

2、aAndType(Uri.parsefile:/+filePath),application/vnd.android.package-archive);4. /或者5. /intent.setDataAndType(Uri.fromFile(newFile(fileName),application/vnd.android.package-archive);7.6. startActivity(intent);Android安装卸载程序的操作中要想卸载一个程序;Java代码1. UripackageURI=Uri.parse(package:com.android.myapp);2. Inte

3、ntuninstallIntent=newIntent(Intent.ACTION_DELETE,packageURI);3.startActivity(uninstallIntent);默认是不支持安装非市场程序的因此判断一下Java代码1. intresult=Settings.Secure.getInt(getContentResolver(),Settings.Secure.INSTALL_NON_MARKET_APPS,0);2. if(result=0)3. /showsomedialoghere4. /.5. /andmaybeshowapplicationsettingsdialogmanually6. Intentintent=newIntent();7. intent.setAction(Settings.ACTION_APPLICATION_SETTINGS);8. startActivity(intent);9. 10.

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号