This discussion is archived
2 Replies Latest reply: Jan 17, 2013 11:37 AM by safarmer RSS

i have written a java card applet... i want to create a android app to comm

980216 Newbie
Currently Being Moderated
i have written a java card applet... i want to create a android app to communicate with the applet.

i have use izyNFC to create the applet. i have installed the android sdks and have knowledge about creating basic android apps.

how do i create a android application to communicate with the applet through apdu's. im stuck.

help needed.

thank you,
  • 1. Re: i have written a java card applet... i want to create a android app to comm
    HanaBizhani Newbie
    Currently Being Moderated
    Hi,

    1) Import android.smartcard libraries,

    2) Try to make a connection :
    ISmartcardConnectionListener connectionListener = new ISmartcardConnectionListener()
    3) create an instance of smartcardclient:
    smartcard = new SmartcardClient(this, connectionListener);
    4) get the list of readers :
    String[] readers = smartcard.getReaders();
    you can check if a specific reader is connected or nor with
    smartcard.isCardPresent(readers [0]);
    5) create a card channel and select your applet:
    cardChannel = smartcard.openLogicalChannel(cardReader, APPLET_AID);
    
    ICardChannel cardChannel = null;
    cardChannel = smartcard.openLogicalChannel(cardReader, APPLET_AID);
    6) you can send and receive APDUs with this line of code:
    byte[] response Apdu = cardChannel.transmit(commandApdu);
    Regards,
    Hana
  • 2. Re: i have written a java card applet... i want to create a android app to comm
    safarmer Expert
    Currently Being Moderated
    If you have access to the Android build (using AOSP) then you might also be able to use the nfc_extras.jar which provides and API for sending APDUs to the secure element in a device. There is also SEEK for Android that you might be able to use.

    As you can image though, access to the secure element is usually locked down (for security reasons) so you may need access to the Android build for this to work (or have a rooted phone).

    - Shane

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points