[Android]APK程序卸载提示

来源:互联网 发布:淘宝企业店铺认证资料 编辑:程序博客网 时间:2024/04/30 05:44

[Android]APK程序卸载提示
http://www.devdiv.com/forum.php?mod=viewthread&tid=47060&fromuid=109620



Android上能不能实现卸载时提示呢,比如卸载某某软件时,做个用户调查卸载的原因。

我以前想着是的不行的,以前的想法是:
Windows上卸载时能实现此功能是因为有些程序的卸载是自己实现的,非系统操作。
但android上目前来说还不支持,系统卸载时,还没发现有啥接口可以和目标卸载程序交互。

呵呵,今天鼓捣LogCat,发现还是可以的。
实现基础是:
1.通过注册权限,能够获取LogCat的输出流的输出信息。
2.进入系统的卸载界面时,"打包安装程序(com.android.packageinstaller)"会输出如下信息

01-22 16:29:15.250: INFO/ActivityManager(147): Starting activity: Intent { act=android.intent.action.DELETE dat=package:lab.sodino.uninstallhint cmp=com.android.packageinstaller/.UninstallerActivity }

好了,有这句话就足够了。截取输出流信息,当获取字符串中包含"android.intent.action.DELETE"和"<you_package>"时,就启动卸载提示页面。

话就这么多了。接下来看效果图,上代码。

uninstallhint.gif
原创粉丝点击