Added in [API level 10](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Methods](https://developer.android.com/reference/android/nfc/tech/TagTechnology#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/nfc/tech/TagTechnology#inhmethods)

# TagTechnology

*** ** * ** ***

` public interface TagTechnology `   
` implements https://developer.android.com/reference/java/io/Closeable `

|---|
| android.nfc.tech.TagTechnology |

Known indirect subclasses [IsoDep](https://developer.android.com/reference/android/nfc/tech/IsoDep), [MifareClassic](https://developer.android.com/reference/android/nfc/tech/MifareClassic), [MifareUltralight](https://developer.android.com/reference/android/nfc/tech/MifareUltralight), [Ndef](https://developer.android.com/reference/android/nfc/tech/Ndef), [NdefFormatable](https://developer.android.com/reference/android/nfc/tech/NdefFormatable), [NfcA](https://developer.android.com/reference/android/nfc/tech/NfcA), [NfcB](https://developer.android.com/reference/android/nfc/tech/NfcB), [NfcBarcode](https://developer.android.com/reference/android/nfc/tech/NfcBarcode), [NfcF](https://developer.android.com/reference/android/nfc/tech/NfcF), [NfcV](https://developer.android.com/reference/android/nfc/tech/NfcV) [IsoDep](https://developer.android.com/reference/android/nfc/tech/IsoDep) Provides access to ISO-DEP (ISO 14443-4) properties and I/O operations on a `https://developer.android.com/reference/android/nfc/Tag`. [MifareClassic](https://developer.android.com/reference/android/nfc/tech/MifareClassic) Provides access to MIFARE Classic properties and I/O operations on a `https://developer.android.com/reference/android/nfc/Tag`. [MifareUltralight](https://developer.android.com/reference/android/nfc/tech/MifareUltralight) Provides access to MIFARE Ultralight properties and I/O operations on a `https://developer.android.com/reference/android/nfc/Tag`. [Ndef](https://developer.android.com/reference/android/nfc/tech/Ndef) Provides access to NDEF content and operations on a `https://developer.android.com/reference/android/nfc/Tag`. [NdefFormatable](https://developer.android.com/reference/android/nfc/tech/NdefFormatable) Provide access to NDEF format operations on a `https://developer.android.com/reference/android/nfc/Tag`. [NfcA](https://developer.android.com/reference/android/nfc/tech/NfcA) Provides access to NFC-A (ISO 14443-3A) properties and I/O operations on a `https://developer.android.com/reference/android/nfc/Tag`. [NfcB](https://developer.android.com/reference/android/nfc/tech/NfcB) Provides access to NFC-B (ISO 14443-3B) properties and I/O operations on a `https://developer.android.com/reference/android/nfc/Tag`. [NfcBarcode](https://developer.android.com/reference/android/nfc/tech/NfcBarcode) Provides access to tags containing just a barcode. [NfcF](https://developer.android.com/reference/android/nfc/tech/NfcF) Provides access to NFC-F (JIS 6319-4) properties and I/O operations on a `https://developer.android.com/reference/android/nfc/Tag`. [NfcV](https://developer.android.com/reference/android/nfc/tech/NfcV) Provides access to NFC-V (ISO 15693) properties and I/O operations on a `https://developer.android.com/reference/android/nfc/Tag`.   

*** ** * ** ***

`https://developer.android.com/reference/android/nfc/tech/TagTechnology` is an interface to a technology in a `https://developer.android.com/reference/android/nfc/Tag`.

Obtain a `https://developer.android.com/reference/android/nfc/tech/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 `https://developer.android.com/reference/android/nfc/tech/TagTechnology` implementations provide access to these different technologies and capabilities. Some sub-classes map to technology specification (for example `https://developer.android.com/reference/android/nfc/tech/NfcA`, `https://developer.android.com/reference/android/nfc/tech/IsoDep`, others map to pseudo-technologies or capabilities (for example `https://developer.android.com/reference/android/nfc/tech/Ndef`, `https://developer.android.com/reference/android/nfc/tech/NdefFormatable`).

It is mandatory for all Android NFC devices to provide the following `https://developer.android.com/reference/android/nfc/tech/TagTechnology` implementations.

- `https://developer.android.com/reference/android/nfc/tech/NfcA` (also known as ISO 14443-3A)
- `https://developer.android.com/reference/android/nfc/tech/NfcB` (also known as ISO 14443-3B)
- `https://developer.android.com/reference/android/nfc/tech/NfcF` (also known as JIS 6319-4)
- `https://developer.android.com/reference/android/nfc/tech/NfcV` (also known as ISO 15693)
- `https://developer.android.com/reference/android/nfc/tech/IsoDep`
- `https://developer.android.com/reference/android/nfc/tech/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 `https://developer.android.com/reference/android/nfc/tech/TagTechnology` implementations. If it is not provided, the Android device will never enumerate that class via `https://developer.android.com/reference/android/nfc/Tag#getTechList()`.

- `https://developer.android.com/reference/android/nfc/tech/MifareClassic`
- `https://developer.android.com/reference/android/nfc/tech/MifareUltralight`
- `https://developer.android.com/reference/android/nfc/tech/NfcBarcode`
- `https://developer.android.com/reference/android/nfc/tech/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.

`https://developer.android.com/reference/android/nfc/tech/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 `https://developer.android.com/reference/android/nfc/tech/TagTechnology#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.

- `https://developer.android.com/reference/android/nfc/tech/TagTechnology#connect()` must be called before using any other I/O operation.
- `https://developer.android.com/reference/android/nfc/tech/TagTechnology#close()` must be called after completing I/O operations with a `https://developer.android.com/reference/android/nfc/tech/TagTechnology`, and it will cancel all other blocked I/O operations on other threads (including `https://developer.android.com/reference/android/nfc/tech/TagTechnology#connect()` with `https://developer.android.com/reference/java/io/IOException`.
- Only one `https://developer.android.com/reference/android/nfc/tech/TagTechnology` can be connected at a time. Other calls to `https://developer.android.com/reference/android/nfc/tech/TagTechnology#connect()` will return `https://developer.android.com/reference/java/io/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 `https://developer.android.com/reference/android/Manifest.permission#NFC` permission.

## Summary

| ### Public methods ||
|---|---|
| ` abstract void` | ` https://developer.android.com/reference/android/nfc/tech/TagTechnology#close()() ` Disable I/O operations to the tag from this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object, and release resources. |
| ` abstract void` | ` https://developer.android.com/reference/android/nfc/tech/TagTechnology#connect()() ` Enable I/O operations to the tag from this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object. |
| ` abstract https://developer.android.com/reference/android/nfc/Tag` | ` https://developer.android.com/reference/android/nfc/tech/TagTechnology#getTag()() ` Get the `https://developer.android.com/reference/android/nfc/Tag` object backing this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object. |
| ` abstract boolean` | ` https://developer.android.com/reference/android/nfc/tech/TagTechnology#isConnected()() ` Helper to indicate if I/O operations should be possible. |

### Inherited methods

From interface ` https://developer.android.com/reference/java/io/Closeable ` ` abstract void` ` https://developer.android.com/reference/java/io/Closeable#close()() `

Closes this stream and releases any system resources associated with it.
From interface ` https://developer.android.com/reference/java/lang/AutoCloseable ` ` abstract void` ` https://developer.android.com/reference/java/lang/AutoCloseable#close()() `

Closes this resource, relinquishing any underlying resources.

## Public methods

### close

Added in [API level 10](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void close ()
```

Disable I/O operations to the tag from this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object, and release resources.

Also causes all blocked I/O operations on other thread to be canceled and return with `https://developer.android.com/reference/java/io/IOException`.

Requires the `https://developer.android.com/reference/android/Manifest.permission#NFC` permission.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/SecurityException` | if the tag object is reused after the tag has left the field |
| `https://developer.android.com/reference/java/io/IOException` |   |

**See also:**

- `https://developer.android.com/reference/android/nfc/tech/TagTechnology#connect()`

### connect

Added in [API level 10](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract void connect ()
```

Enable I/O operations to the tag from this `https://developer.android.com/reference/android/nfc/tech/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 `https://developer.android.com/reference/java/io/IOException` by calling `https://developer.android.com/reference/android/nfc/tech/TagTechnology#close()` from another thread.

Only one `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object can be connected to a `https://developer.android.com/reference/android/nfc/Tag` at a time.

Applications must call `https://developer.android.com/reference/android/nfc/tech/TagTechnology#close()` when I/O operations are complete.

Requires the `https://developer.android.com/reference/android/Manifest.permission#NFC` permission.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/android/nfc/TagLostException` | if the tag leaves the field |
| `https://developer.android.com/reference/java/io/IOException` | if there is an I/O failure, or connect is canceled |
| `https://developer.android.com/reference/java/lang/SecurityException` | if the tag object is reused after the tag has left the field |

**See also:**

- `https://developer.android.com/reference/android/nfc/tech/TagTechnology#close()`

### getTag

Added in [API level 10](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract Tag getTag ()
```

Get the `https://developer.android.com/reference/android/nfc/Tag` object backing this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/nfc/Tag` | the `https://developer.android.com/reference/android/nfc/Tag` backing this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object. <br /> |

### isConnected

Added in [API level 10](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public abstract boolean isConnected ()
```

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

Returns true if `https://developer.android.com/reference/android/nfc/tech/TagTechnology#connect()` has completed, and `https://developer.android.com/reference/android/nfc/tech/TagTechnology#close()` has not been called, and the `https://developer.android.com/reference/android/nfc/Tag` is not known to be out of range.

Does not cause RF activity, and does not block.

<br />

| Returns ||
|---|---|
| `boolean` | true if I/O operations should be possible <br /> |