You can call getId()
on the Tag object in the Intent. This will return the ID of the tag (which, in the case of MIFARE Classic, may be a 4- or 7-byte unique ID, a random ID or a fixed non-unique 4-byte ID; depending on the exact MIFARE Classic product).
There is no need to call connect()
on NfcA
(and no possibility to do anything meaningful).
Please, note that this will not work on the Samsung Galaxy S4. That phone will not dispatch an NFC intent when a MIFARE tag is tapped. Instead, it will display an error message on the screen stating that the phone is incompatible with this tag and then ignore the tag.
UPDATE: On an S4 running Android 4.4 KitKat, you can use the NFC Reader Mode to get access to such details as card UID, also for MIFARE Classic tags.