Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/222.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 恢复NFC标记行为_Android_Nfc - Fatal编程技术网

Android 恢复NFC标记行为

Android 恢复NFC标记行为,android,nfc,Android,Nfc,我正在创建一个应用程序,检测一些带有url的nfc标签。当我点击带有nfc标签的手机时,我遇到了问题,我被直接重定向到url页面。它不会向我显示应用程序选择器。可能有人初始设置Chorme为默认应用程序,当手机遇到此类基于url的NFC标记时启动。所以我的问题是,是否有可能恢复手机的NFC设置,以便它会问我,该启动哪个应用程序 用于检测NFC标签的意向过滤器: <intent-filter> <action android:name="android.nfc.action.

我正在创建一个应用程序,检测一些带有url的nfc标签。当我点击带有nfc标签的手机时,我遇到了问题,我被直接重定向到url页面。它不会向我显示应用程序选择器。可能有人初始设置Chorme为默认应用程序,当手机遇到此类基于url的NFC标记时启动。所以我的问题是,是否有可能恢复手机的NFC设置,以便它会问我,该启动哪个应用程序

用于检测NFC标签的意向过滤器:

<intent-filter>
  <action android:name="android.nfc.action.NDEF_DISCOVERED" />
  <data
       android:host="www.google.com"
       android:scheme="http" />
  <category android:name="android.intent.category.DEFAULT" />            </intent-filter>

意图过滤器用于检测网页的启动,我希望设备上安装的app+浏览器软件显示在app chooser中

<intent-filter>
<action android:name="android.intent.action.VIEW" >  </action>                   <category android:name="android.intent.category.DEFAULT" > </category>
<category android:name="android.intent.category.BROWSABLE" > </category>
<data android:host="www.google.com"
      android:scheme="http" ></data>
</intent-filter>


但是没有应用程序选择器显示,我被直接重定向到网页。

我想出了一些在这种情况下有效的解决方案:

出于第一目的:

<intent-filter>
    <action android:name="android.nfc.action.NDEF_DISCOVERED" />
    <data
       android:host="google.com"
       android:scheme="http" />
    <category android:name="android.intent.category.DEFAULT" />
</intent-filter>

第二个目的是:

<intent-filter>
    <action android:name="android.intent.action.VIEW" ></action>
    <category android:name="android.intent.category.DEFAULT" ></category>
    <category android:name="android.intent.category.BROWSABLE" ></category>
    <data android:host="google.com"
      android:scheme="http" ></data>
</intent-filter>

刚刚更改了对我有用的主机名