gpt4 book ai didi

android - Intent 过滤器不适用于调用屏幕

转载 作者:塔克拉玛干 更新时间:2023-11-02 21:06:34 25 4
gpt4 key购买 nike

我正在设计一个自定义调用屏幕,以便在通话期间在屏幕上显示信息,例如调用者的地址簿信息。当用户使用 Intent Filter 按下调用按钮时,我的应用程序将启动,之后我将从地址簿中获取其他信息并将其添加到屏幕。

我的问题是按下调用按钮时,我的 activity 没有启动。我的intent 过滤器 正确吗?是否有可能拦截电话 Intent?请分享您在处理调用事件方面的知识。

我的 Intent Filter 如下所示。

<activity android:name=".MyCallingScreen">
<intent-filter android:priority="100">
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
<data android:scheme="tel" />
</intent-filter>
</activity>

最佳答案

在您的情况下,请尝试按照以下方式更改您的代码:

<intent-filter android:priority="100">
<action android:name="android.intent.action.CALL_BUTTON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>

如果按下调用按钮,它对我有用。

尝试使用以下代码来拦截调用:

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

对于 HTC,这里有一些变化:

<activity>
<intent-filter>
<action android:name="android.intent.action.CALL_PRIVILEGED" />
<category android:name="android.intent.category.DEFAULT" />
<data android:mimeType="vnd.android.cursor.item/phone" />
<data android:mimeType="vnd.android.cursor.item/phone_v2" />
<data android:mimeType="vnd.android.cursor.item/person" />
</intent-filter>
</activity>

Intent with action android.intent.action.CALL_PRIVILEGED 当您通过以下方式从电话簿调用电话时调用:电话簿->联系人->电话号码长按->选择调用电话下拉菜单。

关于android - Intent 过滤器不适用于调用屏幕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8339608/

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