Android的 - 意图过滤器? [英] Android - Intent Filter?

查看:140
本文介绍了Android的 - 意图过滤器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想注册我的活动,以便它可以允许用户选择是否选择我的应用程序/作业来完成,他们正在做什么要使用的活动选择器/选择器。

I am trying to register my Activity so that it can be used by the Activity chooser/picker allowing a user to choose whether or not to select my application/Activity to complete what they are trying to do.

我想为用户能够选择我的应用程序时,他们要发送SMS消息,当他们想将传出呼叫,设法实现这一目标的选项,我加$ C以下作品在我的清单我的活动标签内$ C:

I want to provide the option for the user to be able to select my application when they want to send an SMS message and when they want to place an outgoing call, to try to achieve this I added the following pieces of code within my Activity tags in my manifest:

<intent-filter>
<action android:name="android.intent.action.SENDTO" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="text/plain" />
</intent-filter>


<intent-filter>
<action android:name="android.intent.action.NEW_OUTGOING_CALL" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

然而活动选择器永远不会出现和本机应用程序的使用不提供选择给用户。任何人都可以看到我错了?

However the Activity chooser never appears and the native apps are used without providing a choice to the user. Can anyone see where I am going wrong?

编辑:

我已经想通了,我需要添加

I have figured out I need to add

<data android:scheme="sms" />
<data android:scheme="smsto" />

有关的短信,但我用什么呼出?

for the SMS message but what do I use for the outgoing call?

编辑2:

我曾尝试以下的呼出:

 <intent-filter>
 <action android:name="android.intent.action.VIEW" />
 <action android:name="android.intent.action.DIAL" />
 <category android:name="android.intent.category.DEFAULT" />
 <category android:name="android.intent.category.BROWSABLE" />
 <data android:scheme="tel" />
 </intent-filter>

但同样,没有运气,这已被禁止1.6?

But again with no luck, has this been blocked from 1.6 on?

修改3:

这是发生了什么,当我点击文本手机:

This is what happens when I click Text Mobile:

所以我希望同样的事情,当我点击呼叫移动

So i want the same thing when I click Call mobile

推荐答案

我觉得它应该帮助你。

<intent-filter >
    <action android:name="android.intent.action.CALL_PRIVILEGED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data android:scheme="tel" />
</intent-filter>

在测试了Android 2.1的

Tested on Android 2.1

这篇关于Android的 - 意图过滤器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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