I have the source code an NFC reader for Android which supports a few different NFC cards. And I happen to have a NFC card which isn't supported by it.
What do I need to know to add support for it? Should I get the information of the format or something of that card from the manufacturer of the card on their website?
Or is there any more general, universal way which doesn't require contacting me the manufacturer or going to their website?
In general, your application should declare a subset of technologies, which are supported by NFC tag, you want to read. Android dispatches NFC tags in this order (read this to learn more):
ACTION_NDEF_DISCOVERED
ACTION_TECH_DISCOVERED
ACTION_TAG_DISCOVERED
You can register your application for ACTION_TECH_DISCOVERED and declare every technology in separated resource (you can learn more about technologies here). Your app should declare a subset of technologies returned by NFC tag when calling getTechList.
After all, follow specified technology to read its data.
Related
Apparently if you have a rooted phone, you can make use of com.android.nfc_extras to gain access to features such as card emulation ( Secure element Access Control on ICS 4.0.4 ).
I know that this is an unofficial API, but is there any documentation for it (official or unofficial)? Or on the other hand, is card emulation far more complicated than I've realised?
Keep in mind that accessing the secure element and doing card emulation are actually two different things. The secure element is essentially closed; you cannot modify it. Using com.android.nfc_extras you can turn card emulation through the secure element on or off. That's it.
You can send APDUs to the secure element from your app, like communicating with an IsoDep tag (in the lower level part of the NFC stack both use the same code path). See for example http://nelenkov.blogspot.nl/2012/08/accessing-embedded-secure-element-in.html for a good explanation how to do it.
There is no documentation. If you want to dig into this API I suggest that you look directly at the source-code. It is not much, just two files that implement and define the API. You can get a copy for example here:
http://source-android.frandroid.com/frameworks/base/nfc-extras/java/com/android/nfc_extras/
In the API you will find concepts like ExecutionEnvironment, Routes etc. Don't let these concepts confuse you. In the end all you can do with the NfcExtras interface is to:
Turn on card emulation by setting a route created with the ROUTE_ON_WHEN_SCREEN_ON.
Turn off card emulation by setting the 'off' route.
Exchange data with the embedded secure element.
That's it! All the rest is just API sugar to make things look bigger than it really is.
Some additional caveats:
If you want to call the functions you need your application to be white-listed in the nfcee_access.xml file locates in /etc. If you don't white-list yourself you'll get an access violation exception.
There is no way for you to distinguish between the embedded secure element or the NFC capable UICC present in the phone.
There is no way to talk to the NFC capable UICC in the phone. You can only talk to the embedded secure element (aka the SmartMX chip for phones with NXP chipset). Communication to the UICC itself is only possible through the RID interface via the ISO7816 interface, and this is - if possible at all - proprietary.
Last but not least: There is no guarantee that the NfcExtras interface does anything at all. The interface is used by Google Wallet, but the mobile payment market is segmented and everyone cooks his own soup.
I know about at least one big mobile payment provider that completely ignores the NfcExtras interface, disabled it and uses his own, hidden mechanism to turn things on and off.
I have been looking into nfc on the android platform, I have a few RFID tags laying around but they dont want to interact with the nexus s. i believe that the tags arent supported by the andriod nfc module (I can for example read my old card of college, which is mifare classic). for reference I have linked to a webstore selling these things.
Is it possible to use these tags with android? Will it be a lot of coding/hacks?
here is a link to the rfid tags:
http://www.parallax.com/StoreSearchResults/tabid/768/txtSearch/tag/List/0/SortField/4/ProductID/693/Default.aspx
any guidance is appreciated
The tags you link to operate on 125kHz. NFC operates on 13.56MHz, so it is incompatible with your tags. There is now way a software hack can overcome this.
I am a newbie developer but trying to develop an android app. I want to some functions of my app are run by NFC tag. But I'm a poor newbie, so I cannot solve questions below;
I tried NFC demo in android SDK with my nexus S, but that is just for NDEF data.
I think I should use foregrounddispatch() function..
NXP tag read/writer also don't have a function which enable write programming into tags. it is just for writing URL and text.
When searching empty tag providers I saw few providers are selling additional tag read/writer like normal RFID developer kit. Should I use that kind hardware to write my code to a empty tag?
Thank you very much!
Should I use 'hardware' to write NFC data to a empty tag?
You do not have a choice. You need hardware that writes to NFC tags if you want to write to NFC tags. That hardware could be an NFC-capable Android device, or possibly some other sort of reader/software combination.
There is NXP tag read/writer app in android market but the app is for NDEF data, not for code.
You do not put code on an NFC tag. You put data on an NFC tag.
To put custom data on a tag via Android, you need to write your own app.
I'm thinking of starting a project for a local University where we would use NFC to read tags along all the campus with specific information. For example: if a user owns a NFC enabled phone, he could use it to grab additional information when walking through important parts of the library, or auditorium, etc. So he could get contact numbers, attention schedules, and even we would like to show him some 3D models using AR when reading the correct information tag.
Which technologies would be required to create a program for doing this? Android would be our first option since the Google Nexus S is the only cellphone that has NFC. But also what about the tags? Are there any places where I could buy them, and then how could we load information inside the tag?
Also for the Augmented reality in iPhone there are libraries like ARToolkit, so here again guess we would need to use the Android NDK to use it. However if there are any libraries for AR written in Java that would be better.
Anyway if I'm missing some point or ignoring an important technology I should consider when planning the project, would be great to hear about it.
Thanks a lot.
NFC technology is an application of RFID so provided the phone could be set to reader mode then all you'd need is passive RFID tags placed at various points. You could easily use Phidgets for the RFID tags.
http://www.phidgets.com/products.php?category=14
As for AR toolkits there are several ones used for Android. Some using NDK and others in Java.
http://www.arvertising.com/news/2009/11/nyartoolkit-for-android-en/
http://developer.qualcomm.com/dev/augmented-reality
http://www.slashgear.com/qualcomm-augmented-reality-sdk-for-android-released-04105775/
The NXP TagWriter application makes it possible to write NFC tags with one's Android phone. The standard tag reader application makes it possible to read NFC tags and launch URLs stored on them. If you want to roll your own app, the android.nfc package has the various bits you need for reading tags.
There is already a StackOverflow question for where to buy NFC tags, although there aren't very many answers there. A Google search for "create NFC tag" or "buy NFC tag" will give a handful of sources.
I don't know is this the right place to ask. Because I need to know the concept about NFC. From the Android 2.3 Platform reference. And i googled it. But i didn't get the correct concept. Can anyone please provide me good links and tutorials for that. And how to implement it in android.
NFC = Near Field Communication
By using NFC tags you are able to scan these tags and retrieve information from the tag. This enables you to enhance physical objects with digital data. F.ex. posters can have a NFC tag and when you scan this tag with your NFC enabled mobile phone you can get some relevant information from the poster
There is a longer and better explanation on http://en.wikipedia.org/wiki/Near_field_communication and there are also examples of use..
Additionally the Android SDK contains a NFC demo project.. take a look at it to see how it is implemented
You can imagine it as bluetooth with a very close field.
NFC is a radio communications technology which works on an effective range of 4 cm. It is used to exchange small amounts or data (or settings up longer session) between devices in the implicit context of close proximity (and thus trusted parties). Passive tags can also be used.
After investigating NFC for about one month, my current impression is that NFC should be supported by most mobile applications, if only to share data with other devices. For example, a mobile web browser would share the link of the currently viewed page if an NFC session is initiated.
I have created an NFC Eclipse plugin if you would like to get started with some passive tags experimentation, it comes with a corresponding (free) Android app which does the actual NFC interfacing. I also recommend reading this guide from Android.
Edit: Plugin now also supports some card readers :-)