Android NFC with USB-NFC-Reader - android

I have an Android tablet with Android 4.2. This tablet does not have NFC hardware. However I have an external USB reader: ACR 1252U, that came with an Android library. This library unfortunately only gives me basic functionality - read and write Tags. Altough this is working quite well, it is not enough...
Because for my application I need to transfer files from my Android 4.2 tablet to other NFC devices (Android smartphones). So I need to put the NFC reader into peer-to-peer mode - which it supports. But how can I achive this with my setup? There indeed is an SDK for that reader, but it's Windows only.
Is it somehow possible, to use the built-in NFC-functions from Android with the external USB reader?
Is there another library for this reader, that supports peer-to-peer communication with other NFC-devices?
Is there another Hardware that I can use, to make this work?
Edit:
The linked question does NOT solve my problem:
It is 3.5 years old. On might think, that in meantime has changed a lot.
The answer to that question (= use the Android ACS library), is part of my own question... So it can't be the answer.

Is it somehow possible, to use the built-in NFC-functions from Android with the external USB reader?
No, that's not possible. If your Android devices did not ship with NFC, there simply is no built-in NFC functionality (not even on the software side). The Android NFC API is essentially an empty stub implementation that does nothing on such a device.
Is there another library for this reader, that supports peer-to-peer communication with other NFC-devices?
The library from ACS does not prevent you from accessing the reader's peer-to-peer capabilities, so I don't see why you would want to use a different library. See section 5.9 of the API specification on how to use the reader's peer-to-peer capabilities.
I need to transfer files from my Android 4.2 tablet to other Android NFC devices
Based on that request I assume that you want to use something like Android Beam to establish some fast out-of-band channel over NFC and then transfer the (large?) files over that out-of-band channel (e.g. WiFi or Bluetooth).
In that case, you would need to re-implement the Android Beam stack (NFC peer-to-peer mode + LLCP + Simple NDEF Exchange Protocol + establishing out-of-band communication channel + transfering file over that channel)

Related

Why Android & IOS11 cannot communicate via NFC

Currently using React Native and attempting to use react-native-nfc-ios and react-native-nfc so I can have cross-device communication between ios and Android. I'm finding that they cannot communicate, however I think it's due to a broader issue (as other existing apps also don't work).
If I download a NFC reader app on iPhone 7, and an NFC writer app on Android they cannot communicate. Why is this?
Instructions to Duplicate
Turn on NFC Reader on iPhone 7
Put some arbitrary data in NFC write mode on Android
Bringing devices together has no effect.
Not understanding the intricacies of NFC, it's hard for me as a casual programmer to understand what the actual problem is.
I understand that IOS11 on iPhone 7 (plus) supports NFC read, and generally speaking there are card emulation, peer to peer, and read write modes.
Should they not communicate? The iPhone is not able to pick up the
Android writer. Why is this?
How does card emulation (I assume to be Apple Pay), differ from a write mode?
The reason is because Apple's iOS 11 update only allows reading from NFC tags (writing is only permitted for Apple Pay). At the moment, their software does not share the same enjoyment afforded by Android phones which enable card emulation, peer-to-peer, and reader/writer NFC usage. So our only hope is to wait for a software update that will finally enable this existing feature for developers to use.

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).

Data transfer betweeen two nfc capable devices without using android beam

I am developing an app with which I transfer a vcard between two nfc capable devices. I am able to do it if both the devices have android beam. I want to know if it is possible to transfer information from an ICS device(Having android beam) to a gingerbread device(which does not have android beam)...Thanks in advance..
Android supports two modes for operating with NFC:
P2P -> Android Beam //
Tag Reader -> "Advanced NFC Framework"
If i'm not wrong, Android Beak is supported in Gingerbread too, so you shoudn't have to face any problem exchanging data between two Android NFC devices with Beam.
The second way, is only for making operations with Tags. Android does not support card emulation officially so this is not an option for you.
Hope this helps you.

Is it possible to use Android Beam between an android device and another NFC device?

I'd like to implement a NFC communication between my Android app and a NFC-enabled kiosk. I've read the documentation and I understand pushing data can be done in 2 ways:
Via foreground NDEF pushing for API level 10 to 13
Via Android Beam from API level 14
I think I can do what I want to via the first solution but I'd like to know if it's possible to use Android Beam between an android device and a non-android device?
Thanks for your help,
Romain
Although the function calls between API 10 to 13 and APi 14 differ, the actual underlying protocol is nearly the same. In both cases, NFC peer-to-peer communication is done using LLCP. In API 10 to 13, the actual data transfer protocol used is NPP. In API 14, SNEP is added to that, but it will fall back to NPP when the other device does not support SNEP.
So when your non-Android device implements SNEP and/or NPP over LLCP, it can transfer data to and receive data from an Android NFC device. Several implementations of SNEP and LLCP for card reader devices exist, see for example https://github.com/grundid/nfctools.
I looked in to this for a college project.
First please not that there are 3 modes of NFC operation { Card read/write, tag emulation and P2P communication }. Android supports Card read/write and P2P communication.
To communicate with a non Android device via P2P is quite complex as you must use the NPP (Ndef Push Protocol) built on LLCP (logical link control protocol). Your non android platform will need to implement the LLCP to be able to communicate. I'm not sure if this has been done for NFC yet. Information on the NPP/LLCP implementation can be found here
The next approach is to use card read/write mode to communicate with the non Android device running in card emulation mode. This way you can send APDU's to the emulated tag to send and receive data. I did this approach in reverse using BlackBerry for my project. BlackBerry supports card emulation so I used the non Android device (ACR122U) to send APDU's to the BlackBerry.
While the first approach (P2P) is obviously the ideal way to go, the second one could be easier to implement. It worked quite well for me in my application anyway, I created a system that accepts payments via NFC.
Please note that the ACR122U doesn't have good support for NFC Tag Emulation so it is not suitable for you. The LibNFC website is a great start to find a device that supports tag emulation.
I am now finished the project and it works great using the ACR122U device. If you need any help on the second approach please ask.
See belows
Issue 28014: Enable real NFC p2p communication and the option to disable the "Touch to Beam" UI
https://code.google.com/p/android/issues/detail?id=28014
Android Peer to Peer dose not work at all.

How to Connect External NFC Card Reader to Tablet

Right now I am having Tablet having OS Android 2.3.3 instead of NFC phone,so I need to connect External card reader to tablet.Please tell me which card reader should I prefer and any driver needed to connect card reader to tablet.
The inbuilt NFC libraries support to that reader or not?
thanks in advance.
I found an answer,the ACS now provides android library and sample application for their readers.You can find library here and some information and video demo of android supported readers is here.
The only problem is that ACS android library supports only Android 3.1 and above.
hope it will help you.
If you still have question feel free to ask..
The built-in NFC library in Android 2.3 and 4.0 only supports the PN544 NFC chip by NXP Semiconductors. I don't think there are any card readers on the market that use it, as this chip is specifically designed for use in mobile devices. You may be able to find alternative implementations of the Android NFC API that support other NFC chips, though.
Another issue may be that your tablet most likely does not have the required NFC libraries installed, including the required system service (NfcManager). After all, your tablet has no NFC support, so it does not need these software components. So a new ROM system image would have to be created for your tablet that includes these software components.
Taking one of the many common desktop readers is probably not really feasible. Creating all the necessary software to integrate it into Android is not really a trivial task. It may be easier to just buy an Android phone with NFC or wait if an Android tablet with NFC comes out.
Neither Froyo 2.3 (min SDK version supporting NFC) or Ice Cream Sandwich 4.0 are compatible with a wide variety of chips.
When a manufacturer launch a new phone with a different NFC chip is because someone have created the drivers to use such chips and interface with Android's NFC classes, specifically the NfcManager class and the NfcAdapter class wich represents the local NFC adapter.
Best case scenario, you could use the Android NDK to create low level C/C++ classes to communicate somehow the External NFC Card reader with Android and then make more custom programming with the NDK to make the NfcAdapter on the SDK to detect it... and there are no warranties that you'll succeed.
And... if you are thinking about going to http://www.alibaba.com and import a tablet with NFC reader, think twice, because that ones might not allow you to do all what the NXP Semiconductors chip does with Android Beam (TM) such as Read/Write and support different I/O operations with NFC-A, B, F, V or ISO-DEP.
For your time's sake (and because time is the most valuable asset for anyone these days). I think your best option is to get a couple of NFC Phones such as the Galaxy Nexus S, DROID Razr, Xperia S, HTC Incredible, etc... those will work right out of the box, that's what we are doing.
Hey sachin,
Since your device doesn't have NFC, it won't have the NFC radio and hence it can not connect (Read or write) to an NFC card. According to the NFC lib, when ever you try to get NFCAdapter it will always return null.
so you atleast need an nfc enabled android device for any experiment.
In my project, we used ACR122 smart card reader that will be connect to a pc not android device.This reader is used to read any nfc tag. An nfc enabled android device will act as a nfc tag in card emulation mode.
Now next part of question "The inbuilt NFC libraries support to that reader or not".
so this card reader can read card value.
With a ACS NFC reader is it possible:
Here can you find the documentation for the libraries and example code. However it doesn't seem to have an option to write data. If you want to write to your NFC reader use the transmit function to send byte arrays.
private static final byte READ = (byte) 0x30;
private static final byte WRITE = (byte) 0xA2;
These bytes are the default read and write bytes for the transmit function. The full documentation of the default NFC protocol can be found here
example:
byte[] response = new byte[300];
int responseLength;
try {
responseLength = mReader.transmit(slotNum, command, command.length, response, response.length);
} catch (ReaderException e) {
e.printStackTrace();
return "executeCommand: error: " + e.getMessage();
}
Slotnum is the number of the reader you want to use. If I'm correct this is always 0 if you are using one reader/usbdevice.
example command:
new byte[] command {(byte) WRITE, 0x04, 0x06, 0x0a, 0x00, 0x21}
THE SECOND BYTE IS THE PAGE ADRES TO WRITE TO. Page 4 - 15 are writable (page 0 and 1 are the id, page 2 are lockbytes and page 3 are OTP. all of them are READ ONLY).
The Read function works the same as the WRITE function only send 3 times a 0x00 in the array for the correct read settings:
new byte[] command {(byte) READ, 0x04, 0x00, 0x00, 0x00}
THE SECOND BYTE IS THE PAGE ADRES TO READ.
Is this video answers to your problem : http://www.youtube.com/watch?v=6Xe7Ux0cTuI
"Low cost , Simple , No driver - EM4100 or Mifare RFID reader for Ipad , Android and Windows"
PS: I doesn't work to this compagny and never try their solution.
This is a good topic. I echo RacZo's concerns about NFC library support in the Alibaba sourced tablets. Since NFC chipsets in devices vary and some have dubious or no support for certain operations, you need to be careful and test out your app on those beforehand.
The ACS reader can be a cost effective solution, and there are some mature and well supported libraries and SDKs that support its integration with Android. The downside of the ACS external reader is battery life. Because it monopolizes the the USB port, and Android tablets won't allow charging through a USB port while a peripheral is connected to it. So if your application is some kind of kiosk or self serve app, this may be a problem.
There is a good post here about your various options when faced with this challenge. Without knowing more about your application it's tough to recommend one way or another.
A little late to answer here, but I've actually tried to implement an external NFC reader as close to native NFC as possible.
It is possible to add an additional service, but the regular NFC initialization (NfcAdapter etc) will not be aware of this service, so it will have to be initialized in addition.
The result was that it is not technically possible to replace or add the built-in NFC service on a stock ROM - in a 'drop-in-replacement-way'.
Reusing some of the native NFC classes like Tag and IsoDep is possible.
However as a developer of an NFC app, you really do not want the same functionality from the external service as the built-in. The external reader probably has more functionality and at a very minimum you want to know whether the reader is plugged in or not.
See External NFC API for additional information (note: it is not a fully open source product).

Categories

Resources