Android的意图默认值 - 检测和清除 [英] Android Intent defaults - detect and clear

查看:129
本文介绍了Android的意图默认值 - 检测和清除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法来检测手机已经选择了一个意图默认的应用程序,如 android.intent.action.SEND

Is there a way to detect that a phone has a default application chosen for an intent such as android.intent.action.SEND ?

有没有办法来清除通过code,其默认的应用程序?

Is there a way to clear the default application via code?

我想给用户一个选项来删除默认或至少显示屏幕,告诉他们如何做手工,如果我能够探测到它。

I'd like to give the user an option to remove the default or at least show a screen telling them how to do it manually, if I can detect it.

推荐答案

看看<一href="http://developer.android.com/reference/android/content/pm/PackageManager.html">PackageManager.有了它,你可以决定如何将意图将与resolveActivity(意向)处理。它看起来像的方法清除preference(clearPackage preferredActivities)只适用于你自己的包。

Take a look at PackageManager. With it, you can determine how an Intent will be handled with resolveActivity(intent). It looks like the method for clearing the preference (clearPackagePreferredActivities) only works on your own package.

这篇关于Android的意图默认值 - 检测和清除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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