3

I need to communicate the Android mobile device Nexus S with a Topaz tag via NFC. I have done the java program which reads data from the card, but this uses javax.smartcardio java class, which is not available on Android. How could I import this class to make it available on Android project?

Thank you very much.

jose
  • 31
  • 2

1 Answers1

2

In order to communicate with a tag directly on Android you have to obtain a reference to the detected tag from one of the new NFC intents (NDEF_DISCOVERED, TECH_DISCOVERED, TAG_DISCOVERED). Setup an activity to receive these events and then extract the Tag object;

Tag tag = getIntent().getParcelableExtra(NfcAdapter.EXTRA_TAG);
MifareClassic mifareClassicTag = MifareClassic .get(tag);
mifareClassicTag.connect();
// The transceive command sends command directly to the tag. Internally it wraps the given command in a  direct transmit command and sends it to the NFC chip which forwards it to the tag
mifareClassicTag.transceive(...);

See the developer docs for more info for NFC on android http://developer.android.com/guide/topics/nfc/index.html

Michael Elias
  • 212
  • 1
  • 4