SEService
class SEService
kotlin.Any | |
↳ | android.se.omapi.SEService |
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.
Summary
Nested classes | |
---|---|
abstract |
Interface to send call-backs to the application when the service is connected. |
Constants | |
---|---|
static String |
Broadcast Action: Intent to notify if the secure element state is changed. |
static String |
Mandatory extra containing the reader name of the state changed secure element. |
static String |
Mandatory extra containing the connected state of the state changed secure element. |
Public constructors | |
---|---|
SEService(context: Context, executor: Executor, listener: SEService.OnConnectedListener) Establishes a new connection that can be used to connect to all the Secure Elements available in the system. |
Public methods | |
---|---|
Array<Reader!> |
Returns an array of available Secure Element readers. |
Reader |
getUiccReader(slotNumber: Int) Obtain a UICC Reader instance with specific slot number from the SecureElementService |
String |
Returns the version of the OpenMobile API specification this implementation is based on. |
Boolean |
Tells whether or not the service is connected. |
Unit |
shutdown() Releases all Secure Elements resources allocated by this SEService (including any binding to an underlying service). |
Constants
ACTION_SECURE_ELEMENT_STATE_CHANGED
static val ACTION_SECURE_ELEMENT_STATE_CHANGED: String
Broadcast Action: Intent to notify if the secure element state is changed.
Value: "android.se.omapi.action.SECURE_ELEMENT_STATE_CHANGED"
EXTRA_READER_NAME
static val EXTRA_READER_NAME: String
Mandatory extra containing the reader name of the state changed secure element.
Value: "android.se.omapi.extra.READER_NAME"
See Also
EXTRA_READER_STATE
static val EXTRA_READER_STATE: String
Mandatory extra containing the connected state of the state changed secure element. True if the secure element is connected correctly, false otherwise.
Value: "android.se.omapi.extra.READER_STATE"
Public constructors
SEService
SEService(
context: Context,
executor: Executor,
listener: SEService.OnConnectedListener)
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.
Parameters | |
---|---|
context |
Context: the context of the calling application. Cannot be null . |
listener |
SEService.OnConnectedListener: a OnConnectedListener object. This value cannot be null . |
executor |
Executor: an Executor which will be used when invoking the callback. This value cannot be null . |
Public methods
getReaders
fun getReaders(): Array<Reader!>
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.
Return | |
---|---|
Array<Reader!> |
An array of Readers. If there are no readers the returned array is of length 0. This value cannot be null . |
getUiccReader
fun getUiccReader(slotNumber: Int): Reader
Obtain a UICC Reader instance with specific slot number from the SecureElementService
Parameters | |
---|---|
slotNumber |
Int: The index of the uicc slot. The index starts from 1. |
Return | |
---|---|
Reader |
A Reader object for this uicc slot. This value cannot be null . |
Exceptions | |
---|---|
java.lang.IllegalArgumentException |
if the reader object corresponding to the uiccSlotNumber is not exist. |
getVersion
fun getVersion(): String
Returns the version of the OpenMobile API specification this implementation is based on.
Return | |
---|---|
String |
String containing the OpenMobile API version (e.g. "3.0"). This value cannot be null . |
isConnected
fun isConnected(): Boolean
Tells whether or not the service is connected.
Return | |
---|---|
Boolean |
true if the service is connected. |
shutdown
fun shutdown(): Unit
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.