如何自我卸载的应用程序? [英] How to self uninstall an app?

查看:380
本文介绍了如何自我卸载的应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问题是这样的 - 我的应用程序获取管理员权限,让他们从UI POV是很容易的。然而,一旦应用程序有这些权利,这是麻烦的将其卸载(用户必须首先撤销这些管理权限;如果没有,卸载时,有没有什么信息与卸载怎么了 - 至少在一点2的Andr​​oid 2.3)。

The problem is this -- my app gets admin rights, to get them, from UI POV is quite easy. However once app has those rights, it is cumbersome to uninstall it (user has to first revoke those admin rights; and if not, when uninstalling there is no info what is going wrong with uninstall -- at least at Ace 2 Android 2.3).

因此​​这将是有益的,以在应用程序中的卸载功能 - 它会撤销管理权限,然后再按照正常卸载

Thus it would be useful, to have a uninstall feature in app -- it would revoke admin rights first, and then follow normal uninstall.

另一种方法是将通知应用程序是要卸载的程序,但AFAIK是不可能的 - 见:<一href="http://$c$c.google.com/p/android/issues/detail?can=2&q=33315&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&id=33315">http://$c$c.google.com/p/android/issues/detail?can=2&q=33315&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&id=33315

Another approach would be to be notified app is about to be uninstalled, however AFAIK it is not possible -- see: http://code.google.com/p/android/issues/detail?can=2&q=33315&colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&id=33315

到目前为止,我想出了只与解决方法 - 保存用户的问题添加一个按钮明确的卸载,状态信息,如果应用程序已准备好进行卸载。但用户必须卸载我的应用程序的另一个步骤。麻烦呢。

So far I came up only with workaround -- to save user a problem add a button "clear for uninstall" with status info if app is ready to be uninstalled. But then user has to make another step of uninstalling my app. Troublesome anyway.

所以 - 如何卸载自我?

So -- how to uninstall self?

就在为了保持code对SO网站:

Just in sake to keep the code on SO site:

Uri packageURI = Uri.parse("package:"+MyMainActivity.class.getPackage().getName());
Intent uninstallIntent = new Intent(Intent.ACTION_DELETE, packageURI);
startActivity(uninstallIntent);

在code从的Andr​​oid故事博客复制。

推荐答案

就这些夫妇的问题,一起来看看(它们都涉及到安装/卸载)

Take a look on these couple of questions (they are related to installation/uninstallation)

隐性意图卸载应用程序?

<一个href="http://stackoverflow.com/questions/6813322/install-uninstall-apks-programmatically-packagemanager-vs-intents">install /卸载的APK编程(PackageManager VS意图)

这篇关于如何自我卸载的应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆