public class NfcExecutionEnvironment extends Object
Modifier and Type | Field and Description |
---|---|
static String |
ACTION_AID_SELECTED
Broadcast Action: An ISO-DEP AID was selected.
|
static String |
ACTION_APDU_RECEIVED
Broadcast action: A filtered APDU was received.
|
static String |
ACTION_EMV_CARD_REMOVAL
Broadcast action: An EMV card removal event was detected.
|
static String |
ACTION_MIFARE_ACCESS_DETECTED
Broadcast action: An adapter implementing MIFARE Classic via card
emulation detected that a block has been accessed.
|
static String |
EXTRA_AID
Mandatory byte array extra field in
ACTION_AID_SELECTED . |
static String |
EXTRA_APDU_BYTES
Mandatory byte array extra field in
ACTION_APDU_RECEIVED . |
static String |
EXTRA_MIFARE_BLOCK
Optional integer extra field in
ACTION_MIFARE_ACCESS_DETECTED . |
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the NFC Execution Environment on its contact interface.
|
void |
open()
Open the NFC Execution Environment on its contact interface.
|
byte[] |
transceive(byte[] in)
Send raw commands to the NFC-EE and receive the response.
|
public static final String ACTION_AID_SELECTED
This happens as the result of a 'SELECT AID' command from an external NFC reader/writer.
Always contains the extra field EXTRA_AID
Requires the android.Manifest.permission#WRITE_SECURE_SETTINGS
permission
to receive.
public static final String EXTRA_AID
ACTION_AID_SELECTED
.
Contains the AID selected.
public static final String ACTION_APDU_RECEIVED
This happens when an APDU of interest was matched by the Nfc adapter, for instance as the result of matching an externally-configured filter.
The filter configuration mechanism is not currently defined.
Always contains the extra field EXTRA_APDU_BYTES
.
public static final String EXTRA_APDU_BYTES
ACTION_APDU_RECEIVED
.
Contains the bytes of the received APDU.
public static final String ACTION_EMV_CARD_REMOVAL
public static final String ACTION_MIFARE_ACCESS_DETECTED
This may only be issued for the first block that the reader authenticates to.
May contain the extra field EXTRA_MIFARE_BLOCK
.
public static final String EXTRA_MIFARE_BLOCK
ACTION_MIFARE_ACCESS_DETECTED
.
Provides the block number being accessed. If not set, the block number being accessed is unknown.
public void open() throws EeIOException
Opening a channel to the the secure element may fail for a number of reasons:
EeNfcDisabledException
is thrown.
EeAlreadyOpenException
is thrown.
EeInitializationException
is thrown.
EeListenModeException
is thrown.
EeExternalFieldException
is
thrown.
All other NFC functionality is disabled while the NFC-EE is open
on its contact interface, so make sure to call close()
once complete.
Requires the android.Manifest.permission#WRITE_SECURE_SETTINGS
permission.
EeAlreadyOpenException
- if the NFC-EE is already openEeNfcDisabledException
- if NFC is disabledEeInitializationException
- if the Secure Element could not be initializedEeListenModeException
- if the NFCC or Secure Element is activated in listen modeEeExternalFieldException
- if the NFCC is in the presence of a remote-powered fieldEeIoException
- if an unknown error occursEeIOException
public void close() throws IOException
Requires the android.Manifest.permission#WRITE_SECURE_SETTINGS
permission.
IOException
- if the NFC-EE is already open, or some other error occurspublic byte[] transceive(byte[] in) throws IOException
Requires the android.Manifest.permission#WRITE_SECURE_SETTINGS
permission.
IOException
- if the NFC-EE is not open, or some other error occurs