Blog
NFC interception approach
- Details
- Published: Wednesday, 22 January 2014 13:32
Near Field communication is still an emerging technology, but already it has been widely integrated all around us. Contact-less payments, smart posters and in case of smartphones redirecting browser to a web service or to the specific application. Trusted Tiny Things project is implementing this NFC technology and uses it as a main entry point to our system.
In context of one of our project case scenarios we had to find a way of "borrowing" tag's content by intercepting the NFC signal and retrieving its data, before it can could be passed forward to the smartphone's web browser, so that we could check if the tag is recognised by our system to display additional information for the user.
Android 2.3+ API allows developers read NDEF messages from the NFC tags. We made a use of the android.nfc package to facilitate implementation of NFC technology. We have managed to intercept NFC signal by adding a intent filter for NDEF action specific schema to the AndroidManifest.xml configuration file for the activity, which is directly responsible for manipulation and analysis of the NFC data.
<activity android:name="uk.ac.abdn.t3.trustedtinythings.NFCActivity" android:label="@string/app_name" > <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED" /> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="http" /> </intent-filter> </activity> </application>
This allowed our application to get priority above the integrated web browser and any other NFC reader application. Momentarily, this interception works under assumption that NFC tag contains an URL pointing to the web service.