{@link TagTechnology} is an interface to a technology in a {@link Tag}.
Obtain a {@link TagTechnology} implementation by calling the static method get()
on the implementation class.
NFC tags are based on a number of independently developed technologies and offer a
wide range of capabilities. The
{@link TagTechnology} implementations provide access to these different
technologies and capabilities. Some sub-classes map to technology
specification (for example {@link NfcA}, {@link IsoDep}, others map to
pseudo-technologies or capabilities (for example {@link Ndef}, {@link NdefFormatable}).
It is mandatory for all Android NFC devices to provide the following
{@link TagTechnology} implementations.
- {@link NfcA} (also known as ISO 14443-3A)
- {@link NfcB} (also known as ISO 14443-3B)
- {@link NfcF} (also known as JIS 6319-4)
- {@link NfcV} (also known as ISO 15693)
- {@link IsoDep}
- {@link Ndef} on NFC Forum Type 1, Type 2, Type 3 or Type 4 compliant tags
It is optional for Android NFC devices to provide the following
{@link TagTechnology} implementations. If it is not provided, the
Android device will never enumerate that class via {@link Tag#getTechList}.
- {@link MifareClassic}
- {@link MifareUltralight}
- {@link NfcBarcode}
- {@link NdefFormatable} must only be enumerated on tags for which this Android device
is capable of formatting. Proprietary knowledge is often required to format a tag
to make it NDEF compatible.
{@link TagTechnology} implementations provide methods that fall into two classes:
cached getters and I/O operations.
Cached getters
These methods (usually prefixed by get or is ) return
properties of the tag, as determined at discovery time. These methods will never
block or cause RF activity, and do not require {@link #connect} to have been called.
They also never update, for example if a property is changed by an I/O operation with a tag
then the cached getter will still return the result from tag discovery time.
I/O operations
I/O operations may require RF activity, and may block. They have the following semantics.
- {@link #connect} must be called before using any other I/O operation.
- {@link #close} must be called after completing I/O operations with a
{@link TagTechnology}, and it will cancel all other blocked I/O operations on other threads
(including {@link #connect} with {@link IOException}.
- Only one {@link TagTechnology} can be connected at a time. Other calls to
{@link #connect} will return {@link IOException}.
- I/O operations may block, and should never be called on the main application
thread.
Note: Methods that perform I/O operations
require the {@link android.Manifest.permission#NFC} permission. |