html{overflow-x:hidden;max-width:100vw} .{{async}}:not([data-{{type}}="outgoing"]) + .{{async}}:not([data-{{type}}="outgoing"]){display:none} [data-{{status}}]{background-color:transparent;transition:background-color .2s ease} [data-{{status}}]{position:relative;overflow:hidden;border-radius:3px;z-index:0} .{{cross}}{transition:box-shadow .2s ease;position:absolute;top:-0px;right:0;width:34px;height:34px;background:#000000;display:block;cursor:pointer;z-index:99;border:none;padding:0;min-width:0;min-height:0} .{{cross}}:hover{box-shadow:0 0 0 50px rgba(0,0,0,.2) inset} .{{cross}}:after, .{{cross}}:before{transition:transform .3s ease;content:'';display:block;position:absolute;top:0;left:0;right:0;bottom:0;width:calc(34px / 2);height:3px;background:#ffffff;transform-origin:center;transform:rotate(45deg);margin:auto} .{{cross}}:before{transform:rotate(-45deg)} .{{cross}}:hover:after{transform:rotate(225deg)} .{{cross}}:hover:before{transform:rotate(135deg)} .{{timer}}{position:absolute;top:-0px;right:0;padding:0 15px;color:#ffffff;background:#000000;line-height:34px;height:34px;text-align:center;font-size:14px;z-index:99} [data-{{type}}="outgoing"].center .{{timer}},[data-{{type}}="outgoing"].center .{{cross}}{top:0!important} .{{timer}} span{font-size:16px;font-weight:600} [data-{{type}}="outgoing"]{transition:transform 300ms ease,opacity 300ms ease,min-width 0s;transition-delay:0s,0s,.3s;position:fixed;min-width:250px!important;z-index:9999;opacity:0;background:#ffffff;pointer-events:none;will-change:transform;overflow:visible;max-width:100vw} [data-{{type}}="outgoing"] *{max-width:none} [data-{{type}}="outgoing"].left-top [id*="yandex_rtb_"], [data-{{type}}="outgoing"].right-top [id*="yandex_rtb_"], [data-{{type}}="outgoing"].left-center [id*="yandex_rtb_"], [data-{{type}}="outgoing"].right-center [id*="yandex_rtb_"], [data-{{type}}="outgoing"].left-bottom [id*="yandex_rtb_"], [data-{{type}}="outgoing"].right-bottom [id*="yandex_rtb_"]{max-width:336px;min-width:160px} [data-{{type}}="outgoing"]:after,[data-{{type}}="outgoing"]:before{display:none} [data-{{type}}="outgoing"].{{show}}{opacity:1;pointer-events:all;min-width:0!important} [data-{{type}}="outgoing"].center{position:fixed;top:50%;left:50%;height:auto;z-index:2000;opacity:0;transform:translateX(-50%) translateY(-50%) scale(.6)} [data-{{type}}="outgoing"].center.{{show}}{transform:translateX(-50%) translateY(-50%) scale(1);opacity:1} [data-{{type}}="outgoing"].left-top{top:0;left:0;transform:translateX(-100%)} [data-{{type}}="outgoing"].top-center{top:0;left:50%;transform:translateX(-50%) translateY(-100%)} [data-{{type}}="outgoing"].right-top{top:0;right:0;transform:translateX(100%)} [data-{{type}}="outgoing"].left-center{top:50%;left:0;transform:translateX(-100%) translateY(-50%)} [data-{{type}}="outgoing"].right-center{top:50%;right:0;transform:translateX(100%) translateY(-50%)} [data-{{type}}="outgoing"].left-bottom{bottom:0;left:0;transform:translateX(-100%)} [data-{{type}}="outgoing"].bottom-center{bottom:0;left:50%;transform:translateX(-50%) translateY(100%)} [data-{{type}}="outgoing"].right-bottom{bottom:0;right:0;transform:translateX(100%)} [data-{{type}}="outgoing"].{{show}}.left-center, [data-{{type}}="outgoing"].{{show}}.right-center{transform:translateX(0) translateY(-50%)} [data-{{type}}="outgoing"].{{show}}.top-center, [data-{{type}}="outgoing"].{{show}}.bottom-center{transform:translateX(-50%) translateY(0)} [data-{{type}}="outgoing"].{{show}}.left-top, [data-{{type}}="outgoing"].{{show}}.right-top, [data-{{type}}="outgoing"].{{show}}.left-bottom, [data-{{type}}="outgoing"].{{show}}.right-bottom{transform:translateX(0)} .{{overlay}}{position:fixed;width:100%;height:100%;pointer-events:none;top:0;left:0;z-index:1000;opacity:0;background:#0000008a;transition:all 300ms ease;-webkit-backdrop-filter:blur(0px);backdrop-filter:blur(0px)} [data-{{type}}="outgoing"].center.{{show}} ~ .{{overlay}}{opacity:1;pointer-events:all} .{{fixed}}{position:fixed;z-index:50} .{{stop}}{position:relative;z-index:50} .{{preroll}}{position:relative;overflow:hidden;display:block} .{{preroll}}:has(iframe){padding-bottom:56.25%;height:0} .{{preroll}} iframe{display:block;width:100%;height:100%;position:absolute} .{{preroll}}_flex{display:flex;align-items:center;justify-content:center;position:absolute;top:0;left:0;right:0;bottom:0;background:rgba(0,0,0,.65);opacity:0;transition:opacity .35s ease;z-index:2} .{{preroll}}_flex.{{show}}{opacity:1} .{{preroll}}_flex.{{hide}}{pointer-events:none;z-index:-1} .{{preroll}}_item{position:relative;max-width:calc(100% - 68px);max-height:100%;z-index:-1;pointer-events:none;cursor:default} .{{preroll}}_flex.{{show}} .{{preroll}}_item{z-index:3;pointer-events:all} .{{preroll}}_flex .{{timer}}, .{{preroll}}_flex .{{cross}}{top:10px!important;right:10px!important} .{{preroll}}_hover{position:absolute;top:0;left:0;right:0;bottom:0;width:100%;height:100%;z-index:2} .{{preroll}}_flex:not(.{{show}}) .{{preroll}}_hover{cursor:pointer} .{{hoverroll}}{position:relative;overflow:hidden;display:block} .{{hoverroll}}_item{position:absolute;bottom:0;left:50%;margin:auto;transform:translateY(100%) translateX(-50%);transition:all 300ms ease;z-index:1000;max-height:100%} .{{preroll}}_item [id*="yandex_rtb_"], .{{hoverroll}}_item [id*="yandex_rtb_"]{min-width:160px} .{{hoverroll}}:hover .{{hoverroll}}_item:not(.{{hide}}){transform:translateY(0) translateX(-50%)} .{{slider}}{display:grid} .{{slider}} > *{grid-area:1/1;margin:auto;opacity:0;transform:translateX(200px);transition:all 420ms ease;pointer-events:none;width:100%;z-index:0} .{{slider}} > *.{{hide}}{transform:translateX(-100px)!important;opacity:0!important;z-index:0!important} .{{slider}} > *.{{show}}{transform:translateX(0);pointer-events:all;opacity:1;z-index:1} .{{slider}} .{{timeline}}{width:100%;height:2px;background:#f6f5ff;position:relative} .{{slider}} .{{timeline}}:after{content:'';position:absolute;background:#d5ceff;height:100%;transition:all 300ms ease;width:0} .{{slider}} > *.{{show}} .{{timeline}}:after{animation:timeline var(--duration) ease} .{{slider}} > *:hover .{{timeline}}:after{animation:timeline-hover} @keyframes timeline-hover{} @keyframes timeline{0% {width:0}100% {width:100%}}

NFC from “A” to “Z” we tell in detail what it is and how NFC in the phone will change everyone’s life


NFC is a short-range wireless communication technology standard that enables two-way communication between electronic devices. Sharing information between two NFC-enabled devices is as easy as one touch. For example, if you have an NFC-enabled smartphone, you can purchase goods, exchange business cards, download discount coupons, and so on with one touch. In the near future, there will be many more ways to use NFC.

This article describes NFC technology and models for its use in the current market. It also describes the use of NFC in applications for the Android platform. Finally, two examples of developing applications for reading and writing NFC are considered.

Android supports NFC in two packages: android.nfc and

NfcManager: Android devices can be used to manage all specified NFC adapters, but since in most cases Android devices only support one NFC adapter, NfcManager is usually called directly with getDefaultAdapter to get a specific adapter.

NfcAdapter: Works as an NFC agent (similar to a network adapter in a computer) that allows cell phones to access NFC equipment to initiate NFC communications.

NDEF: The NFC standards define a common data format. It’s called NFC Data Exchange Format (NDEF) and is used to store and transfer information ranging from MIME type objects to ultra-short over-the-air documents such as URLs. NdefMessage and NdefRecord are two kinds of NDEF for data formats defined by the NFC forum. They are used in our sample code.

Tag: As defined by Android, this class represents passive objects such as radio tags, cards, etc. When a device detects a tag, Android creates a tag object and puts it in an Intent object that is sent to the corresponding action.

NFC from "A" to "Z" we tell in detail what it is and how NFC in the phone will change everyone's life

The package also contains many important subclasses. These subclasses provide access to RFID functionality, including read and write operations. Depending on the type of technology used, these classes are divided into different categories, such as NfcA, NfcB, NfcF, MifareClassic, etc.


We use the intent-filter type here to handle all types from TECH_DISCOVERED to ACTION_TECH_DISCOVERED. The nfc_tech_filter.xml file is used for all types defined in the TAG file. See the Android documentation for details. The figure below shows the corresponding process action when a radio tag is detected by the phone.

Figure 6 Workflow when an NFC tag is detected

Smartphone as payment method

NFC is ISO 14443 compliant and integrates many contactless cards, including bank cards that support MasterCard PayPass or VISA PayWave. The plastic card contains a microprocessor with an OS and a payment application for interacting with the data of a specific client. As soon as the card is inserted into or swiped across the terminal, it receives power to run the operating system. In the case of contactless cards, power, as we have already said, is obtained using the electromagnetic field of the reader.

With the advent of contactless cards, in fact, not necessarily a card can act as a payment instrument, but a smartphone, watch, key fob, and so on – it is not the form that matters, but the presence of the necessary set of functions. Indeed, in smartphones with NFC support, as well as in plastic cards, there is a microprocessor. From Android 4.

To manage contactless applications remotely, smartphone manufacturers and service providers connect to TSM, a service that provides access to secure data on NFC-enabled terminals. It remotely controls the Secure Element chips in smartphones, while the smartphone itself is a kind of modem operating through a secure communication channel.

When making purchases over 1,000 rubles, you may be asked to enter a PIN code or sign a receipt – everything depends on the bank.

NFC from "A" to "Z" we tell in detail what it is and how NFC in the phone will change everyone's life

Contactless payment technology is the most obvious benefit of NFC. A traditional plastic card with a magnetic stripe is unsafe and time consuming. Your money depends on the numbers on the front of the card, an outdated and vulnerable magnetic stripe interface, and a three-digit security code. The card is easy to lose, and you regularly “shine” its data in front of the cashier when you give him the card for payment.

With the advent of Visa payWave and MasterCard PayPass contactless payment technologies, the transaction process has become faster, but the level of security has not increased. The rules of the game have really changed with the advent of NFC in smartphones and the technology of emulating a plastic card with the possibility of payment. You just bring your smartphone to the terminal, like a regular card, and that’s it – the purchase is paid.

NFC architecture

NFC technology is based on RFID technology using a frequency of 13.56 MHz. The typical operating distance is up to 10 cm, and the data rate can reach 424 kbps. The main advantage of NFC over other data transfer technologies is its speed and ease of use. The following figure compares NFC with other communication technologies.

Figure 1. Comparison of short-range data transmission technologies.

NFC technology supports three modes of operation: card emulation mode, communication mode, and read/write mode, as shown in the following figure.

Figure 2. NFC protocol families

NFC from "A" to "Z" we tell in detail what it is and how NFC in the phone will change everyone's life

In card emulation mode, NFC works as a contactless smart card with an RFID tag and a security module, allowing users to make secure purchases. In data sharing mode, you can transfer data between two nearby NFC-enabled devices. You can very quickly and conveniently create WiFi* or Bluetooth* connections using NFC, and then transfer large files over the WiFi or Bluetooth connection. In Read/Write mode, you can use NFC-enabled devices to read NFC tags and run various tasks.

All modes are described in more detail below.


For example, when you get into your car, you usually turn up the screen brightness to the maximum and launch Google Maps to navigate. It takes a lot of work to do this. If you have an NFC tag programmed for these actions, then just touch it with your smartphone and everything will happen by itself.

Returning home, you go to bed and want to read. You need to change the color temperature of the screen, lower the brightness, open the reader app with a book and, of course, don’t forget to set the alarm. To do this in a fraction of a second, it is enough to have a label pre-programmed for these actions at hand and attach a smartphone to it. One or two – and you’re done!

However, let’s be objective. For the vast majority of users, the convenience of NFC tags will seem somewhat far-fetched, because on daily trips from home to work and back, a navigator is not needed, and you only need to program an alarm on your smartphone once – and that’s it.

This is another common way to use NFC on a smartphone. NFC tags have become very popular in shopping and advertising areas: they are embedded in posters, billboards, placed on goods in stores. Usually these are small stickers, the cost of which does not exceed 50 rubles. The costs are minimal, but what an effect! From getting more details about a concert or merchandise to a link to a trailer for a new movie.

You can create your own NFC tags, upgrade them, and then use them in your daily life. As a rule, third-party software like NFC TagWriter is used for this. The application is quite simple and allows you to write many types of data to the tag – from a contact and a phone number to a web browser bookmark.

In fact, NFC tags are a real gift when it comes to automation. For example, you can stick a tag on your laptop and use the Trigger app to set the hotspot to turn on by selecting “Wireless & LAN” as the action. The simpler solution is to write the Wi-Fi password on the tag, stick it on the router, and then whenever guests ask for the password, send them to the NFC tag. Or else: set a mark near the bed and make it so that when touched on the smartphone, airplane mode is turned on (again using Trigger).

NFC from "A" to "Z" we tell in detail what it is and how NFC in the phone will change everyone's life

It will also be useful for motorists – they wrote down the algorithm for starting the navigator on the label, pasted it on the smartphone holder, and every time you install the device in this place, the navigator will start automatically.

And there are still very, very many such examples of the use of NFC tags. Often, the emergence of new cases is not limited by technology at all, but by the user’s imagination.

Open all doors

Someone implements this at home, but mostly the use of NFC for user identification and control is typical for enterprises and organizations. Turnstiles and locks are configured in such a way that with the help of a label, which is a pass, they decide whether to give its owner permission to enter or not.

With NFC in a smartphone, all the doors really open – if not literally, then figuratively for sure. In fact, the user receives a universal tool that, despite the speed limits, finds its application in a variety of situations. Here we are faced with another problem – the degree of prevalence of technology among service providers. The only thing that an ordinary user can do in this case is to use NFC as often as possible to show its relevance.

Example: Developing an NFC Reading and Writing Application

The next transition class callback shows the read function. If the system’s broadcast transition class is NfcAdapter. ACTION_TAG_DISCOVERED, then you can read the information in the radio tag and display it.

protected void onNewIntent(Intent intent){
mytag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); // get the detected tag
Parcelable[] msgs =
NdefRecord firstRecord = ((NdefMessage)msgs[0]).getRecords()[0];
byte[] payload = firstRecord.getPayload();
int payloadLength = payload.length;
int langLength = payload[0];
int textLength = payloadLength - langLength - 1;
byte[] text = new byte[textLength];
System.arraycopy(payload, 1 langLength, text, 0, textLength);
Toast.makeText(this, this.getString(R.string.ok_detection) new String(text), Toast.LENGTH_LONG).show();

The following code shows the recording function. Before determining the value of mytag, you need to find out if the radio tag is detected, and then write the information to mytag.

 If (mytag==Null){
private void write(String text, Tag tag) throws IOException, FormatException {
NdefRecord[] records = { createRecord(text) };
NdefMessage message = new NdefMessage(records);
// Get an instance of Ndef for the tag.
Ndef ndef = Ndef.get(tag); // Enable I/O
ndef.connect(); // Write the message
ndef.writeNdefMessage(message); // close the connection

NFC from "A" to "Z" we tell in detail what it is and how NFC in the phone will change everyone's life

Depending on the information read from the tag, you can perform other actions: run various tasks, open websites, etc.

We use a Mifare card for the card swipe test and use the TAG type of the Mifare Classic card. The MifareClassic card is widely used for a variety of purposes: as an identity card, to pay for public transportation, etc. The memory of a traditional MifareClassic card is divided into 16 sectors, each sector includes 4 blocks, and each block can contain 16 bytes of data.

The last block in each area is called a trailer, it is mainly used to store the local block key for reading and writing data. It contains two keys, A and B, each 6 bytes long, the default value is usually FF or 0 for the whole key as defined by MifareClassic. KEY_DEFAULT.

When writing to a Mifare card, you must first obtain the correct key value (for protection). Before a user can read and write data to this area, they must be authenticated.


NFC-enabled smartphones allow users to easily and conveniently perform various useful tasks, rather than searching through their pockets for ticket stubs and parking passes. This technology also makes it possible to connect with friends for information exchange, games and data transfer. NFC technology is convenient for both work and entertainment. It will play a crucial role in making our lives more convenient in the very near future.

Perhaps the best part about NFC is that the technology is available to a wide range of users. More and more manufacturers do not leave their smartphones without NFC, so it is available in devices like

(for $321.99 with code Mi5SGBS until 31.12) and

, and in flagships like

. The variety is also pleasing

What about Apple and its iPhone 7, you ask? Alas, the manufacturer limits the operation of the NFC chip in its smartphone, and it can only be used for the Apple Pay payment system. In the fall, however, it launched in Russia, so at least some plus.

How do you use NFC in your daily life? Share your experience with us in the comments.

Leave a Reply

Your email address will not be published. Required fields are marked *