Stay organized with collections
Save and categorize content based on your preferences.
Reader
class Reader
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.
Summary
Public methods |
Unit |
Close all the sessions opened on this reader.
|
String |
Return the name of this reader.
|
SEService |
Return the Secure Element service this reader is bound to.
|
Boolean |
Check if a Secure Element is present in this reader.
|
Session |
Connects to a Secure Element in this reader.
|
Public methods
closeSessions
fun closeSessions(): Unit
Close all the sessions opened on this reader. All the channels opened by all these sessions will be closed.
getName
fun getName(): String
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 “1” 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.
Return |
String |
the reader name, as a String. This value cannot be null . |
getSEService
fun getSEService(): SEService
Return the Secure Element service this reader is bound to.
Return |
SEService |
the SEService object. This value cannot be null . |
isSecureElementPresent
fun isSecureElementPresent(): Boolean
Check if a Secure Element is present in this reader.
Return |
Boolean |
true if the SE is present, false otherwise. |
Exceptions |
java.lang.IllegalStateException |
if the service is not connected |
openSession
fun openSession(): Session
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.
Return |
Session |
a Session object to be used to create Channels. This value cannot be null . |
Exceptions |
java.io.IOException |
if something went wrong with the communicating to the Secure Element or the reader. |
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 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Reader\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nReader\n======\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/se/omapi/Reader \"View this page in Java\") \n\n```\nclass Reader\n```\n\n|---|------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.se.omapi.Reader](#) |\n\nInstances 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.\n\nSummary\n-------\n\n| Public methods ||\n|------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------|\n| [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [closeSessions](#closeSessions())`()` Close all the sessions opened on this reader. |\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getName](#getName())`()` Return the name of this reader. |\n| [SEService](/reference/kotlin/android/se/omapi/SEService) | [getSEService](#getSEService())`()` Return the Secure Element service this reader is bound to. |\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [isSecureElementPresent](#isSecureElementPresent())`()` Check if a Secure Element is present in this reader. |\n| [Session](/reference/kotlin/android/se/omapi/Session) | [openSession](#openSession())`()` Connects to a Secure Element in this reader. |\n\nPublic methods\n--------------\n\n### closeSessions\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun closeSessions(): Unit\n```\n\nClose all the sessions opened on this reader. All the channels opened by all these sessions will be closed. \n\n### getName\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getName(): String\n```\n\nReturn the name of this reader.\n\n- If this reader is a SIM reader, then its name must be \"SIM\\[Slot\\]\".\n- If the reader is a SD or micro SD reader, then its name must be \"SD\\[Slot\\]\"\n- If the reader is a embedded SE reader, then its name must be \"eSE\\[Slot\\]\"\n\nSlot 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 \"1\" 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.\n\n\u003cbr /\u003e\n\n| Return ||\n|----------------------------------------------------------------------------------|------------------------------------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | the reader name, as a String. This value cannot be `null`. |\n\n### getSEService\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getSEService(): SEService\n```\n\nReturn the Secure Element service this reader is bound to.\n\n| Return ||\n|-----------------------------------------------------------|----------------------------------------------------|\n| [SEService](/reference/kotlin/android/se/omapi/SEService) | the SEService object. This value cannot be `null`. |\n\n### isSecureElementPresent\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun isSecureElementPresent(): Boolean\n```\n\nCheck if a Secure Element is present in this reader.\n\n| Return ||\n|------------------------------------------------------------------------------------|-------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | `true` if the SE is present, `false` otherwise. |\n\n| Exceptions ||\n|-----------------------------------|---------------------------------|\n| `java.lang.IllegalStateException` | if the service is not connected |\n\n### openSession\n\nAdded in [API level 28](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun openSession(): Session\n```\n\nConnects to a Secure Element in this reader. \nThis 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.\n\n| Return ||\n|-------------------------------------------------------|------------------------------------------------------------------------------|\n| [Session](/reference/kotlin/android/se/omapi/Session) | a Session object to be used to create Channels. This value cannot be `null`. |\n\n| Exceptions ||\n|-----------------------|-------------------------------------------------------------------------------------|\n| `java.io.IOException` | if something went wrong with the communicating to the Secure Element or the reader. |"]]