编程取消设置一个默认的应用程序 [英] programmatically unset a default application

查看:123
本文介绍了编程取消设置一个默认的应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我做了一个家庭的应用程序,我想提供退出,并取消设置为默认应用程序的能力。

I made a Home application and I'd like to offer the ability to exit it and unset it as the default application.

退出是很容易(刚开始的意图),但问题是我不希望我的程序被再次启动的下一次用户点击Home键。

Exit is easy (just starting an intent) but the problem is I don't want my program to be launched again the next time the user click the Home button.

我知道,这可以通过在参数/应用/我的应用程序/擦除默认操作会的工作要做,但我想从我的程序去做,这样用户不必搜索这个功能。

I know that this can be done by going in the parameters / Applications / my app / erase default actions but I would like to do it from my program so that the user doesn't have to search this function.

如何能不能做到?

推荐答案

您可以使用<一个href="http://developer.android.com/reference/android/content/pm/PackageManager.html#clearPackage$p$pferredActivities%28java.lang.String%29"相对=nofollow> PackageManager 从被默认的活动,您不能清除等活动清除自己。这个答案可以帮助:<一href="http://stackoverflow.com/questions/2583966/how-do-i-use-packagemanager-add$p$pferredactivity">How我用PackageManager.add preferredActivity()?

You can use the PackageManager to clear yourself from being the default activity, you cannot clear other activities. This answer may help: How do I use PackageManager.addPreferredActivity()?

这篇关于编程取消设置一个默认的应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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