Android NDEF意图过滤器,包含http方案和主机的数据

And*_*zie 2 android nfc intentfilter

我正在尝试定义一个Intent过滤器,它只会在我收到包含特定网站的URI的NDEF消息时触发.

我把它定义如下:

        <intent-filter>
            <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
            <category android:name="android.intent.category.DEFAULT"/>
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http" />
            <data android:host="ta.bcntouch.com" />
        </intent-filter>
Run Code Online (Sandbox Code Playgroud)

但它不会像那样触发.我也尝试过:

            <data android:scheme="http"android:host="ta.bcntouch.com" />
Run Code Online (Sandbox Code Playgroud)

没有运气.只有DEFAULT.删除元素将导致它触发.

可以这样做吗?Android文档仅显示元素中使用MIME类型的示例.....

任何帮助赞赏.

And*_*zie 5

这是我最终使用的过滤器,用于捕获许多特定的已知URL组合.

主机字段开头的'*'允许我在使用子域中的测试服务器进行测试时使用相同的过滤器,或者使用相同的名称格式.

第二个(View)从网页,电子邮件等中捕获相同的URL格式:

        <intent-filter>
          <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
          <category android:name="android.intent.category.DEFAULT"/>
            <data android:scheme="http"
                  android:host="*ta.bcntouch.com" 
                  android:pathPattern="/p/.*" />
            <data android:scheme="http"
                  android:host="*ta.bcntouch.com" 
                  android:pathPattern="/l/.*" />
            <data android:scheme="http"
                  android:host="*ta.bcntouch.com" 
                  android:pathPattern="/a.*" />
            <data android:scheme="http"
                  android:host="*ta.bcntouch.com" 
                  android:pathPattern="/t.*" />
        </intent-filter>

        <intent-filter>
            <action android:name="android.intent.action.VIEW" />
            <category android:name="android.intent.category.DEFAULT" />
            <category android:name="android.intent.category.BROWSABLE" />
            <data android:scheme="http"
                  android:host="*ta.bcntouch.com" 
                  android:pathPattern="/p/.*" />
            <data android:scheme="http"
                  android:host="*ta.bcntouch.com" 
                  android:pathPattern="/l/.*" />
            <data android:scheme="http"
                  android:host="*ta.bcntouch.com" 
                  android:pathPattern="/a.*" />
            <data android:scheme="http"
                  android:host="*ta.bcntouch.com" 
                  android:pathPattern="/t/.*" />
        </intent-filter>
Run Code Online (Sandbox Code Playgroud)