I'm new at NFC and I'm trying to look up documentation what is possible and what is not but I have a hard time finding the right ressources.
I'm therefore looking for guidance pointing towards the right ressources.
The problem I have is a lot of the ressources I find require a third party app. E.g. Trigger. With Trigger you could implement more complex logic (e.g. check time, if time falls within a certain range, start google maps pointing to work address, always start Spotify) but it'd only work if you have Trigger installed.
I however am looking for a NFC project that works without requiring installing an extra app. Things that work on any Android device with latest OS are for example:
toggling Bluetooth
connect to WLAN with SSID and password
open an URL
...
I've seen it's possible to write an NFC tag to pair with a Bluetooth device. However when using a different phone, that does not have the NFC writer app installed, will the NFC tag still work? Example
My NFC tags are still shipping so I can't test. Also I prefer reading documentation and implementing according to docs over trial and error.
Newer Bluetooth speakers have NFC. I'm unsure if you can turn NFC-dumb devices into NFC-smart devices. (The NFC-smart devices may be telling the bluetooth speaker to go into pairing mode which is something you cannot do when you create a NFC tag.)
I've been trying to look up documentation what's supported by default but I have a hard time finding these ressources.
For now I want to focus my attention to Android only since I do not own Apple devices. I am aware what may work on Android may not work on Apple.
I'm looking for the API method calls documentation for Android that shows above mentioned bullets points being possible.
What is possible? What are the limitations?
The API for NFC is well documented. You will find that on the android developer site (Android developer documentation).
However, what is supposed to happen once you read a NFC tag is a different story. Your examples have nothing to do with NFC, even so they appear possible. This is what you have to cover with your app.
You are not after the API documentation on Android which is well documented at the low level but poorly documented as a System.
What you are after is the NFC Forum specification and what level of support that your particular version of Android natively supports these specification.
Unfortunately the NFC Forum specification are mostly a paid for resource can cover things like how to write an NDEF message for Bluetooth pairing, Wifi setup, etc.
Though some of these specification can be found hidden on the internet or you can pay to become an NFC Forum member.
You can get an idea of what Android OS natively supports by looking at the source code of the System App that handles this.
(mostly in ) https://android.googlesource.com/platform/packages/apps/Nfc/+/refs/heads/master/src/com/android/nfc/NfcDispatcher.java
But additional support for other message types can be added by any other App include apps installed by OEM vendors like Samsung, etc
I want to find out if this is possible, to have a web app read off information from a Mifare card, by tapping the card against a NFC-enabled Android device.
I have been searching this for quite some time, and it seems like as of now it's only limited to experimental implementation - https://whatwebcando.today/nfc.html
Or am I truly better off with a native Android app?
Edit:
Thanks to all who replied. We have been trying out the Web NFC API as specified here https://w3c.github.io/web-nfc/, turned on the experimental features of Chrome on the Android device, but it always return a null value when we tap the Mifare card on the device. Are we missing out any steps, or is it really a technical limitation of the API at this moment, since it's still not considered as a stable specification?
I think on mid-term even WebNFC will be restricted to (reading & writing) NDEF messages, similar to what Apple is currently doing on iOS.
So if you want to read info like UID or raw data out of a MIFARE card, you need to write a native app. Be aware that MIFARE (Classic) is not supported by all phones, even when they have NFC.
If you want to use a framework like ionic or Cordova, you can also use the NDEF plugin (https://github.com/chariotsolutions/phonegap-nfc)
I´ve been reading a lot about NFC, card emulation and etc.... I found two very helpful posts about this issue:
Android and Symbian NFC mobile development questions and answers (FAQ)
http://forum.xda-developers.com/showthread.php?t=1281946
Reading them I realized that it is quite complicated to write an application to make a payment.
Since I just want to see "something" working I'd like to ask the more experienced people if using the patch provided at xda-developers forum (second link above) would be enough just to write an appication that would open some door ou register/authorize someone´s entrance at an event (provided that I have a NFC device to properly interact with my phone, of course).
Thank you all
Payment is mostly impossible since you don't have the keys for the JavaCard card manager, better forget about it. Additionally, to write a Visa, etc compatible payment applet, you
need access to their specs, which means signing NDAs, paying money, etc.
Apparently the Mifare chip has stock keys, so you can modify it. So if you have a reader, and a device (door, etc.) that uses Mifare cards, you might be able to get it work. The thread also mentions that you might be able to clone your transport card. But:
you need to build your own firmware and flash it on a rooted phone
you may need to port the patches to whatever is the current GB version (2.3.7) or use exactly the same (old) tag
You need to do a lot more reading :)
In my opinion, you shouldn't bother with trying the patches on XDA Developers, especially if you are considering using Android 4.0 ICS. Android 4.0 already has built-in functionality on the Nexus S and Galaxy Nexus phones to enable card emulation. Drawback: you need a rooted phone to make it all work (see e.g. How to obtain NFCEE_ADMIN permission on rooted phone? for an example of someone succeeding).
A perhaps simpler approach is using NFC peer-to-peer communication ("Android Beam") with an external reader. This can work with any Android NFC device using a simple app to push the necessary data to the reader. Provided the reader support peer-to-peer communication, this is far the easiest solution. It would require some development work on the reader side, though, see http://code.google.com/p/ismb-npp-java/wiki/NppFromPhoneToACR122 for an example of this approach.
I'm working on a NFC application which would be using NFC-V tags with ISO 15693 specification. Unfortunately, I do not have a NFC enabled phone at the moment. I wanted to know if I can simulate the behavior of the NFC-V tags in some way.
I know the Android developer website has a NFC Demo, which has a class called FakeTagsActivity. But, that uses NDEF messages. This will not be compatible with NFC-V and I'm not sure how to "create" a Tag object so that it can be simulated.
In my experience, the only reasonable way to develop and test your app would be to use a real NFC-enabled device. Sending and receiving data using NfcV.transceive() is not extremely easy and it is simply to easy to make mistakes. So simulating an NfcV tag is probably much more work than it is worth, IMO.
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).