NfcAdapter.ActionTechDiscovered Field

Definition

Intent to start an activity when a tag is discovered and activities are registered for the specific technologies on the tag.

[Android.Runtime.Register("ACTION_TECH_DISCOVERED")]
public const string ActionTechDiscovered;
[<Android.Runtime.Register("ACTION_TECH_DISCOVERED")>]
val mutable ActionTechDiscovered : string

Field Value

Attributes

Remarks

Intent to start an activity when a tag is discovered and activities are registered for the specific technologies on the tag.

To receive this intent an activity must include an intent filter for this action and specify the desired tech types in a manifest meta-data entry. Here is an example manfiest entry:

&lt;activity android:name=".nfc.TechFilter" android:label="NFC/TechFilter"&gt;
                &lt;!-- Add a technology 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/filter_nfc"
                /&gt;
            &lt;/activity&gt;

The meta-data XML file should contain one or more tech-list entries each consisting or one or more tech entries. The tech entries refer to the qualified class name implementing the technology, for example "android.nfc.tech.NfcA".

A tag matches if any of the tech-list sets is a subset of Tag#getTechList() Tag.getTechList(). Each of the tech-lists is considered independently and the activity is considered a match is any single tech-list matches the tag that was discovered. This provides AND and OR semantics for filtering desired techs. Here is an example that will match any tag using NfcF or any tag using NfcA, MifareClassic, and Ndef:

&lt;resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"&gt;
                &lt;!-- capture anything using NfcF --&gt;
                &lt;tech-list&gt;
                    &lt;tech&gt;android.nfc.tech.NfcF&lt;/tech&gt;
                &lt;/tech-list&gt;

                &lt;!-- OR --&gt;

                &lt;!-- capture all MIFARE Classics with NDEF payloads --&gt;
                &lt;tech-list&gt;
                    &lt;tech&gt;android.nfc.tech.NfcA&lt;/tech&gt;
                    &lt;tech&gt;android.nfc.tech.MifareClassic&lt;/tech&gt;
                    &lt;tech&gt;android.nfc.tech.Ndef&lt;/tech&gt;
                &lt;/tech-list&gt;
            &lt;/resources&gt;

This intent is started after #ACTION_NDEF_DISCOVERED and before #ACTION_TAG_DISCOVERED. If any activities respond to #ACTION_NDEF_DISCOVERED this intent will not be started. If any activities respond to this intent #ACTION_TAG_DISCOVERED will not be started.

Java documentation for android.nfc.NfcAdapter.ACTION_TECH_DISCOVERED.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to