Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/sql-server-2008/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
android.Intent.action.CALL的意向过滤器_Android - Fatal编程技术网

android.Intent.action.CALL的意向过滤器

android.Intent.action.CALL的意向过滤器,android,Android,我有一个意向过滤器,看起来是这样的: <activity android:name="com.test.Call" android:label="@string/makeCall" > <intent-filter> <action android:name="android.intent.action.CALL" /> <category android:name="android.intent.

我有一个意向过滤器,看起来是这样的:

<activity
    android:name="com.test.Call"
    android:label="@string/makeCall" >
    <intent-filter>
        <action android:name="android.intent.action.CALL" />
        <category android:name="android.intent.category.DEFAULT" />
        <action android:name="android.intent.action.CALL_PRIVILEGED" />
        <data android:scheme="tel" />
    </intent-filter>
</activity>
问题是,它从一开始就再次显示相同的选项(本机调用者和我的意图过滤器)。这不是我想要的,我想绕过我的意图过滤器,直接转到本机调用者。有办法做到这一点吗?我如何才能强制直接转到本机调用者?我正在考虑将其移动到广播接收器,但更愿意走这条路线


谢谢

您可以尝试通过PackageManager.setComponentEnabledSetting()[使用DONT_KILL_APP flags!]禁用组件,但您需要在下次调用之前再次重新启用组件

或者,您也可以接受Huang的上述评论,但找出捕捉动作调用意图的组件,并构建自己的选择器(如果除您之外还有多个),使用PackageManager.QueryInputActivities()获取活动列表


使用广播确实是正确的方式。

我可以说的是明确启动拨号器活动,而不是用ACTION_DIAL启动意图,然而,似乎每个手机制造商都有自己的拨号器,所以覆盖所有品牌会有点困难。比如:
caller.setClass(这是dial_activity.class)现在系统将忽略任何意图过滤器。实际上,我认为我想要的是ACTION_CALL类。那是我原来问题中的一个输入错误。不管怎样,这就是我正在考虑的,明确地设置我想要的类。问题是,我不知道如何找到答案。我已经浏览了API,但找不到它。我怎样才能找到答案?嗨,我在活动中添加了相同的意向过滤器,但无法收到电话:number intentCan you please helpHey,对不起,我已经多年没有使用安卓应用了。我一直忙着工作,继续前进,所以我从来没有抽出时间来试着让它发挥作用。谢谢你的回答,我打算两个都试一下,我有点放弃了这一个。我想尝试这两种解决方案,但不知道如何禁用我的组件或如何找到处理调用的活动。
Uri phoneCall = Uri.parse("tel:"  + numToCall);
Intent caller = new Intent(Intent.ACTION_DIAL, phoneCall);
startActivity(caller);