- Open Access
- Total Downloads : 19
- Authors : Neha Maruti Nayak, Prithvi Raju Kunder, Bhagyesh Prashant Kurlekar, Raj Jitendra Dedania
- Paper ID : IJERTCONV5IS01091
- Volume & Issue : ICIATE – 2017 (Volume 5 – Issue 01)
- Published (First Online): 24-04-2018
- ISSN (Online) : 2278-0181
- Publisher Name : IJERT
- License: This work is licensed under a Creative Commons Attribution 4.0 International License
NFC -The Contactless Connection
Neha Maruti Nayak
Atharva College of Engineering, University of Mumbai.,India
Prithvi Raju Kunder
Atharva College of Engineering, University of Mumbai.,India
Bhagyesh Prashant Kurlekar Atharva College of Engineering, University of Mumbai.,India
Raj Jitendra Dedania
Atharva College of Engineering, University of Mumbai.,India
Abstract NFC- Near field communication is a proximate range technology which has been proliferating in the recent times. It is based on the principle of RFID i.e. Radio Frequency Identification which makes use of short range radio waves and magnetic induction to establish immediate contact between an electronic device and NFC tags[1]. In our paper we are going to design a program such that a person's records can be accessed in merely a fraction of second by using the link in his NFC-tag. This link will lead to a secure online platform which has the records stored and updated daily. This concept will benefit people to a great extent as it means reducing the unending and frustrating pile of paperwork and filing. NFC opens some new and exciting possibilities in this technology oriented world.
Keywords NFC,RFID, NFC-tags, person's records, secure online platform.
I. INTRODUCTION
NFC stands for Near Field Communication. It is a short- range radio technology that enables communication between devices that either touch or are momentarily held close together[2]. NFC is an open-platform technology, which is being standardized in the NFC Forum. NFC is based on and extends on RFID. It operates on 13.56 MHz frequency. NFC communication range is up to 10 cm. NFC standard supports different data transmission rates such as 106kbps, 212 kbps, and 424 kbps.
Tag and reader .NFC-based communication between two devices is possible when one device acts as a reader/writer and the other as a tag.
II CONSTRUCTION OF MODEL AND PLOTING OF THE PROGRAM
Connecting NFC and making directory as required into SD Card
First of all we need the app permission to perform the NFC transfer we require. That can be written as:
<uses-permission android:name="android.permission.NFC"
/>
<uses-feature android:name="android.hardware.nfc" android:required="true" />
After that
The MainActivity should only consist of the onCreate() method. You can interact with the hardware via the NfcAdapter class. It is important to find out whether the NfcAdapter is null. In this case, the Android device does not support NFC.
package net.vrallev.android.nfc.demo;
import android.app.Activity; import android.nfc.NfcAdapter; import android.os.Bundle;
import android.widget.TextView; import android.widget.Toast;
/**
-
Activity for reading data from an NDEF Tag.
*
-
@author Ralf Wondratschek
*
*/
public class MainActivity extends Activity { public static final String TAG = "NfcDemo"; private TextView mTextView;
private NfcAdapter mNfcAdapter;
@Override
protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main);
mTextView = (TextView) findViewById(R.id.textView_explanation);
mNfcAdapter = NfcAdapter.getDefaultAdapter(this); if (mNfcAdapter == null) {
// Stop here, we definitely need NFC Toast.makeText(this, "This device doesn't support
NFC.", Toast.LENGTH_LONG).show();
finish(); return;
}
if (!mNfcAdapter.isEnabled()) { mTextView.setText("NFC is disabled.");
} else { mTextView.setText(R.string.explanation);
}
handleIntent(getIntent()); }
} }
}
private void handleIntent(Intent intent) {
// TODO: handle Intent
}
}
Reading Data From an NDEF Tag
The last step is to read the data from the tag. The explanations are inserted at the appropriate places in the code once again. The NdefReaderTask is a private inner class. package net.vrallev.android.nfc.demo;
import java.io.UnsupportedEncodingException; import java.util.Arrays;
import android.app.Activity; import android.app.PendingIntent; import android.content.Intent; import android.content.IntentFilter; import
android.content.IntentFilter.MalformedMimeTypeException; import android.nfc.NdefMessage;
import android.nfc.NdefRecord; import android.nfc.NfcAdapter; import android.nfc.Tag;
import android.nfc.tech.Ndef; import android.os.AsyncTask; import android.os.Bundle; import android.util.Log;
import android.widget.TextView; import android.widget.Toast;
/*
* … other code parts
*/
private void handleIntent(Intent intent) { String action = intent.getAction();
if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action
)) {
String type = intent.getType();
if (MIME_TEXT_PLAIN.equals(type)) {
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
new NdefReaderTask().execute(tag);
} else {
Log.d(TAG, "Wrong mime type: " + type);
}
} else
if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(action
)) {
// In case we would still use the Tech Discovered
Intent
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
String[] techList = tag.getTechList();
String searchedTech = Ndef.class.getName(); for (String tech : techList) {
if (searchedTech.equals(tech)) {
new NdefReaderTask().execute(tag); break;
}
/**
-
Background task for reading the data. Do not block the UI thread while reading.
*
-
@author Ralf Wondratschek
*
*/
private class NdefReaderTask extends AsyncTask<Tag, Void, String> {
@Override
protected String doInBackground(Tag… params) { Tag tag = params[0];
Ndef ndef = Ndef.get(tag); if (ndef == null) {
// NDEF is not supported by this Tag. return null;
}
NdefMessage ndefMessage = ndef.getCachedNdefMessage();
NdefRecord[] records = ndefMessage.getRecords(); for (NdefRecord ndefRecord : records) {
if (ndefRecord.getTnf() == NdefRecord.TNF_WELL_KNOWN && Arrays.equals(ndefRecord.getType(), NdefRecord.RTD_TEXT)) {
try {
return readText(ndefRecord);
} catch (UnsupportedEncodingException e) { Log.e(TAG, "Unsupported Encoding", e);
}
}
}
return null;
}
private String readText(NdefRecord record) throws UnsupportedEncodingException {
/*
-
See NFC forum specification for "Text Record Type Definition" at 3.2.1
*
-
http://www.nfc-forum.org/specs/
*
-
bit_7 defines encoding
-
bit_6 reserved for future use, must be 0
-
bit_5..0 length of IANA language code
*/
byte[] payload = record.getPayload();
// Get the Text Encoding
String textEncoding = ((payload[0] & 128) == 0) ? "UTF-8" : "UTF-16";
// Get the Language Code
int languageCodeLength = payload[0] & 0063;
// String languageCode = new String(payload, 1, languageCodeLength, "US-ASCII");
// e.g. "en"
// Get the Text
return new String(payload, languageCodeLength + 1, payload.length – languageCodeLength – 1, textEncoding);
}
@Override
protected void onPostExecute(String result) {
if (result != null) { mTextView.setText("Read content: " + result);
}
}
}
The app ow successfully reads the content.
Now ater the app can read from the NFC tag.
We need to divide the data as per different use cases.
For eg: if we want the airport ticket data and movie ticket data, all the data should be into different directory so it will be easy to control the data flow through the app.
That can be done by:
// create a File object for the parent directory
File wallpaperDirectory = new File("/sdcard/Wallpaper/");
// have the object build the directory structure, if needed. wallpaperDirectory.mkdirs();
// create a File object for the output file
File outputFile = new File(wallpaperDirectory, filename);
// now attach the OutputStream to the file object, instead of a String representation
FileOutputStream fos = new FileOutputStream(outputFile);
But this will also need app permission and that can be done as,
AndroidManifest.xml //File name in Android Studio
<uses-permission android:name="android.permission.WRITE_EXTERNAL
_STORAGE" />
Other easy way of building a directory is
//Create Folder File folder = new
File(Environment.getExternalStorageDirectory().toString(
)+"/Aqeel/Images"); folder.mkdirs();
//Save the path as a string value
String extStorageDirectory = folder.toString();
//Create New file and name it Image2.PNG
File file = new File(extStorageDirectory, "Image2.PNG");
-
DISCUSSION
Developing country with a huge population are in dire need for a technology which is cheap, fast, easily operated, convenient and secure to assist in its long-term development. NFC is a technology which will greatly aid developing country in becoming one of the world's leading countries.
NFCs will enable the government to keep a track of a person's entire life history – medical, financial, criminal etc. Till now, the government has been trying, in vain, to create a uniform method of maintaining all records. Filing and paperwork on such a large scale was tedious, redundant and inaccurate. Realizing the drawbacks, the government
introduced Aadhar Cards. But due to the presence of PAN Cards, Passports and Ration Cards, there is no fixed system to maintain the records of a person. The data is distributed all over the place. This creates a lot of confusion and corrupt people are able to take advantage of this by creating multiple PAN Cards by which they do not have to pay Income tax. Introduction of NFCs will prove to be beneficial under such circumstances as all the activities will be monitored by officials.
This also initiated the concept of a Digitalization where people need to be able to make transactions easily without having to carry money & credit/debit cards. Also it is very difficult for an average working person to keep a track of all his bank accounts, credit/debit card statutes, the bills that are due and so on. It will simplify life to a much greater extent if everything was found on a single platform. This way the person won't have to remember the pins & passwords for his cards and all his dues. Just with the help of the tag he will get an idea of every tiny detail.
Hospitals will also benefit from NFCs. Patients won't have to maintain files for their previous health issues. A single scan will provide the doctor with all their medical history of the patient. In this manner it won't matter even if different doctors attend to a patient. Also, all the medications for the treatment are also constantly updated. This will help nurses to give proper medicines to the patient. Doctors won't have to go through files every single time they visit the patient.
The details of a person's vehicle will also be listed. This enables us to record the servicing details, license details and everything else related to it. It won't be necessary to remember the servicing dates and or the license renewal dates. Even when traffic rules are broken, it will be easier to issue e-challans. With just a scan, the vehicle details and it's offence will be updated and an e-challan will be generated. The penalty amount will be charged accordingly. Even this can be paid online.
NFC will also store all the bank details for a person. For example, the different accounts in the different banks, the types of each account, their account numbers, all the transactions, all the interest schemes, the loans, their due dates etc. The person won't have to keep cheque books or pass books. We won't have to stand in lines to update passbooks or keep going to the bank every other day to check if our interest is due. Also not every person, old or illiterate is able to keep a track of their money. This will be a huge help for them.
-
CONCLUSION
NFC, inspite of being so advantageous, is also cost effective and user friendly. It is such a technology that can reach all the masses in this era of mobile phones. A rough idea of how it works is that on scanning the NFC tag, we are connected by a link to an online platform with the help of radio waves and magnetic induction. This platform is sectioned in such a way that only the necessary information will be displayed i.e. if a person wants to access our transaction details, only the bank section can be accessed by him. This is a government controlled platform. All the entries will be cross checked and verified. We can be sure that all the data is authentic and is safe & secure. NFC is an invention which is going to benefit
the people to an unimaginable extent. From the old and young to the literate or illiterate no one will face any problem. People won't have to waste time on unnecessary things and also won't need to seek help to get their tasks done. We can also help the environment and save loads of paper. All the employees won't have to work so hard for filing and recording all the details. NFC- near field communication has many more uses other than the few that are mentioned above. It is a huge asset for us. It is something that is here to make our lives much more simpler with just a scan.
-
REFERENCE
-
Manzerolle, Vincent R., "Brave New Wireless World: Mapping the Rise of Ubiquitous Connectivity from Myth to Market" (2013). Electronic Thesis and Dissertation Repository. Paper 1212.
-
Ya'acob, Norsuzila, et al. "RFID (NFC) application employment on inventory tracking to improve security." 2014 IEEE Symposium on Wireless Technology and Applications (ISWTA). IEEE, 2014.
-
Richmond, Raymond, and Iain A. Pretty. "The Use of RadioFrequency Identification Tags for Labeling Dentures Scanning Properties." Journal of forensic sciences 54.3 (2009): 664-668.