SEService
public
final
class
SEService
extends Object
java.lang.Object | |
↳ | 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.
See also:
Summary
Nested classes | |
---|---|
interface |
SEService.OnConnectedListener
Interface to send call-backs to the application when the service is connected. |
Constants | |
---|---|
String |
ACTION_SECURE_ELEMENT_STATE_CHANGED
Broadcast Action: Intent to notify if the secure element state is changed. |
String |
EXTRA_READER_NAME
Mandatory extra containing the reader name of the state changed secure element. |
String |
EXTRA_READER_STATE
Mandatory extra containing the connected state of the state changed secure element. |
Public constructors | |
---|---|
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. |
Public methods | |
---|---|
Reader[]
|
getReaders()
Returns an array of available Secure Element readers. |
Reader
|
getUiccReader(int slotNumber)
Obtain a UICC Reader instance with specific slot number from the SecureElementService |
String
|
getVersion()
Returns the version of the OpenMobile API specification this implementation is based on. |
boolean
|
isConnected()
Tells whether or not the service is connected. |
void
|
shutdown()
Releases all Secure Elements resources allocated by this SEService (including any binding to an underlying service). |
Inherited methods | |
---|---|
Constants
ACTION_SECURE_ELEMENT_STATE_CHANGED
public static final String ACTION_SECURE_ELEMENT_STATE_CHANGED
Broadcast Action: Intent to notify if the secure element state is changed.
Constant Value: "android.se.omapi.action.SECURE_ELEMENT_STATE_CHANGED"
EXTRA_READER_NAME
public static final String EXTRA_READER_NAME
Mandatory extra containing the reader name of the state changed secure element.
See also:
Constant Value: "android.se.omapi.extra.READER_NAME"
EXTRA_READER_STATE
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.
Constant Value: "android.se.omapi.extra.READER_STATE"
Public constructors
SEService
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.
Parameters | |
---|---|
context |
Context : the context of the calling application. Cannot be
null . |
executor |
Executor : an Executor which will be used when invoking the callback.
This value cannot be null . |
listener |
SEService.OnConnectedListener : a OnConnectedListener object.
This value cannot be null . |
Public methods
getReaders
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.
Returns | |
---|---|
Reader[] |
An array of Readers. If there are no readers the returned array
is of length 0.
This value cannot be null . |
getUiccReader
public Reader getUiccReader (int slotNumber)
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. |
Returns | |
---|---|
Reader |
A Reader object for this uicc slot.
This value cannot be null . |
Throws | |
---|---|
IllegalArgumentException |
if the reader object corresponding to the uiccSlotNumber is not exist. |
getVersion
public String getVersion ()
Returns the version of the OpenMobile API specification this implementation is based on.
Returns | |
---|---|
String |
String containing the OpenMobile API version (e.g. "3.0").
This value cannot be null . |
isConnected
public boolean isConnected ()
Tells whether or not the service is connected.
Returns | |
---|---|
boolean |
true if the service is connected. |
shutdown
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.
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.