Reading Mifare card via web app using Android device's NFC - android

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)

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.

API documentation and limitation for NFC tags on Android

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

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 NFC card emulation / use phone as card

I'm searching for a way to send specific commands from my phone to a reader.
I have already read that card emulation is not supported on android due to securtiy reasons, but it is possible via a firmware patch for android 2.3.4 on the Nexus S.
My main question is, do I really need card emulation to send defined APDUs to the reader and to recieve the answer APDUs or is there any other posibility maybe by misusing android Beam?
If I need to use card emulation are there any new insights?
The last posts, few posts I found are nearly one year old...
As adiditional information in the end I will not have any control over the reader.
Thanks for answering and on any new insights on card emulation.
It's possible in Android KitKat 4.4.
Check out this link, more information will be added soon I belive.
http://developer.android.com/guide/topics/connectivity/nfc/hce.html
What you are trying to achieve is somewhat candid. The reason smart cards are being used in NFC is because the NFC protocol is built in such a way that it is not possible to know the correct response in advance. There is always a secret involved, and you can't just guess it. Otherwise there would be a major security flaw in all the systems using contactless smartcards (building access control,
You can't just spy on the protocol, save the exchanges, and replicate them in some software, on most applications this will fail. There will be some random value at some stage, and some crypto computation to perform.
In order to emulate a card with the phone, you need a secure element (smartcard chip on the phone or the SIM card in your phone), and you need the NFC chip in your phone to route card emulation APDUs to this secure element (this is probably what the patch you are referring to is doing).
There are ways to do card emulation in an Android application, but I suspect this will require substantial patching, and you will not have predictible response time, so your reader might not like it. Also this will prevent card emulation from working when your phone is off (battery delpleted for instance).

NFC payment demo with Samsung Nexus

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.

Categories

Resources