Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Your manifest file needs to handle tech discovered intents, in a separately tech filter xml, like this:</p> <pre><code>&lt;intent-filter&gt; &lt;action android:name="android.intent.action.MAIN" /&gt; &lt;category android:name="android.intent.category.LAUNCHER" /&gt; &lt;/intent-filter&gt; &lt;intent-filter&gt; &lt;action android:name="android.nfc.action.TECH_DISCOVERED"/&gt; &lt;/intent-filter&gt; &lt;meta-data android:name="android.nfc.action.TECH_DISCOVERED" android:resource="@xml/nfc_tech_filter" /&gt; &lt;intent-filter&gt; &lt;action android:name="android.nfc.action.TAG_DISCOVERED"/&gt; &lt;/intent-filter&gt; </code></pre> <p>Then your res/xml/nfc_tech_filter.xml must handle the nfc techs you want like this:</p> <pre><code>&lt;resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"&gt; &lt;tech-list&gt; &lt;tech&gt;android.nfc.tech.MifareUltralight&lt;/tech&gt; &lt;tech&gt;android.nfc.tech.Ndef&lt;/tech&gt; &lt;tech&gt;android.nfc.tech.NfcA&lt;/tech&gt; &lt;/tech-list&gt; &lt;tech-list&gt; &lt;tech&gt;android.nfc.tech.MifareClassic&lt;/tech&gt; &lt;tech&gt;android.nfc.tech.Ndef&lt;/tech&gt; &lt;tech&gt;android.nfc.tech.NfcA&lt;/tech&gt; &lt;/tech-list&gt; &lt;/resources&gt; </code></pre> <p>Each tech node acts like an AND whereas the tech-list node acts like and OR. I recommend you to first scan your tags with a tool like NFC Tag Reader in order to know your techs.</p> <p>Then in java code you can enable/disable your foreground dispatch system like other sites already techs, I set up the same techs as I did in xml like this:</p> <pre><code>private void setUpForegroundDispatchSystem() { this.nfcAdapter = NfcAdapter.getDefaultAdapter(this); this.pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); try { ndef.addDataType("*/*"); /* Handles all MIME based dispatches. You should specify only the ones that you need. */ ndef.addDataScheme("http"); } catch (MalformedMimeTypeException e) { throw new RuntimeException("fail", e); } this.intentFiltersArray = new IntentFilter[] {ndef}; this.techListsArray = new String[][] { new String[] { MifareUltralight.class.getName(), Ndef.class.getName(), NfcA.class.getName()}, new String[] { MifareClassic.class.getName(), Ndef.class.getName(), NfcA.class.getName()}}; } </code></pre> <p>You must enable and disable this in Pause and Resume methods. Hope that this info helps you.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload