Reputation: 1122
I am really a newbie at programming with NFC. I want to access e.g. the Account number on the NFC- Tag on the card. I already found out that the card (PayPass, Visa aso.) is a IsoDep- Tech.
My code so far:
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
IsoDep isoDep = IsoDep.get(tag);
isoDep.connect();
byte[] result = isoDep.transceive(??????????????????);
I know that if you want to access Data on the card you have to use APDU in the transeceive Method. I am not sure what i have to type.
What do I have to write to access the data on the card?
Upvotes: 1
Views: 2621
Reputation: 7653
Please have a look at this open-source project:
https://github.com/devnied/EMV-NFC-Paycard-Enrollment
A Java library used to read and extract data from NFC EMV credit cards
I use it for french credit cards and it works well.
UPDATE1
All APDUs are created and managed by the library. You just have to implement interface IProvider: https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/master/library/src/main/java/com/github/devnied/emvnfccard/parser/IProvider.java
Here a implementation of IProvider: https://github.com/devnied/EMV-NFC-Paycard-Enrollment/blob/master/sample/src/main/java/com/github/devnied/emvnfccard/provider/Provider.java
IsoDep is sent to Provider class, and in method transceive, APDU are sent:
/**
* Tag comm
*/
private IsoDep mTagCom;
@Override
public byte[] transceive(final byte[] pCommand) throws CommunicationException {
[...]
byte[] response = null;
[...]
// send command to emv card
response = mTagCom.transceive(pCommand);
[...]
return response;
}
Upvotes: 1