Read NFC cards with ACR 1252u on Android - android

We have a ACR 1252u NFC card reader. We want to read/write NFC cards on Android with this device. The problem is that this device is not seen as a NFC device but as a USB device instead. Therefore native Android NFC can not be used. Currently we are able to detect the device and to trigger an event by adding or removing a card. But we are neither able to read nor to write a card. In the documentation we found some HEX codes that are transmitted to the device, but we did not figure out how they work in order to read/write cards. Also on the net we found some example codes using other ACR devices but obviously they are not compatible to our one.
I am looking for any working examples in order to get the ACR1252u reading/writing NFC cards on Android.

The reader is a USB CCID (chip card interface device, see http://www.usb.org/developers/docs/devclass_docs/) device. Hence, you need to implement the PC/SC abstraction layer (see http://www.pcscworkgroup.com/specifications/overview.php) or use some ready-made library in order to send smartcard commands to that reader.

Related

iOS can write but can’t read NFC tag

I’ve a strange problem, i bought some NFC Blank Card on amazon,
From my iPhone X i Tried to write contents using NFC Tools, but i wasn’t able to do That.
So i read on many forums That IOS can read only NDEF formatted tags,
So with an Android phone i formatted the card with NFC Tools,
Then in NFC Tools from my iPhone i was able to write a vcard on the NFC Card,
I can read it from my Android phone but in IOS Nothing happening, i can’t read the card even from the NFC Tools.. i can only write on it..
As a Mifare Classic card is a proprietary format and not to an NFC Standard, therefore they have limited compatibility.
On iOS at the hardware level with the latest version of iOS it does have the API capability to read/write to these cards but might not have support for automatic reading of these cards in iOS.
Also iOS does not support formatting these cards and NFC Tools say it only has partial support for these cards.
So you should be able to use the CoreNFC API's to write your own program to read and write to these Mifare Classic Cards.
Alternatively you use the NFC TagWriter by NXP App on iOS as this will probably have better support for these Cards as NXP is the Manufacturer of them.
Though it would be best to not use these cards and use a card that conforms to one of the NFC standard like the NTAG21x range of tags.

Is it possible to transfer data to NFC tag without Beam? Any alternatives?

We have an Android app that writes data to a NFC tag using Android Beam. After deprecation of Beam in sdk 29, is there any alternative for data transference with a NFC tag?
Is it possible to use Google Nearby Share with a NFC tag?
I didn't found any documentation for it.
Google Nearby Share is Bluetooth or Wifi Direct as these were deemed by method to transfer data in the deprecation of Android Beam.
It should be technically possible to still transfer data via NFC without Android Beam, though there are some technical difficulties to over come.
One Device pretends to be a NFC Card with Host Card Emulation (HCE) and the other device reads/writes to it as if it was a normal Type 4 NFC card.
There are some complications if one device still has Android Beam but using the enableReaderMode NFC API to read/write to the Emulated Card should get around this.
I think some people of StackOverflow have tried this, I have not personally but the process of using HCE should be technically possible.

NFC device as a Reader for another Android HCE

I wanted to use my Android mobile as a reader to communicate to my android HCE(Host card EMulation) App. In internet I found the sample client application code for ACS Reader(PC Reader). Instead of that I would like to use my Android phone as a NFC Reader.
I found some sample for Mifare cards for Android, not for HCE communication
Please share If in case any sample code URL /API to help me for the same. Thank You
Not really sure what you are asking for, but here are two samples. One if for an Android NFC reader app and one is for an Android HCE app.
https://github.com/googlesamples/android-CardReader
https://github.com/googlesamples/android-CardEmulation
Please clarify your question if I did not understand you correctly.
CardReader
This sample demonstrates how to implement a low-level NFC card reader, for reading cards that do not contain NDEF or Android Beam data. This sample is designed to read the virtual loyalty card implemented in the CardEmulation sample.
In particular, this sample demonstrates how to disable Android Beam, select which AIDs the reader is interested in, and establish communication with the card. See Host-based Card Emulation for more information on the HCE APIs.
CardEmulation
This sample demonstrates how to emulate an NFC card, using the Host Card Emulation feature added in Android 4.4. This sample makes the device appear as a loyalty card whenever the screen is on and the user taps their device on an appropriately configured NFC reader.
The CardReader sample can be used to read the loyalty card implemented in this sample.
You can use an Android device (NFC+Kitkat onwards) in reader mode. Use NFCAdapter enableReaderMode function. This blog has complete sample.
Thanks
If I understand correclty your issue, you want to use one android device as an NFC reader to communicate with an HCE application installed on another android device. Am I right?
In this case, I do not think this is possible, because when you approach 2 NFC android devices, they will start to communicate in P2P.
In order to activate the CE mode on your "reading" device, you would need to deactivate the P2P feature, which is not possible if your phone is not rooted.

Android Mini PC MK802 RFID programming using external reader

this is my very first post on stackoverflow, I need to read a RFID tag using an external RFID reader, because I have to use android on MK802 via USB port. My concern is in using two packages android.nfc and android.nfc.tech, because I dont' know if I can use them. Do I need to read from USB or from RFID sensor?
You typically can't use the android.nfc.* packages for such a scenario. Android's NFC API is intended for NFC interfaces and not for RFID readers. Even if you do have an NFC interface device connected to your Android device through USB, you would need to provide the hardware abstraction layer to connect your NFC interface device to Android's NFC stack and compile that into your Android system.
Depending on how your RFID reader works, the reader's manufacturer might provide an API for Android (unlikely) or will be able to provide you with specifications on how to interface their device (this could be possibe through ANdroid's USB API but it could also be as simple as receiving keyboard inputs).

How well does the Android NFC API support Mifare Desfire?

I'm likely to be working on a project where existing Desfire cards (used to access paid services) will be replaced with an NFC-capable mobile device. Can anyone point me to any resources to help me understand what's involved in a) replicating a Desfire card's data onto a mobile device so it can take the place of a card, and b) for the app to deliver NFC data in order to present to the reader as if it were a card. All relevant keys and access will be provided by the card issuer (if the project goes ahead) but I'm keen to understand the process in advance.
I also need to understand how well the Android NFC API supports Desfire, because as far as I can see it only properly support Classic. http://developer.android.com/reference/android/nfc/tech/package-summary.html
MIFARE DESFire is ISO 14443-4 compliant. Support in Android for ISO 14443-4 (and therefore MIFARE DESFire) is done by the IsoDep class. You can send any DESFire command using the transceive() method of that class.
Besides that, DESFire can be configured to be NFC Forum type 4 Tag compliant. In which case Android will read out automatically any NDEF messages from the tag and dispatch it in an intent. So you can make your app start automatically when a specific tag is scanned. (Android can also format a DESFire chip to contain NDEF and write NDEF data to it.)
Replacing a DESFire card by a mobile NFC device is another matter. Card emulation on currently available Android devices is done by an embedded Secure Element connected to the NFC chip. An Android app cannot emulate a card (there is also no API for this) and the Secure Element cannot emulate a DESFire chip. Furthermore, there is no open API to access the Secure Element from an app.
The only way an Android NFC app can communicate via NFC to another device (that is not a card) is using Android Beam. This is, however, a different protocol than that used between card and reader.
NFC guy answer is excellent, but a bit outdated, so I decided to add an update.
Starting with KitKat (4.4), you can now emulate cards without a secure element.
It is called Host-based Card Emulation (Hce) and with that you can emulate a ISO 14443 type A card.. Like a desfire card.
There are two small caveats:
your reader must issues, just after polling the "card", a ISO SELECT (aid), with a fixed application id (aid) of your choice. This AID must be registered in your app manifest. Android will intercept this ISO SELECT, read the aid, and call you only if it matches with the one in your manifest.
Then you can exchange anything, it does not even have to be ISO APDUs (ISO 14443 encapsulation is done by android). So, for example, if you want to, you can even emulate the challenge response authentication of desfire (0xA0 key_num, 0xAF challenge, 0xAF response, 0x00 session_key)
you cannot rely on the UID (but you don't, right? This is a bad practice anyway, so no-one does it... right? :) ) because it is random, and it changes constantly (not inside a single session, of course, but...)
We are emulating our desfire cards, and the only change we had to do was to switch from our initial desfire select application (0x5A) to a ISO SELECT (0x00 0xA4 0x04).
Emulating authentication (the challenge-response thing) can be tricky, but we had already done it "the other way around" (using NFC to read desfire cards), so it was easy for us.
And if you rely on the card UID for authentication.. it's a good time to change it :)
Given your situation, i would say Android SDK is more than sufficient to solve your problem.
There are two parts to your case:
Reading the information from the existing cards.
Making an app with the information you have read from the cards.
Part 1:
Your only worry has to be in reading the DESFire card. If the information in the DESFire card is stored in NDEF format, it makes things even more easy.
Ndef is a class in the SDK which can be used to retrieve the information in NdefMessage type which you can then use to save the retrieved information into your storage facility, be it a local database, or a remote database, or just in the application memory.
The above is under the assumption the card is not protected. If it is, then you have to use transceive function to interact using raw byte communication. This would unlock for the rest of the information to be read. From here you can read the NDEF records.
Part 2:
My suggestion is skip the card emulation aspect of it. You are going to hit a wall at some point in time.
If the device that has been reading the card in the existing solution is attached to an android device, then Android Beam is the way to go. Which is nothing but Android App to Android App communication! Android already does the heavy lifting, so most of your work is going to be easy.
The information on the card can be stored as ndef messages and sent through beam, or you can simply create a custom object and send it through.
You may want to look at Mifare4Mobile, the initiative set up to transition from Mifare cards to NFC devices:
http://mifare4mobile.org/

Categories

Resources