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

# Reader

*** ** * ** ***

` public final class Reader `   
` extends https://developer.android.com/reference/java/lang/Object ` ` `

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.se.omapi.Reader |

<br />

*** ** * ** ***

Instances of this class represent Secure Element Readers supported to this device. These Readers can be physical devices or virtual devices. They can be removable or not. They can contain Secure Element that can or cannot be removed.
**See also:**

- [GlobalPlatform Open Mobile API](http://globalplatform.org)

## Summary

| ### Public methods ||
|---|---|
| ` void` | ` https://developer.android.com/reference/android/se/omapi/Reader#closeSessions()() ` Close all the sessions opened on this reader. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/se/omapi/Reader#getName()() ` Return the name of this reader. |
| ` https://developer.android.com/reference/android/se/omapi/SEService` | ` https://developer.android.com/reference/android/se/omapi/Reader#getSEService()() ` Return the Secure Element service this reader is bound to. |
| ` boolean` | ` https://developer.android.com/reference/android/se/omapi/Reader#isSecureElementPresent()() ` Check if a Secure Element is present in this reader. |
| ` https://developer.android.com/reference/android/se/omapi/Session` | ` https://developer.android.com/reference/android/se/omapi/Reader#openSession()() ` Connects to a Secure Element in this reader. |

### 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*.

## Public methods

### closeSessions

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

```
public void closeSessions ()
```

Close all the sessions opened on this reader. All the channels opened by all these sessions will be closed.

<br />

### getName

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

```
public String getName ()
```

Return the name of this reader.

- If this reader is a SIM reader, then its name must be "SIM\[Slot\]".
- If the reader is a SD or micro SD reader, then its name must be "SD\[Slot\]"
- If the reader is a embedded SE reader, then its name must be "eSE\[Slot\]"

Slot is a decimal number without leading zeros. The Numbering must start with 1 (e.g. SIM1, SIM2, ... or SD1, SD2, ... or eSE1, eSE2, ...). The slot number \\u201c1\\u201d for a reader is optional (SIM and SIM1 are both valid for the first SIM-reader, but if there are two readers then the second reader must be named SIM2). This applies also for other SD or SE readers.

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | the reader name, as a String. This value cannot be `null`. <br /> |

### getSEService

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

```
public SEService getSEService ()
```

Return the Secure Element service this reader is bound to.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/se/omapi/SEService` | the SEService object. This value cannot be `null`. <br /> |

### isSecureElementPresent

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

```
public boolean isSecureElementPresent ()
```

Check if a Secure Element is present in this reader.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if the SE is present, `false` otherwise. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | if the service is not connected |

### openSession

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

```
public Session openSession ()
```

Connects to a Secure Element in this reader.   

This method prepares (initialises) the Secure Element for communication before the Session object is returned (e.g. powers the Secure Element by ICC ON if its not already on). There might be multiple sessions opened at the same time on the same reader. The system ensures the interleaving of APDUs between the respective sessions.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/se/omapi/Session` | a Session object to be used to create Channels. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/io/IOException` | if something went wrong with the communicating to the Secure Element or the reader. |