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/NfcF#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/nfc/tech/NfcF#inhmethods)

# NfcF

*** ** * ** ***

` public final class NfcF `   
` extends https://developer.android.com/reference/java/lang/Object ` ` implements https://developer.android.com/reference/android/nfc/tech/TagTechnology `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.nfc.tech.NfcF |

<br />

*** ** * ** ***

Provides access to NFC-F (JIS 6319-4) properties and I/O operations on a `https://developer.android.com/reference/android/nfc/Tag`.

Acquire a `https://developer.android.com/reference/android/nfc/tech/NfcF` object using `https://developer.android.com/reference/android/nfc/tech/NfcF#get(android.nfc.Tag)`.

The primary NFC-F I/O operation is `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])`. Applications must implement their own protocol stack on top of `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])`.

**Note:** Methods that perform I/O operations require the `https://developer.android.com/reference/android/Manifest.permission#NFC` permission.

## Summary

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#close()() ` Disable I/O operations to the tag from this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object, and release resources. |
| ` void` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#connect()() ` Enable I/O operations to the tag from this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object. |
| ` static https://developer.android.com/reference/android/nfc/tech/NfcF` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#get(android.nfc.Tag)(https://developer.android.com/reference/android/nfc/Tag tag) ` Get an instance of `https://developer.android.com/reference/android/nfc/tech/NfcF` for the given tag. |
| ` byte[]` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#getManufacturer()() ` Return the Manufacturer bytes from tag discovery. |
| ` int` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#getMaxTransceiveLength()() ` Return the maximum number of bytes that can be sent with `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])`. |
| ` byte[]` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#getSystemCode()() ` Return the System Code bytes from tag discovery. |
| ` https://developer.android.com/reference/android/nfc/Tag` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#getTag()() ` Get the `https://developer.android.com/reference/android/nfc/Tag` object backing this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object. |
| ` int` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#getTimeout()() ` Get the current `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])` timeout in milliseconds. |
| ` boolean` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#isConnected()() ` Helper to indicate if I/O operations should be possible. |
| ` void` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#setTimeout(int)(int timeout) ` Set the `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])` timeout in milliseconds. |
| ` byte[]` | ` https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])(byte[] data) ` Send raw NFC-F commands to the tag and receive the response. |

### Inherited methods

From class ` https://developer.android.com/reference/java/lang/Object ` ` https://developer.android.com/reference/java/lang/Object` ` https://developer.android.com/reference/java/lang/Object#clone()() `

Creates and returns a copy of this object.
` boolean` ` https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj) `

Indicates whether some other object is "equal to" this one.
` void` ` https://developer.android.com/reference/java/lang/Object#finalize()() `

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
` final https://developer.android.com/reference/java/lang/Class<?>` ` https://developer.android.com/reference/java/lang/Object#getClass()() `

Returns the runtime class of this `Object`.
` int` ` https://developer.android.com/reference/java/lang/Object#hashCode()() `

Returns a hash code value for the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#notify()() `

Wakes up a single thread that is waiting on this object's monitor.
` final void` ` https://developer.android.com/reference/java/lang/Object#notifyAll()() `

Wakes up all threads that are waiting on this object's monitor.
` https://developer.android.com/reference/java/lang/String` ` https://developer.android.com/reference/java/lang/Object#toString()() `

Returns a string representation of the object.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis) `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*, or until a certain amount of real time has elapsed.
` final void` ` https://developer.android.com/reference/java/lang/Object#wait()() `

Causes the current thread to wait until it is awakened, typically by being *notified* or *interrupted*.
From interface ` https://developer.android.com/reference/android/nfc/tech/TagTechnology ` ` 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.
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 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/io/IOException` |   |

### connect

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

```
public 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/java/io/IOException` |   |

### get

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

```
public static NfcF get (Tag tag)
```

Get an instance of `https://developer.android.com/reference/android/nfc/tech/NfcF` for the given tag.

Returns null if `https://developer.android.com/reference/android/nfc/tech/NfcF` was not enumerated in `https://developer.android.com/reference/android/nfc/Tag#getTechList()`. This indicates the tag does not support NFC-F.

Does not cause any RF activity and does not block.

<br />

| Parameters ||
|---|---|
| `tag` | `Tag`: an NFC-F compatible tag <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/nfc/tech/NfcF` | NFC-F object <br /> |

### getManufacturer

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

```
public byte[] getManufacturer ()
```

Return the Manufacturer bytes from tag discovery.

Does not cause any RF activity and does not block.

<br />

| Returns ||
|---|---|
| `byte[]` | Manufacturer bytes <br /> |

### getMaxTransceiveLength

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

```
public int getMaxTransceiveLength ()
```

Return the maximum number of bytes that can be sent with `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])`.

<br />

| Returns ||
|---|---|
| `int` | the maximum number of bytes that can be sent with `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])`. <br /> |

### getSystemCode

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

```
public byte[] getSystemCode ()
```

Return the System Code bytes from tag discovery.

Does not cause any RF activity and does not block.

<br />

| Returns ||
|---|---|
| `byte[]` | System Code bytes <br /> |

### getTag

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

```
public 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 /> |

### getTimeout

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

```
public int getTimeout ()
```

Get the current `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])` timeout in milliseconds.

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

<br />

| Returns ||
|---|---|
| `int` | timeout value in milliseconds <br /> |

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

### isConnected

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

```
public 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 /> |

### setTimeout

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

```
public void setTimeout (int timeout)
```

Set the `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])` timeout in milliseconds.

The timeout only applies to `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])` on this object, and is reset to a default value when `https://developer.android.com/reference/android/nfc/tech/NfcF#close()` is called.

Setting a longer timeout may be useful when performing transactions that require a long processing time on the tag such as key generation.

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

<br />

| Parameters ||
|---|---|
| `timeout` | `int`: timeout value in milliseconds <br /> |

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

### transceive

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

```
public byte[] transceive (byte[] data)
```

Send raw NFC-F commands to the tag and receive the response.

Applications must not prefix the SoD (preamble and sync code) and/or append the EoD (CRC) to the payload, it will be automatically calculated.

A typical NFC-F frame for this method looks like:

```
LENGTH (1 byte) --- CMD (1 byte) -- IDm (8 bytes) -- PARAMS (LENGTH - 10 bytes)
```

Use `https://developer.android.com/reference/android/nfc/tech/NfcF#getMaxTransceiveLength()` to retrieve the maximum amount of bytes that can be sent with `https://developer.android.com/reference/android/nfc/tech/NfcF#transceive(byte[])`.

This is an I/O operation and will block until complete. It must not be called from the main application thread. A blocked call will be canceled with `https://developer.android.com/reference/java/io/IOException` if `https://developer.android.com/reference/android/nfc/tech/NfcF#close()` is called from another thread.

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

<br />

| Parameters ||
|---|---|
| `data` | `byte`: bytes to send <br /> |

| Returns ||
|---|---|
| `byte[]` | bytes received in response <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 this operation is canceled |