gpt4 book ai didi

Android - Intent 过滤器?

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:24:03 24 4
gpt4 key购买 nike

我正在尝试注册我的 Activity ,以便 Activity 选择器/选择器可以使用它,允许用户选择是否选择我的应用程序/Activity 来完成他们正在尝试做的事情。

我想为用户提供选项,让他们能够在想要发送短信和拨出电话时选择我的应用程序,为了实现这一点,我在其中添加了以下代码 fragment 我的 list 中的 Activity 标签:

<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>

但是, Activity 选择器从未出现,并且在不向用户提供选择的情况下使用 native 应用程序。谁能看出我哪里出错了?

编辑:

我发现我需要添加

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

用于 SMS 消息,但我用什么来拨出电话?

编辑 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 开始就被阻止了?

编辑 3:

这是我点击 Text Mobile 时发生的情况:

alt text

所以当我点击调用手机时我想要同样的东西

最佳答案

我觉得应该对你有帮助

<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 上测试

关于Android - Intent 过滤器?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4068910/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com