NfcAdapter.ActionTechDiscovered Field
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
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:
<activity android:name=".nfc.TechFilter" android:label="NFC/TechFilter">
<!-- Add a technology filter -->
<intent-filter>
<action android:name="android.nfc.action.TECH_DISCOVERED" />
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/filter_nfc"
/>
</activity>
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-list
s 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
:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<!-- capture anything using NfcF -->
<tech-list>
<tech>android.nfc.tech.NfcF</tech>
</tech-list>
<!-- OR -->
<!-- capture all MIFARE Classics with NDEF payloads -->
<tech-list>
<tech>android.nfc.tech.NfcA</tech>
<tech>android.nfc.tech.MifareClassic</tech>
<tech>android.nfc.tech.Ndef</tech>
</tech-list>
</resources>
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.