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

# NfcB

*** ** * ** ***

` public final class NfcB `   
` 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.NfcB |

<br />

*** ** * ** ***

Provides access to NFC-B (ISO 14443-3B) 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/NfcB` object using `https://developer.android.com/reference/android/nfc/tech/NfcB#get(android.nfc.Tag)`.

The primary NFC-B I/O operation is `https://developer.android.com/reference/android/nfc/tech/NfcB#transceive(byte[])`. Applications must implement their own protocol stack on top of `https://developer.android.com/reference/android/nfc/tech/NfcB#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/NfcB#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/NfcB#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/NfcB` | ` https://developer.android.com/reference/android/nfc/tech/NfcB#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/NfcB` for the given tag. |
| ` byte[]` | ` https://developer.android.com/reference/android/nfc/tech/NfcB#getApplicationData()() ` Return the Application Data bytes from ATQB/SENSB_RES at tag discovery. |
| ` int` | ` https://developer.android.com/reference/android/nfc/tech/NfcB#getMaxTransceiveLength()() ` Return the maximum number of bytes that can be sent with `https://developer.android.com/reference/android/nfc/tech/NfcB#transceive(byte[])`. |
| ` byte[]` | ` https://developer.android.com/reference/android/nfc/tech/NfcB#getProtocolInfo()() ` Return the Protocol Info bytes from ATQB/SENSB_RES at tag discovery. |
| ` https://developer.android.com/reference/android/nfc/Tag` | ` https://developer.android.com/reference/android/nfc/tech/NfcB#getTag()() ` Get the `https://developer.android.com/reference/android/nfc/Tag` object backing this `https://developer.android.com/reference/android/nfc/tech/TagTechnology` object. |
| ` boolean` | ` https://developer.android.com/reference/android/nfc/tech/NfcB#isConnected()() ` Helper to indicate if I/O operations should be possible. |
| ` byte[]` | ` https://developer.android.com/reference/android/nfc/tech/NfcB#transceive(byte[])(byte[] data) ` Send raw NFC-B 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 NfcB get (Tag tag)
```

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

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

Does not cause any RF activity and does not block.

<br />

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

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

### getApplicationData

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

```
public byte[] getApplicationData ()
```

Return the Application Data bytes from ATQB/SENSB_RES at tag discovery.

Does not cause any RF activity and does not block.

<br />

| Returns ||
|---|---|
| `byte[]` | Application Data bytes from ATQB/SENSB_RES 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/NfcB#transceive(byte[])`.

<br />

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

### getProtocolInfo

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

```
public byte[] getProtocolInfo ()
```

Return the Protocol Info bytes from ATQB/SENSB_RES at tag discovery.

Does not cause any RF activity and does not block.

<br />

| Returns ||
|---|---|
| `byte[]` | Protocol Info bytes from ATQB/SENSB_RES 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 /> |

### 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 /> |

### 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-B commands to the tag and receive the response.

Applications must not append the EoD (CRC) to the payload, it will be automatically calculated.

Applications must not send commands that manage the polling loop and initialization (SENSB_REQ, SLOT_MARKER etc).

Use `https://developer.android.com/reference/android/nfc/tech/NfcB#getMaxTransceiveLength()` to retrieve the maximum number of bytes that can be sent with `https://developer.android.com/reference/android/nfc/tech/NfcB#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/NfcB#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 |