Android 无法在URL NDEF上进行筛选

Android 无法在URL NDEF上进行筛选,android,android-intent,nfc,intentfilter,ndef,Android,Android Intent,Nfc,Intentfilter,Ndef,在SE上有很多关于如何做到这一点的例子,但我似乎无法让它发挥作用。我想做的是,当扫描带有dev.example.com的标记时,我的应用程序启动(如果已安装),或者如果未安装,只需转到标记中的URL即可。无论应用程序是否正在运行,都应该发生这种情况 在舱单中: <activity android:name=".MainActivity"> <intent-filter android:label="@string/app_name"> <action a

在SE上有很多关于如何做到这一点的例子,但我似乎无法让它发挥作用。我想做的是,当扫描带有dev.example.com的标记时,我的应用程序启动(如果已安装),或者如果未安装,只需转到标记中的URL即可。无论应用程序是否正在运行,都应该发生这种情况

在舱单中:

<activity android:name=".MainActivity">
 <intent-filter  android:label="@string/app_name">
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    <category android:name="android.intent.category.DEFAULT" />
    <data
      android:host="dev.example.com"
      android:scheme="https" />
 </intent-filter>
指向url意图并写入标记。我的应用程序仍然没有截获任何URL NDEF记录

我还有一个

protected void onNewIntent(Intent intent) {}
在我的主要活动中,但它从未被调用,即使当文本NDEF启动应用程序时也是如此。但一次只解决一个问题

我真的没有其他手机可以试穿。我尝试了另一个S7,它只是启动了URL,不管是否安装了应用程序。(他可能勾选了“别再问了”)

谢谢

编辑:为了完整性,这里是NDEF。

为了避免弹出窗口,您应该将
pathPrefix
属性添加到URI意图:

<data
      android:host="dev.example.com"
      android:scheme="https" 
      android:pathPrefix="/" />

protected void onNewIntent(Intent intent) {}
<data
      android:host="dev.example.com"
      android:scheme="https" 
      android:pathPrefix="/" />