Skip to content

Most visited

Recently visited

navigation

TagTechnology

public interface TagTechnology
implements Closeable

android.nfc.tech.TagTechnology
Known Indirect Subclasses


TagTechnology is an interface to a technology in a Tag.

Obtain a 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 TagTechnology implementations provide access to these different technologies and capabilities. Some sub-classes map to technology specification (for example NfcA, IsoDep, others map to pseudo-technologies or capabilities (for example Ndef, NdefFormatable).

It is mandatory for all Android NFC devices to provide the following TagTechnology implementations.

  • NfcA (also known as ISO 14443-3A)
  • NfcB (also known as ISO 14443-3B)
  • NfcF (also known as JIS 6319-4)
  • NfcV (also known as ISO 15693)
  • IsoDep
  • 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 TagTechnology implementations. If it is not provided, the Android device will never enumerate that class via getTechList().

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 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.
  • connect() must be called before using any other I/O operation.
  • close() must be called after completing I/O operations with a TagTechnology, and it will cancel all other blocked I/O operations on other threads (including connect() with IOException.
  • Only one TagTechnology can be connected at a time. Other calls to connect() will return 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 NFC permission.

Summary

Public methods

abstract void close()

Disable I/O operations to the tag from this TagTechnology object, and release resources.

abstract void connect()

Enable I/O operations to the tag from this TagTechnology object.

abstract Tag getTag()

Get the Tag object backing this TagTechnology object.

abstract boolean isConnected()

Helper to indicate if I/O operations should be possible.

Inherited methods

From interface java.io.Closeable
From interface java.lang.AutoCloseable

Public methods

close

Added in API level 10
void close ()

Disable I/O operations to the tag from this TagTechnology object, and release resources.

Also causes all blocked I/O operations on other thread to be canceled and return with IOException.

Requires the NFC permission.

Throws
IOException

See also:

connect

Added in API level 10
void connect ()

Enable I/O operations to the tag from this TagTechnology object.

May cause RF activity and may block. Must not be called from the main application thread. A blocked call will be canceled with IOException by calling close() from another thread.

Only one TagTechnology object can be connected to a Tag at a time.

Applications must call close() when I/O operations are complete.

Requires the NFC permission.

Throws
if the tag leaves the field
IOException if there is an I/O failure, or connect is canceled

See also:

getTag

Added in API level 10
Tag getTag ()

Get the Tag object backing this TagTechnology object.

Returns
Tag the Tag backing this TagTechnology object.

isConnected

Added in API level 10
boolean isConnected ()

Helper to indicate if I/O operations should be possible.

Returns true if connect() has completed, and close() has not been called, and the Tag is not known to be out of range.

Does not cause RF activity, and does not block.

Returns
boolean true if I/O operations should be possible
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.

Take a one-minute survey?
Help us improve Android tools and documentation.