Page 1 of 1

Reading a Smart Card using an Android App

Posted: Wed May 04, 2016 1:34 am
by irvinmags
Hello guys, I am trying to develop and read a Smart Card using an Android app. So far my app crashes when I try to read the card.
Here's my code:

Code: Select all

     Intent intent = getIntent();
        byte[] getCAN = {(byte)0x90, (byte) 0xBD, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
        Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
        IsoDep isoDep = IsoDep.get(tag);
        try {
            isoDep.connect();
            isoDep.setTimeout(5000);
            isoDep.transceive(getCAN); // now send your command
            isoDep.close();
        } catch (IOException e) {
            e.printStackTrace();
        }




Question is, am doing the right thing to "speak with my card"? I am new to android development and I would also like to know if there's a library like smartcardIO that I could use to communicate with smart cards. Thanks.

Re: Reading a Smart Card using an Android App

Posted: Wed May 04, 2016 3:43 am
by UNKNwYSHSA
1 Make sure your app is written follow the documentation: http://developer.android.com/guide/topi ... c/nfc.html
And there is one sample in the sdk: connectivity\CardReader
(You needs to obtain the permission to access NFC, register TECH_DISCOVERED action in AndroidManifest.xml and place your code in the action callback function.)
2 Debug your app and tell us which line your app crashed? and values of variables when crashing.