Added in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Nested Classes](https://developer.android.com/reference/android/se/omapi/SEService#nestedclasses) \| [Constants](https://developer.android.com/reference/android/se/omapi/SEService#constants) \| [Ctors](https://developer.android.com/reference/android/se/omapi/SEService#pubctors) \| [Methods](https://developer.android.com/reference/android/se/omapi/SEService#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/se/omapi/SEService#inhmethods)

# SEService

*** ** * ** ***

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

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

<br />

*** ** * ** ***

The SEService realises the communication to available Secure Elements on the device. This is the entry point of this API. It is used to connect to the infrastructure and get access to a list of Secure Element Readers.
**See also:**

- [SIMalliance Open Mobile API v3.0](http://simalliance.org)

## Summary

| ### Nested classes ||
|---|---|
| ` interface` | `https://developer.android.com/reference/android/se/omapi/SEService.OnConnectedListener` Interface to send call-backs to the application when the service is connected. |

| ### Constants ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/se/omapi/SEService#ACTION_SECURE_ELEMENT_STATE_CHANGED` Broadcast Action: Intent to notify if the secure element state is changed. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/se/omapi/SEService#EXTRA_READER_NAME` Mandatory extra containing the reader name of the state changed secure element. |
| `https://developer.android.com/reference/java/lang/String` | `https://developer.android.com/reference/android/se/omapi/SEService#EXTRA_READER_STATE` Mandatory extra containing the connected state of the state changed secure element. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/se/omapi/SEService#SEService(android.content.Context,%20java.util.concurrent.Executor,%20android.se.omapi.SEService.OnConnectedListener)(https://developer.android.com/reference/android/content/Context context, https://developer.android.com/reference/java/util/concurrent/Executor executor, https://developer.android.com/reference/android/se/omapi/SEService.OnConnectedListener listener) ` Establishes a new connection that can be used to connect to all the Secure Elements available in the system. |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/se/omapi/Reader` | ` https://developer.android.com/reference/android/se/omapi/SEService#getReaders()() ` Returns an array of available Secure Element readers. |
| ` https://developer.android.com/reference/android/se/omapi/Reader` | ` https://developer.android.com/reference/android/se/omapi/SEService#getUiccReader(int)(int slotNumber) ` Obtain a UICC Reader instance with specific slot number from the SecureElementService |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/se/omapi/SEService#getVersion()() ` Returns the version of the OpenMobile API specification this implementation is based on. |
| ` boolean` | ` https://developer.android.com/reference/android/se/omapi/SEService#isConnected()() ` Tells whether or not the service is connected. |
| ` void` | ` https://developer.android.com/reference/android/se/omapi/SEService#shutdown()() ` Releases all Secure Elements resources allocated by this SEService (including any binding to an underlying service). |

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

## Constants

### ACTION_SECURE_ELEMENT_STATE_CHANGED

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

```
public static final String ACTION_SECURE_ELEMENT_STATE_CHANGED
```

Broadcast Action: Intent to notify if the secure element state is changed.

<br />

Constant Value: "android.se.omapi.action.SECURE_ELEMENT_STATE_CHANGED"

### EXTRA_READER_NAME

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

```
public static final String EXTRA_READER_NAME
```

Mandatory extra containing the reader name of the state changed secure element.

<br />

**See also:**

- `https://developer.android.com/reference/android/se/omapi/Reader#getName()`

Constant Value: "android.se.omapi.extra.READER_NAME"

### EXTRA_READER_STATE

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

```
public static final String EXTRA_READER_STATE
```

Mandatory extra containing the connected state of the state changed secure element. True if the secure element is connected correctly, false otherwise.

<br />

Constant Value: "android.se.omapi.extra.READER_STATE"

## Public constructors

### SEService

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

```
public SEService (Context context, 
                Executor executor, 
                SEService.OnConnectedListener listener)
```

Establishes a new connection that can be used to connect to all the Secure Elements available in the system. The connection process can be quite long, so it happens in an asynchronous way. It is usable only if the specified listener is called or if isConnected() returns `true`.   

The call-back object passed as a parameter will have its onConnected() method called when the connection actually happen.

<br />

| Parameters ||
|---|---|
| `context` | `Context`: the context of the calling application. Cannot be `null`. <br /> |
| `executor` | `Executor`: an Executor which will be used when invoking the callback. This value cannot be `null`. <br /> |
| `listener` | `SEService.OnConnectedListener`: a OnConnectedListener object. This value cannot be `null`. <br /> |

## Public methods

### getReaders

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

```
public Reader[] getReaders ()
```

Returns an array of available Secure Element readers. There must be no duplicated objects in the returned list. All available readers shall be listed even if no card is inserted.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/se/omapi/Reader` | An array of Readers. If there are no readers the returned array is of length 0. This value cannot be `null`. <br /> |

### getUiccReader

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

```
public Reader getUiccReader (int slotNumber)
```

Obtain a UICC Reader instance with specific slot number from the SecureElementService

<br />

| Parameters ||
|---|---|
| `slotNumber` | `int`: The index of the uicc slot. The index starts from 1. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/se/omapi/Reader` | A Reader object for this uicc slot. This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if the reader object corresponding to the uiccSlotNumber is not exist. |

### getVersion

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

```
public String getVersion ()
```

Returns the version of the OpenMobile API specification this implementation is based on.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | String containing the OpenMobile API version (e.g. "3.0"). This value cannot be `null`. <br /> |

### isConnected

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

```
public boolean isConnected ()
```

Tells whether or not the service is connected.

<br />

| Returns ||
|---|---|
| `boolean` | `true` if the service is connected. <br /> |

### shutdown

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

```
public void shutdown ()
```

Releases all Secure Elements resources allocated by this SEService (including any binding to an underlying service). As a result isConnected() will return false after shutdown() was called. After this method call, the SEService object is not connected. This method should be called when connection to the Secure Element is not needed or in the termination method of the calling application (or part of this application) which is bound to this SEService.

<br />