For connection, here is a snippet to help you understand:
Now you have to understand that in java the communication takes place using package javax.smarcard which is not available for Android so take a look here for getting an idea as to how you can communicate or send/receive APDU (smartcard command).
Now as told in the answer mentioned above
You cannot simply send an APDU (smartcard command) over the bulk-out endpoint and expect to receive a response APDU over the bulk-in endpoint.
For getting the endpoints see the code snippet below :
Now you have the bulk-in and bulk-out endpoints to send and receive APDU command and APDU response blocks:
For sending commands, see the code snippet below:
And for receive/ read a response see the code snippet below :
Now if you see this answer here the 1st command to be sent is :
PC_to_RDR_IccPowerOn command to activate the card.
which you can create by reading section 6.1.1 of the USB Device Class Specifications doc here.
Now let's take an example of this command like the one here: 62000000000000000000 How you can send this is :
Now after you have successfully sent the APDU command, you can read the response using :
And receive something like
Now the response received in the code here will be in the result variable of read() method from code
This modified text is an extract of the original Stack Overflow Documentation created by following contributors and released under CC BY-SA 3.0