How to extract data through IsoDep technology - NFC(Android)

Viewed 1905

I'm using NFC technology for one of my projects in Android. I have successfully implemented the Tag detection and based on the Tag I know which class I need to use to extract the data. But there is one problem the card which I need to use/tap to get the data is using the IsoDep technology rather than NDEF one. I know how to extract the data from a card which is working on NDEF technology but I'm getting stuck here because of the IsoDep technology. I'm sharing my code snippet with this question for better understanding.

if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action) || NfcAdapter.ACTION_TECH_DISCOVERED.equals(action) || NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {

Tag tag = getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
IsoDep isoDep = IsoDep.get(tag);
isoDep.connect();
//code to get the data from card
isoDep.close()
}

So here I'm getting TAG_DISCOVERED through NFCAdapter and inside the condition I'm getting IsoDep, tech.NFcA, NdefFormattable as tag variable value. I'm creating the instance of IsoDep class and calling connect() method. Here I'm getting IOException everytime I'm trying to start the connection to read the data I don't know why !!! Can anyone help me to solve this? Any help would be appreciable.

Thanks

1 Answers
Related