当前位置: 首页 > 知识库问答 >
问题:

尽管Android:autoverify=“false”,Android仍试图验证主机

莫欣悦
2023-03-14

在我的应用程序中,我有3个活动,主要活动,次要活动和第三次活动。我希望SecondaryActivity成为Android 6上特定域的默认应用程序链接处理程序,如本指南所述。同时,我希望另一个活动TertiaryActivity能够处理来自另一个域的链接,但不是默认处理程序,因为我不拥有该域。下面是我的AndroidManifest来说明:

<?xml version="1.0" encoding="utf-8"?>
<manifest package="com.antonc.applinktest"
          xmlns:android="http://schemas.android.com/apk/res/android">

    <application
        android:allowBackup="true"
        android:icon="@mipmap/ic_launcher"
        android:label="@string/app_name"
        android:supportsRtl="true"
        android:theme="@style/AppTheme">
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name"
            android:theme="@style/AppTheme.NoActionBar">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
        </activity>

        <activity android:name=".SecondaryActivity"
                  android:label="@string/app_name"
                  android:theme="@style/AppTheme.NoActionBar">
            <intent-filter android:autoVerify="true"> <!-- TRUE -->
                <data android:scheme="https"
                      android:host="secondary.com"/>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
            </intent-filter>
        </activity>

        <activity android:name=".TertiaryActivity"
                  android:label="@string/app_name"
                  android:theme="@style/AppTheme.NoActionBar">
            <intent-filter android:autoVerify="false"> <!-- FALSE -->
                <data android:scheme="https"
                      android:host="tertiary.com"/>
                <action android:name="android.intent.action.VIEW"/>
                <category android:name="android.intent.category.DEFAULT"/>
                <category android:name="android.intent.category.BROWSABLE"/>
            </intent-filter>
        </activity>
    </application>

</manifest>

我阅读了这本关于应用程序链接的广泛指南,它解释了Android上应用程序链接处理和应用程序验证的机制,下面是我在logcat中看到的与应用程序验证相关的消息:

03-25 17:54:45.640 1481-1481/com.google.android.gms D/IntentFilterVerificationReceiver: Received ACTION_INTENT_FILTER_NEEDS_VERIFICATION.

03-25 17:54:45.644 1481-30947/com.google.android.gms I/IntentFilterIntentService: Verifying IntentFilter. verificationId:12 scheme:"https" hosts:"tertiary.com secondary.com" package:"com.antonc.applinktest".

03-25 17:54:46.762 1481-30947/com.google.android.gms I/IntentFilterIntentService: Verification 12 complete. Success:false. Failed hosts:tertiary.com,secondary.com.

正如您所看到的,它试图验证secondary.com和tertiary.com,尽管我明确地为tertiary.com上的意图过滤器设置了Android:autoverify=“false”!

这是Android的bug吗?如何确保IntentFilterIntentService只验证我为其设置了Android:autoverify=“true”的意图过滤器,而不验证其他过滤器?

共有1个答案

李振国
2023-03-14

这是Android的bug吗?

由于行为似乎是文档化的,我将把它描述为一种限制。引用文档:

当Android:AutoVerify属性存在时,安装应用程序会导致系统尝试在应用程序的所有意图过滤器中验证与web URI相关联的所有主机。

 类似资料:
  • 我的场景:我向我的Rabbit代理发布了两条消息,在处理第一条消息时发生了一个未处理的异常。 我看到的情况:有3次重试尝试处理消息,但由于我的强制异常而失败(请参见下面中的代码)。 的是相同的,所以我猜测BlockingQueueConsumer没有重新启动。但是,下面的日志显示它确实在继续等待消息。 我想知道为什么BlockingQueueConsumer没有nack消息,以及为什么尽管日志中有

  • 这是我在这里的第一个问题,所以如果我做错了什么,我提前道歉。 如你所知,不和谐最近实施了一些改变,这使得有必要激活特权网关意图,这样机器人就可以继续欢迎新成员并给他们角色。 我的机器人在一个服务器中,所以我同时授予它PRESENCE INTENT和SERVER MEMBERS INTENT。我的印象是,这应该足以让机器人重新开始正常工作,但可悲的是,它仍然不欢迎新成员,也没有给它自定义角色。其他一

  • 我正在尝试使用Firebase云消息传递向IOS设备发送通知-Firebase控制台中的每个IOS项目都有一个有效的APNs P8 Auth Key,该密钥是为此目的从Apple开发者帐户新生成的。 我正在使用这种方法: 这导致FCM出现以下错误: 如果我从消息中删除“通知”块,FCM会成功响应,但设备上没有收到任何消息。 我可以使用上面的示例消息向Android设备发送和接收通知。 FCM文档表

  • 我试图读取一个CSV文件,然后根据该CSV文件创建一个新的对象。我可以用SuperCSV库成功地做到这一点,但是如果发生错误(例如特定的单元格为null),它会抛出一个错误(如预期的那样)。我试图在ArrayList中收集所有错误,但现在第一个异常时一切都会停止。如何使SuperCSV CsvBeanReader继续到下一行,即使处理器出现错误?我在try/catch块中有循环条件。代码如下:

  • 我以前非常成功地使用了JMS的Spring集成,但是我们现在使用RabbitMQ/AMQP,并且在错误处理方面有一些问题。 我有一个int-amqp: inbinding-Channel适配器,带有一个设置为接收任何异常的错误通道,这里有一个错误转换器类检查失败的消息的原因异常。然后根据异常的类型:- > 抑制异常并转换为JSON对象,该对象可以作为解释故障的业务回复转到AMQP出站通道适配器。在

  • 我有一个由多个线程操作的ArrayList,由于ArrayList没有同步,所以无法工作。按照教授的指示,我把列表换成了向量。向量是同步的,但我抛出了与同步相关的异常。 为什么会发生这种情况,我如何避免代码中的并发异常?我不想只是玩玩,直到有东西起作用,我想做最好的事情。谢谢! 例外情况: 代码: