澄清意图,语境和压倒一切的默认行为 [英] Clarification on Intents, Context and overriding default behaviour

查看:275
本文介绍了澄清意图,语境和压倒一切的默认行为的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

要概括,我明白我的应用程序可以声明活动来处理特定的意图(按类别和行动过滤)。我可以宣布我的应用程序来处理ACTION_VIEW并以某种方式把它奇迹般地被注册为浏览器的系统。如何做到这一点?是否有任何人知道的资源,以进一步读取到应用程序如何哪个动作/类别的组合,让自己注册到系统中,也就是说,浏览器?

To generalize, I understand my application can declare activities to handle specific intents (filtered by category and actions). I can declare my app to handle the ACTION_VIEW and somehow have it magically be registered as a browser to the system. How is this done? Is there a resource that anyone knows of to further read into how which action/category combination lets apps register themselves to the system as, say, browsers?

具体来说,我不知道我怎么会能我的应用程序注册为等待指标的通知消息处理程序,因此,如果从通知栏挖,我的应用程序将选择以完整的行动...

Specifically, I'm wondering how I would be able to register my application as a handler for the message waiting indicator notification, so that if tapped from the notification bar, my app would be chosen to "Complete action with..."

的唯一目的的行为,我可以找到,有关语音信箱/ MWI,将ACTION_DIAL,但我正在寻找时,MWI从通知栏拍了拍打开我的应用程序。

The only intent actions I can find, relating to voicemail/MWI, would be ACTION_DIAL, but I'm looking to open my app when the MWI is tapped from the notification bar.

推荐答案

说实话,我一直在试图让一个意图数据库,开发人员可以发布自己的意图(当然,前提是他们必须有办法确保人们不要滥用它)。

To be honest, I have been trying to get a Intent database that developers can post their own Intents (of course, that they have to have ways to make sure people don't abuse it).

您指定意图的方式是在你指定你想赶上的动作(ACTION_VIEW等)和preFIX清单,说的http://,然后它会被注册时,应用程序被安装。当类别,动作,preFIX和其他数据的具体意图相匹配的基础就会被调用。

The way you specify an intent is in the manifest that you specify the action (action_view, etc) and a prefix you want to catch, say "http://", and then it will get registered when the application is installed. It will get called when the category, action, prefix and other data matches base on the specific intent.

要接收的意图,比如你正在尝试做的人,你必须在你的清单注册一个接收器类。当意图被广播将被调用。

To receive a intent, such as the one you are trying to do, you will have to register a "receiver" class on your manifest. It will be called when the intent gets broadcasted.

并非所有的操作就可以听了。而且我不知道,如果此时指示灯通知选项卡发送一个广播。你将不得不看看Android源$ C ​​$ C明白这一点。或许谷歌将帮助你。但我认为这是不太可能的标签操作将触发一个意图播出。

Not all the actions can be listened. and I am not sure if a broadcast is sent when the indicator notification is tabbed. You will have to look at the Android source code to figure that out. Or maybe Google will help you out. But I think it is not likely that the tab action will trigger an intent broadcast.

祝您好运!

这篇关于澄清意图,语境和压倒一切的默认行为的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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