---
description: Capacitor plugin for NFC tag reading, writing, and emulation. Supports Android, iOS, and Web with advanced features like HCE and raw command handling.
title: Capacitor NFC Plugin for Android, iOS & Web - Capawesome
image: https://capawesome.io/docs/assets/images/social/plugins/nfc.png
---

[ Skip to content](#capawesome-teamcapacitor-nfc) 

[ 🎉 Introducing **Capawesome Platform** — one platform for Live Updates, Native Builds, App Store Publishing, and Insider SDKs.](https://capawesome.io) 

* [  Formbricks ](/docs/plugins/formbricks/)
* [  Geocoder ](/docs/plugins/geocoder/)
* [  Google Sign-In ](/docs/plugins/google-sign-in/)
* [  libSQL ](/docs/plugins/libsql/)
* [  Live Update ](/docs/plugins/live-update/)
* [  Managed Configurations ](/docs/plugins/managed-configurations/)
* [  Media Session ](/docs/plugins/media-session/)
* [  ML Kit ](/docs/plugins/mlkit/)
* NFC [  NFC ](/docs/plugins/nfc/)
* [  iOS ](#ios)
* [  Configuration ](#configuration)
* [  Usage ](#usage)
* [  API ](#api)
* [  Type Aliases ](#type-aliases)
* [  Enums ](#enums)
* [  Utils ](#utils)
* [  Troubleshooting ](#troubleshooting)
* [  Changelog ](#changelog)
* [  Breaking Changes ](#breaking-changes)
* [  License ](#license)
* [  OAuth ](/docs/plugins/oauth/)
* [  Pedometer ](/docs/plugins/pedometer/)
* [  Photo Editor ](/docs/plugins/photo-editor/)
* [  PostHog ](/docs/plugins/posthog/)
* [  Printer ](/docs/plugins/printer/)
* [  Purchases ](/docs/plugins/purchases/)
* [  RealtimeKit ](/docs/plugins/realtimekit/)
* [  Screen Orientation ](/docs/plugins/screen-orientation/)
* [  Screenshot ](/docs/plugins/screenshot/)
* [  Secure Preferences ](/docs/plugins/secure-preferences/)
* [  Speech Recognition ](/docs/plugins/speech-recognition/)
* [  Speech Synthesis ](/docs/plugins/speech-synthesis/)
* [  Share Target ](/docs/plugins/share-target/)
* [  Square Mobile Payments ](/docs/plugins/square-mobile-payments/)
* [  SQLite ](/docs/plugins/sqlite/)
* [  Superwall ](/docs/plugins/superwall/)
* [  Torch ](/docs/plugins/torch/)
* [  Wifi ](/docs/plugins/wifi/)
* [  Zip ](/docs/plugins/zip/)
* [  Cloud ](/docs/cloud/)
* [  Live Updates ](/docs/cloud/live-updates/)
* Advanced
* Integrations
* [  Native Builds ](/docs/cloud/native-builds/)
* [  Configuration ](/docs/cloud/native-builds/configuration/)
* [  Environments ](/docs/cloud/native-builds/environments/)
* Guides
* [  Sample Projects ](/docs/cloud/native-builds/sample-projects/)
* [  Troubleshooting ](/docs/cloud/native-builds/troubleshooting/)
* [  Automations ](/docs/cloud/automations/)
* [  Assist ](/docs/cloud/assist/)
* Account
* Organizations
* [  Organization and User Management ](/docs/cloud/organizations/memberships/)
* [  Single Sign-On (SSO) ](/docs/cloud/organizations/sso/)
* [  Teams ](/docs/cloud/organizations/teams/)
* [  Two-Factor Authentication ](/docs/cloud/organizations/two-factor-authentication/)
* [  Integrations ](/docs/cloud/integrations/)
* [  License Keys ](/docs/cloud/license-keys/)
* [  Webhooks ](/docs/cloud/webhooks/)
* [  Pricing ](https://capawesome.io/pricing/)
* [  FAQ ](/docs/cloud/faq/)
* [  Support ](/docs/cloud/support/)
* [  Contributing ](/docs/contributing/)
* [  LLMs ](/docs/llms/)
* [  Insiders ](/docs/insiders/)
* [  License ](https://capawesome.io/legal/eula/)
* [  Support ](/docs/insiders/support/)
* [  FAQ ](/docs/insiders/faq/)
* [  Blog ](/blog/)
* Categories

* [  iOS ](#ios)
* [  Configuration ](#configuration)
* [  Usage ](#usage)
* [  API ](#api)
* [  Type Aliases ](#type-aliases)
* [  Enums ](#enums)
* [  Utils ](#utils)
* [  Troubleshooting ](#troubleshooting)
* [  Changelog ](#changelog)
* [  Breaking Changes ](#breaking-changes)
* [  License ](#license)

# @capawesome-team/capacitor-nfc[¶](#capawesome-teamcapacitor-nfc "Permanent link")

Capacitor plugin for NFC tag reading, writing, and emulation. Supports Android, iOS, and Web with advanced features like HCE and raw command handling.

[ ![Deliver Live Updates to your Capacitor app with Capawesome Cloud](../../assets/external/cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.69628c3f.png) ](https://cloud.capawesome.io/) 

## Features[¶](#features "Permanent link")

We are proud to offer one of the most complete and feature-rich Capacitor plugins for NFC. Here are some of the key features:

* 🖥️ **Cross-platform**: Supports Android, iOS and Web.
* 🔄 **NDEF**: Read and write NFC Data Exchange Format (NDEF) messages.
* 📳 **HCE**: Emulate an NFC card that other devices can interact with.
* ⌘ **Raw Commands**: Send raw commands to an NFC tag and receive the response.
* 🛠️ **Utils**: Utility functions to make your life easier.
* ⚔️ **Battle-Tested**: Used in more than 500 projects.
* 📚 **Documentation**: Comprehensive documentation to help you get started.
* 📦 **CocoaPods & SPM**: Supports CocoaPods and Swift Package Manager for iOS.
* 🔁 **Up-to-date**: Always supports the latest Capacitor version.
* ⭐️ **Support**: Priority support from the Capawesome Team.
* ✨ **Handcrafted**: Built from the ground up with care and expertise, not forked or AI-generated.

Missing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!

## Newsletter[¶](#newsletter "Permanent link")

Stay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).

## Compatibility[¶](#compatibility "Permanent link")

| Plugin Version | Capacitor Version | Status         |
| -------------- | ----------------- | -------------- |
| 8.x.x          | \>=8.x.x          | Active support |
| 7.x.x          | 7.x.x             | Deprecated     |
| 6.x.x          | 6.x.x             | Deprecated     |

## Demo[¶](#demo "Permanent link")

A working example can be found [here](https://github.com/capawesome-team/capacitor-nfc-demo).

| Android                                                                                                                              | iOS                                                                                                                              |
| ------------------------------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------------------------------------------------- |
| ![Android Demo](../../assets/external/user-images.githubusercontent.com/13857929/184409092-7fdc3a77-67b1-4155-b1b1-0fd34a92a77b.gif) | ![iOS Demo](../../assets/external/user-images.githubusercontent.com/13857929/184409000-a81243a3-93e5-4d51-817a-e006c0a385cf.gif) |

## Guides[¶](#guides "Permanent link")

* [Announcing the Capacitor NFC Plugin](https://capawesome.io/blog/announcing-the-capacitor-nfc-plugin/)
* [Exploring the Capacitor NFC API](https://capawesome.io/blog/exploring-the-capacitor-nfc-api/)

## Installation[¶](#installation "Permanent link")

This plugin is only available to [Capawesome Insiders](https://capawesome.io/insiders/). First, make sure you have the Capawesome npm registry set up. You can do this by running the following commands:

`[](#%5F%5Fcodelineno-0-1)npm config set @capawesome-team:registry https://npm.registry.capawesome.io
[](#%5F%5Fcodelineno-0-2)npm config set //npm.registry.capawesome.io/:_authToken <YOUR_LICENSE_KEY>
`

**Attention**: Replace `<YOUR_LICENSE_KEY>` with the license key you received from Polar. If you don't have a license key yet, you can get one by becoming a [Capawesome Insider](https://capawesome.io/insiders/).

Next, you can use our **AI-Assisted Setup** to install the plugin. Add the [Capawesome Skills](https://github.com/capawesome-team/skills) to your AI tool using the following command:

`[](#%5F%5Fcodelineno-1-1)npx skills add capawesome-team/skills --skill capacitor-plugins
`

Then use the following prompt:

`` [](#%5F%5Fcodelineno-2-1)Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome-team/capacitor-nfc` plugin in my project.
 ``

If you prefer **Manual Setup**, install the plugin by running the following commands and follow the platform-specific instructions below:

`[](#%5F%5Fcodelineno-3-1)npm install @capawesome-team/capacitor-nfc
[](#%5F%5Fcodelineno-3-2)npx cap sync
`

### Android[¶](#android "Permanent link")

#### Features[¶](#features%5F1 "Permanent link")

Add the following element to your `AndroidManifest.xml` before or after the `application` tag:

`[](#%5F%5Fcodelineno-4-1)<uses-feature android:name="android.hardware.nfc" android:required="true" />
`

Set the `android:required` attribute to `true` if your app can't function, or isn't designed to function, when NFC is not available on the device. If your app can function without NFC, set the `android:required` attribute to `false`. This will allow your app to be installed on devices that do not support NFC.

#### Intent Filter[¶](#intent-filter "Permanent link")

If you want to launch your app through an NFC tag, please take a look at the [Android documentation](https://developer.android.com/guide/topics/connectivity/nfc/nfc#dispatching). There you will find which changes you have to apply to your `AndroidManifest.xml` ([example](https://developer.android.com/guide/topics/connectivity/nfc/nfc#ndef-disc)).

#### Services[¶](#services "Permanent link")

To be able to use Host Card Emulation (HCE), you also need to add the following service **inside** the `application` tag in your `AndroidManifest.xml` (usually `android/app/src/main/AndroidManifest.xml`):

`[](#%5F%5Fcodelineno-5-1)<service android:name=".MyHostApduService" android:exported="true"
[](#%5F%5Fcodelineno-5-2)         android:permission="android.permission.BIND_NFC_SERVICE">
[](#%5F%5Fcodelineno-5-3)    <intent-filter>
[](#%5F%5Fcodelineno-5-4)        <action android:name="android.nfc.cardemulation.action.HOST_APDU_SERVICE"/>
[](#%5F%5Fcodelineno-5-5)    </intent-filter>
[](#%5F%5Fcodelineno-5-6)    <meta-data android:name="android.nfc.cardemulation.host_apdu_service"
[](#%5F%5Fcodelineno-5-7)               android:resource="@xml/apduservice"/>
[](#%5F%5Fcodelineno-5-8)</service>
`

This meta-data tag points to an `apduservice.xml` file. The following is an example of such a file with a single AID group declaration containing two proprietary AIDs:

`[](#%5F%5Fcodelineno-6-1)<host-apdu-service xmlns:android="http://schemas.android.com/apk/res/android"
[](#%5F%5Fcodelineno-6-2)           android:description="@string/servicedesc"
[](#%5F%5Fcodelineno-6-3)           android:requireDeviceUnlock="false">
[](#%5F%5Fcodelineno-6-4)    <aid-group android:description="@string/aiddescription"
[](#%5F%5Fcodelineno-6-5)               android:category="other">
[](#%5F%5Fcodelineno-6-6)        <aid-filter android:name="F0010203040506"/>
[](#%5F%5Fcodelineno-6-7)        <aid-filter android:name="F0394148148100"/>
[](#%5F%5Fcodelineno-6-8)    </aid-group>
[](#%5F%5Fcodelineno-6-9)</host-apdu-service>
`

You can find more information about this in the [Android documentation](https://developer.android.com/develop/connectivity/nfc/hce#manifest-declaration).

#### Proguard[¶](#proguard "Permanent link")

If you are using Proguard, you need to add the following rules to your `proguard-rules.pro` file:

`[](#%5F%5Fcodelineno-7-1)-keep class io.capawesome.capacitorjs.plugins.** { *; }
`

### iOS[¶](#ios "Permanent link")

#### Entitlements[¶](#entitlements "Permanent link")

Ensure `Near Field Communication Tag Reading` and `NFC Scan` capabilities have been enabled in your application in Xcode. See [Add a capability to a target](https://help.apple.com/xcode/mac/current/#/dev88ff319e7) for more information.

This will also create or update the `ios/App/App/App.entitlements` file. Make sure it contains the following key to allow reading NFC tags:

`[](#%5F%5Fcodelineno-8-1)<?xml version="1.0" encoding="UTF-8"?>
[](#%5F%5Fcodelineno-8-2)<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
[](#%5F%5Fcodelineno-8-3)<plist version="1.0">
[](#%5F%5Fcodelineno-8-4)<dict>
[](#%5F%5Fcodelineno-8-5)    <key>com.apple.developer.nfc.readersession.formats</key>
[](#%5F%5Fcodelineno-8-6)    <array>
[](#%5F%5Fcodelineno-8-7)        <string>NDEF</string>
[](#%5F%5Fcodelineno-8-8)        <string>TAG</string>
[](#%5F%5Fcodelineno-8-9)    </array>
[](#%5F%5Fcodelineno-8-10)</dict>
[](#%5F%5Fcodelineno-8-11)</plist>
`

#### Privacy Descriptions[¶](#privacy-descriptions "Permanent link")

Add the `NFCReaderUsageDescription` key to the `ios/App/App/Info.plist` file, which tells the user why the app needs to use NFC:

`[](#%5F%5Fcodelineno-9-1)<key>NFCReaderUsageDescription</key>
[](#%5F%5Fcodelineno-9-2)<string>The app enables the reading and writing of various NFC tags.</string>
`

#### Universal Links[¶](#universal-links "Permanent link")

If you want to launch your app through an NFC tag, please take a look at the [Core NFC documentation](https://developer.apple.com/documentation/corenfc/adding%5Fsupport%5Ffor%5Fbackground%5Ftag%5Freading#3032598). The NFC tag requires a [URI record](https://w3c.github.io/web-nfc/#uri-record) (see [createNdefUriRecord(...)](https://github.com/capawesome-team/capacitor-plugins/tree/main/packages/nfc/docs/utils#createndefurirecord)) that must contain either a universal link (see [Deep Linking with Universal and App Links](https://capacitorjs.com/docs/guides/deep-links)) or a [supported URL scheme](https://developer.apple.com/documentation/corenfc/adding%5Fsupport%5Ffor%5Fbackground%5Ftag%5Freading#3032600).

## Configuration[¶](#configuration "Permanent link")

No configuration required for this plugin.

## Usage[¶](#usage "Permanent link")

`[](#%5F%5Fcodelineno-10-1)import { Nfc, NfcUtils, NfcTagTechType } from '@capawesome-team/capacitor-nfc';
[](#%5F%5Fcodelineno-10-2)import { Capacitor } from '@capacitor/core';
[](#%5F%5Fcodelineno-10-3)
[](#%5F%5Fcodelineno-10-4)const createNdefTextRecord = () => {
[](#%5F%5Fcodelineno-10-5)  const utils = new NfcUtils();
[](#%5F%5Fcodelineno-10-6)  const { record } = utils.createNdefTextRecord({ text: 'Capacitor NFC Plugin' });
[](#%5F%5Fcodelineno-10-7)  return record;
[](#%5F%5Fcodelineno-10-8)};
[](#%5F%5Fcodelineno-10-9)
[](#%5F%5Fcodelineno-10-10)const write = async () => {
[](#%5F%5Fcodelineno-10-11)  return new Promise((resolve) => {
[](#%5F%5Fcodelineno-10-12)    const record = createNdefTextRecord();
[](#%5F%5Fcodelineno-10-13)
[](#%5F%5Fcodelineno-10-14)    Nfc.addListener('nfcTagScanned', async (event) => {
[](#%5F%5Fcodelineno-10-15)      await Nfc.write({ message: { records: [record] } });
[](#%5F%5Fcodelineno-10-16)      await Nfc.stopScanSession();
[](#%5F%5Fcodelineno-10-17)      resolve();
[](#%5F%5Fcodelineno-10-18)    });
[](#%5F%5Fcodelineno-10-19)
[](#%5F%5Fcodelineno-10-20)    Nfc.startScanSession();
[](#%5F%5Fcodelineno-10-21)  });
[](#%5F%5Fcodelineno-10-22)};
[](#%5F%5Fcodelineno-10-23)
[](#%5F%5Fcodelineno-10-24)const read = async () => {
[](#%5F%5Fcodelineno-10-25)  return new Promise((resolve) => {
[](#%5F%5Fcodelineno-10-26)    Nfc.addListener('nfcTagScanned', async (event) => {
[](#%5F%5Fcodelineno-10-27)      await Nfc.stopScanSession();
[](#%5F%5Fcodelineno-10-28)      resolve(event.nfcTag);
[](#%5F%5Fcodelineno-10-29)    });
[](#%5F%5Fcodelineno-10-30)
[](#%5F%5Fcodelineno-10-31)    Nfc.startScanSession();
[](#%5F%5Fcodelineno-10-32)  });
[](#%5F%5Fcodelineno-10-33)};
[](#%5F%5Fcodelineno-10-34)
[](#%5F%5Fcodelineno-10-35)const makeReadOnly = async () => {
[](#%5F%5Fcodelineno-10-36)  return new Promise((resolve) => {
[](#%5F%5Fcodelineno-10-37)    Nfc.addListener('nfcTagScanned', async (event) => {
[](#%5F%5Fcodelineno-10-38)      await Nfc.makeReadOnly();
[](#%5F%5Fcodelineno-10-39)      await Nfc.stopScanSession();
[](#%5F%5Fcodelineno-10-40)      resolve();
[](#%5F%5Fcodelineno-10-41)    });
[](#%5F%5Fcodelineno-10-42)
[](#%5F%5Fcodelineno-10-43)    Nfc.startScanSession();
[](#%5F%5Fcodelineno-10-44)  });
[](#%5F%5Fcodelineno-10-45)};
[](#%5F%5Fcodelineno-10-46)
[](#%5F%5Fcodelineno-10-47)const readSignature = async () => {
[](#%5F%5Fcodelineno-10-48)  return new Promise((resolve) => {
[](#%5F%5Fcodelineno-10-49)    Nfc.addListener('nfcTagScanned', async (event) => {
[](#%5F%5Fcodelineno-10-50)      if (Capacitor.getPlatform() === 'android') {
[](#%5F%5Fcodelineno-10-51)        // 1. Connect to the tag.
[](#%5F%5Fcodelineno-10-52)        await Nfc.connect({ techType: NfcTagTechType.NfcA }); 
[](#%5F%5Fcodelineno-10-53)        // 2. Send one or more commands to the tag and receive the response.
[](#%5F%5Fcodelineno-10-54)        const result = await Nfc.transceive({ data: [60, 0] });
[](#%5F%5Fcodelineno-10-55)        // 3. Close the connection to the tag.
[](#%5F%5Fcodelineno-10-56)        await Nfc.close();
[](#%5F%5Fcodelineno-10-57)        await Nfc.stopScanSession();
[](#%5F%5Fcodelineno-10-58)        resolve(result);
[](#%5F%5Fcodelineno-10-59)      } else {
[](#%5F%5Fcodelineno-10-60)        // 1. Send one or more commands to the tag and receive the response.
[](#%5F%5Fcodelineno-10-61)        const result = await Nfc.transceive({ techType: NfcTagTechType.NfcA, data: [60, 0] });
[](#%5F%5Fcodelineno-10-62)        await Nfc.stopScanSession();
[](#%5F%5Fcodelineno-10-63)        resolve(result);
[](#%5F%5Fcodelineno-10-64)      }
[](#%5F%5Fcodelineno-10-65)    });
[](#%5F%5Fcodelineno-10-66)
[](#%5F%5Fcodelineno-10-67)    Nfc.startScanSession();
[](#%5F%5Fcodelineno-10-68)  });
[](#%5F%5Fcodelineno-10-69)};
[](#%5F%5Fcodelineno-10-70)
[](#%5F%5Fcodelineno-10-71)const erase = async () => {
[](#%5F%5Fcodelineno-10-72)  return new Promise((resolve) => {
[](#%5F%5Fcodelineno-10-73)    Nfc.addListener('nfcTagScanned', async (event) => {
[](#%5F%5Fcodelineno-10-74)      await Nfc.erase();
[](#%5F%5Fcodelineno-10-75)      await Nfc.stopScanSession();
[](#%5F%5Fcodelineno-10-76)      resolve();
[](#%5F%5Fcodelineno-10-77)    });
[](#%5F%5Fcodelineno-10-78)
[](#%5F%5Fcodelineno-10-79)    Nfc.startScanSession();
[](#%5F%5Fcodelineno-10-80)  });
[](#%5F%5Fcodelineno-10-81)};
[](#%5F%5Fcodelineno-10-82)
[](#%5F%5Fcodelineno-10-83)const format = async () => {
[](#%5F%5Fcodelineno-10-84)  return new Promise((resolve) => {
[](#%5F%5Fcodelineno-10-85)    Nfc.addListener('nfcTagScanned', async (event) => {
[](#%5F%5Fcodelineno-10-86)      await Nfc.format();
[](#%5F%5Fcodelineno-10-87)      await Nfc.stopScanSession();
[](#%5F%5Fcodelineno-10-88)      resolve();
[](#%5F%5Fcodelineno-10-89)    });
[](#%5F%5Fcodelineno-10-90)
[](#%5F%5Fcodelineno-10-91)    Nfc.startScanSession();
[](#%5F%5Fcodelineno-10-92)  });
[](#%5F%5Fcodelineno-10-93)};
[](#%5F%5Fcodelineno-10-94)
[](#%5F%5Fcodelineno-10-95)const isSupported = async () => {
[](#%5F%5Fcodelineno-10-96)  const { nfc } = await Nfc.isSupported();
[](#%5F%5Fcodelineno-10-97)  return nfc;
[](#%5F%5Fcodelineno-10-98)};
[](#%5F%5Fcodelineno-10-99)
[](#%5F%5Fcodelineno-10-100)const isEnabled = async () => {
[](#%5F%5Fcodelineno-10-101)  const { isEnabled } = await Nfc.isEnabled();
[](#%5F%5Fcodelineno-10-102)  return isEnabled;
[](#%5F%5Fcodelineno-10-103)};
[](#%5F%5Fcodelineno-10-104)
[](#%5F%5Fcodelineno-10-105)const openSettings = async () => {
[](#%5F%5Fcodelineno-10-106)  await Nfc.openSettings();
[](#%5F%5Fcodelineno-10-107)};
[](#%5F%5Fcodelineno-10-108)
[](#%5F%5Fcodelineno-10-109)const checkPermissions = async () => {
[](#%5F%5Fcodelineno-10-110)  const { nfc } = await Nfc.checkPermissions();
[](#%5F%5Fcodelineno-10-111)  return nfc;
[](#%5F%5Fcodelineno-10-112)};
[](#%5F%5Fcodelineno-10-113)
[](#%5F%5Fcodelineno-10-114)const requestPermissions = async () => {
[](#%5F%5Fcodelineno-10-115)  const { nfc } = await Nfc.requestPermissions();
[](#%5F%5Fcodelineno-10-116)  return nfc;
[](#%5F%5Fcodelineno-10-117)};
[](#%5F%5Fcodelineno-10-118)
[](#%5F%5Fcodelineno-10-119)const removeAllListeners = async () => {
[](#%5F%5Fcodelineno-10-120)  await Nfc.removeAllListeners();
[](#%5F%5Fcodelineno-10-121)};
`

### Advanced[¶](#advanced "Permanent link")

#### HCE[¶](#hce "Permanent link")

Host Card Emulation (HCE) allows your device to emulate an NFC card that other devices can interact with. The first example below demonstrates how to send APDU commands from an NFC reader using the `transceive(...)` method:

`[](#%5F%5Fcodelineno-11-1)import { Nfc, NfcTagTechType } from '@capawesome-team/capacitor-nfc';
[](#%5F%5Fcodelineno-11-2)import { Capacitor } from '@capacitor/core';
[](#%5F%5Fcodelineno-11-3)
[](#%5F%5Fcodelineno-11-4)const sendApduCommands = async () => {
[](#%5F%5Fcodelineno-11-5)  return new Promise((resolve) => {
[](#%5F%5Fcodelineno-11-6)    Nfc.addListener('nfcTagScanned', async (event) => {
[](#%5F%5Fcodelineno-11-7)      // Define APDU commands
[](#%5F%5Fcodelineno-11-8)      const selectApdu = [0x00, 0xA4, 0x04, 0x00, 0x07, 0xF0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x00];
[](#%5F%5Fcodelineno-11-9)      const customApdu = [0x00, 0x01, 0x00, 0x00, 0x00];
[](#%5F%5Fcodelineno-11-10)
[](#%5F%5Fcodelineno-11-11)      // Connect to the tag (Android only)
[](#%5F%5Fcodelineno-11-12)      if (Capacitor.getPlatform() === 'android') {
[](#%5F%5Fcodelineno-11-13)        await Nfc.connect({ techType: NfcTagTechType.IsoDep });
[](#%5F%5Fcodelineno-11-14)      }
[](#%5F%5Fcodelineno-11-15)
[](#%5F%5Fcodelineno-11-16)      // Send SELECT APDU command
[](#%5F%5Fcodelineno-11-17)      const selectResponse = await Nfc.transceive({
[](#%5F%5Fcodelineno-11-18)        techType: NfcTagTechType.Iso7816,
[](#%5F%5Fcodelineno-11-19)        data: selectApdu
[](#%5F%5Fcodelineno-11-20)      });
[](#%5F%5Fcodelineno-11-21)
[](#%5F%5Fcodelineno-11-22)      // Send custom APDU command
[](#%5F%5Fcodelineno-11-23)      const customResponse = await Nfc.transceive({
[](#%5F%5Fcodelineno-11-24)        techType: NfcTagTechType.Iso7816,
[](#%5F%5Fcodelineno-11-25)        data: customApdu
[](#%5F%5Fcodelineno-11-26)      });
[](#%5F%5Fcodelineno-11-27)
[](#%5F%5Fcodelineno-11-28)      // Close the connection (Android only)
[](#%5F%5Fcodelineno-11-29)      if (Capacitor.getPlatform() === 'android') {
[](#%5F%5Fcodelineno-11-30)        await Nfc.close();
[](#%5F%5Fcodelineno-11-31)      }
[](#%5F%5Fcodelineno-11-32)
[](#%5F%5Fcodelineno-11-33)      // Stop the scan session
[](#%5F%5Fcodelineno-11-34)      await Nfc.stopScanSession();
[](#%5F%5Fcodelineno-11-35)      resolve();
[](#%5F%5Fcodelineno-11-36)    });
[](#%5F%5Fcodelineno-11-37)    // Start the scan session
[](#%5F%5Fcodelineno-11-38)    Nfc.startScanSession();
[](#%5F%5Fcodelineno-11-39)  });
[](#%5F%5Fcodelineno-11-40)};
`

The second example below demonstrates how to respond to APDU commands sent by an NFC reader using the `commandReceived` event listener and the `respond(...)` method:

`[](#%5F%5Fcodelineno-12-1)import { Nfc } from '@capawesome-team/capacitor-nfc';
[](#%5F%5Fcodelineno-12-2)
[](#%5F%5Fcodelineno-12-3)const respondToApduCommands = async () => {
[](#%5F%5Fcodelineno-12-4)  // Listen for incoming APDU commands
[](#%5F%5Fcodelineno-12-5)  Nfc.addListener('commandReceived', async (event) => {
[](#%5F%5Fcodelineno-12-6)    // Parse the incoming command
[](#%5F%5Fcodelineno-12-7)    const command = event.data;
[](#%5F%5Fcodelineno-12-8)
[](#%5F%5Fcodelineno-12-9)    // Check if it's a SELECT command
[](#%5F%5Fcodelineno-12-10)    if (command[0] === 0x00 && command[1] === 0xA4 && command[2] === 0x04 && command[3] === 0x00) {
[](#%5F%5Fcodelineno-12-11)      // Respond with success status (0x9000)
[](#%5F%5Fcodelineno-12-12)      const response = [0x90, 0x00];
[](#%5F%5Fcodelineno-12-13)      await Nfc.respond({ data: response });
[](#%5F%5Fcodelineno-12-14)    }
[](#%5F%5Fcodelineno-12-15)    // Check for custom command
[](#%5F%5Fcodelineno-12-16)    else if (command[0] === 0x00 && command[1] === 0x01) {
[](#%5F%5Fcodelineno-12-17)      // Respond with custom data
[](#%5F%5Fcodelineno-12-18)      const response = [0x48, 0x65, 0x6C, 0x6C, 0x6F, 0x90, 0x00]; // "Hello" + success status
[](#%5F%5Fcodelineno-12-19)      await Nfc.respond({ data: response });
[](#%5F%5Fcodelineno-12-20)    }
[](#%5F%5Fcodelineno-12-21)    // Unknown command
[](#%5F%5Fcodelineno-12-22)    else {
[](#%5F%5Fcodelineno-12-23)      // Respond with error status (0x6D00 - Instruction not supported)
[](#%5F%5Fcodelineno-12-24)      const response = [0x6D, 0x00];
[](#%5F%5Fcodelineno-12-25)      await Nfc.respond({ data: response });
[](#%5F%5Fcodelineno-12-26)    }
[](#%5F%5Fcodelineno-12-27)  });
[](#%5F%5Fcodelineno-12-28)};
`

## API[¶](#api "Permanent link")

* [startScanSession(...)](#startscansession)
* [stopScanSession(...)](#stopscansession)
* [write(...)](#write)
* [respond(...)](#respond)
* [makeReadOnly()](#makereadonly)
* [erase()](#erase)
* [format()](#format)
* [transceive(...)](#transceive)
* [connect(...)](#connect)
* [close()](#close)
* [isAvailable()](#isavailable)
* [isSupported()](#issupported)
* [isEnabled()](#isenabled)
* [openSettings()](#opensettings)
* [getAntennaInfo()](#getantennainfo)
* [setAlertMessage(...)](#setalertmessage)
* [checkPermissions()](#checkpermissions)
* [requestPermissions()](#requestpermissions)
* [addListener('commandReceived', ...)](#addlistenercommandreceived-)
* [addListener('nfcLinkDeactivated', ...)](#addlistenernfclinkdeactivated-)
* [addListener('nfcTagScanned', ...)](#addlistenernfctagscanned-)
* [addListener('scanSessionCanceled', ...)](#addlistenerscansessioncanceled-)
* [addListener('scanSessionError', ...)](#addlistenerscansessionerror-)
* [removeAllListeners()](#removealllisteners)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)
* [Enums](#enums)

### startScanSession(...)[¶](#startscansession "Permanent link")

`[](#%5F%5Fcodelineno-13-1)startScanSession(options?: StartScanSessionOptions | undefined) => Promise<void>
`

Start a scan session. Only one session can be active at a time.

Stop the session as soon as you are done using `stopScanSession(...)`.

On iOS, this will trigger the NFC Reader Session alert.

| Param       | Type                                                |
| ----------- | --------------------------------------------------- |
| **options** | [StartScanSessionOptions](#startscansessionoptions) |

**Since:** 0.0.1

---

### stopScanSession(...)[¶](#stopscansession "Permanent link")

`[](#%5F%5Fcodelineno-14-1)stopScanSession(options?: StopScanSessionOptions | undefined) => Promise<void>
`

Stop the active scan session.

| Param       | Type                                              |
| ----------- | ------------------------------------------------- |
| **options** | [StopScanSessionOptions](#stopscansessionoptions) |

**Since:** 0.0.1

---

### write(...)[¶](#write "Permanent link")

`[](#%5F%5Fcodelineno-15-1)write(options: WriteOptions) => Promise<void>
`

Write to a NFC tag.

This method must be called from within a `nfcTagScanned` handler.

| Param       | Type                          |
| ----------- | ----------------------------- |
| **options** | [WriteOptions](#writeoptions) |

**Since:** 0.0.1

---

### respond(...)[¶](#respond "Permanent link")

`[](#%5F%5Fcodelineno-16-1)respond(options: RespondOptions) => Promise<void>
`

Send a response APDU back to the remote device.

Only available on Android.

| Param       | Type                              |
| ----------- | --------------------------------- |
| **options** | [RespondOptions](#respondoptions) |

**Since:** 6.3.0

---

### makeReadOnly()[¶](#makereadonly "Permanent link")

`[](#%5F%5Fcodelineno-17-1)makeReadOnly() => Promise<void>
`

Make a NFC tag readonly.

This method must be called from within a `nfcTagScanned` handler.

**Attention:** This is permanent and can not be undone.

**Since:** 0.0.1

---

### erase()[¶](#erase "Permanent link")

`[](#%5F%5Fcodelineno-18-1)erase() => Promise<void>
`

Erase the NFC tag by writing an empty NDEF message.

This method must be called from within a `nfcTagScanned` handler.

**Since:** 0.3.0

---

### format()[¶](#format "Permanent link")

`[](#%5F%5Fcodelineno-19-1)format() => Promise<void>
`

Format the NFC tag as NDEF and write an empty NDEF message.

This method must be called from within a `nfcTagScanned` handler.

Only available on Android.

**Since:** 0.3.0

---

### transceive(...)[¶](#transceive "Permanent link")

`[](#%5F%5Fcodelineno-20-1)transceive(options: TransceiveOptions) => Promise<TransceiveResult>
`

Send raw command to the tag and receive the response.

This method must be called from within a `nfcTagScanned` handler.

On **Android**, the tag must be connected with `connect()` first.

⚠️ **Experimental:** This method could not be tested extensively yet. Please let us know if you discover any issues!

⚠️ **Attention**: A bad command can damage the tag forever. Please read the Android and iOS documentation linked below first.

More information on how to use this method on **Android**: https://bit.ly/3ywSkvT

More information on how to use this method on **iOS** with... - ISO 15693-3: https://apple.co/3Lliaum - FeliCa: https://apple.co/3LpvRs6

Only available on Android and iOS.

| Param       | Type                                    |
| ----------- | --------------------------------------- |
| **options** | [TransceiveOptions](#transceiveoptions) |

**Returns:** `Promise<[TransceiveResult](#transceiveresult)>`

**Since:** 0.3.0

---

### connect(...)[¶](#connect "Permanent link")

`[](#%5F%5Fcodelineno-21-1)connect(options: ConnectOptions) => Promise<void>
`

Connect to the tag and enable I/O operations.

This method must be called from within a `nfcTagScanned` handler.

Only available on Android.

| Param       | Type                              |
| ----------- | --------------------------------- |
| **options** | [ConnectOptions](#connectoptions) |

**Since:** 6.0.0

---

### close()[¶](#close "Permanent link")

`[](#%5F%5Fcodelineno-22-1)close() => Promise<void>
`

Close the connection to the tag.

This method must be called from within a `nfcTagScanned` handler.

Only available on Android.

**Since:** 6.0.0

---

### isAvailable()[¶](#isavailable "Permanent link")

`[](#%5F%5Fcodelineno-23-1)isAvailable() => Promise<IsAvailableResult>
`

Returns whether or not NFC is available.

**Returns:** `Promise<[IsAvailableResult](#isavailableresult)>`

**Since:** 7.2.0

---

### isSupported()[¶](#issupported "Permanent link")

`[](#%5F%5Fcodelineno-24-1)isSupported() => Promise<IsSupportedResult>
`

Returns whether or not NFC is supported.

**Returns:** `Promise<[IsSupportedResult](#issupportedresult)>`

**Since:** 0.0.1

---

### isEnabled()[¶](#isenabled "Permanent link")

`[](#%5F%5Fcodelineno-25-1)isEnabled() => Promise<IsEnabledResult>
`

Returns whether or not NFC is enabled.

On **iOS** and **Web**, this method reflects whether NFC reading is available on the device. iOS does not expose a global NFC on/off setting.

**Returns:** `Promise<[IsEnabledResult](#isenabledresult)>`

**Since:** 0.0.1

---

### openSettings()[¶](#opensettings "Permanent link")

`[](#%5F%5Fcodelineno-26-1)openSettings() => Promise<void>
`

Opens the NFC device settings so that the user can enable or disable NFC.

Only available on Android.

**Since:** 0.0.1

---

### getAntennaInfo()[¶](#getantennainfo "Permanent link")

`[](#%5F%5Fcodelineno-27-1)getAntennaInfo() => Promise<GetAntennaInfoResult>
`

Returns information regarding Nfc antennas on the device such as their relative positioning on the device.

Only available on Android.

**Returns:** `Promise<[GetAntennaInfoResult](#getantennainforesult)>`

**Since:** 6.1.0

---

### setAlertMessage(...)[¶](#setalertmessage "Permanent link")

`[](#%5F%5Fcodelineno-28-1)setAlertMessage(options: SetAlertMessageOptions) => Promise<void>
`

Set a custom message, which is displayed in the NFC Reader Session alert.

Only available on iOS.

| Param       | Type                                              |
| ----------- | ------------------------------------------------- |
| **options** | [SetAlertMessageOptions](#setalertmessageoptions) |

**Since:** 6.2.0

---

### checkPermissions()[¶](#checkpermissions "Permanent link")

`[](#%5F%5Fcodelineno-29-1)checkPermissions() => Promise<PermissionResult>
`

Check permission for reading and writing NFC tags.

This method is only needed on Web. On Android and iOS, `granted` is always returned.

**Returns:** `Promise<[PermissionResult](#permissionresult)>`

**Since:** 0.0.1

---

### requestPermissions()[¶](#requestpermissions "Permanent link")

`[](#%5F%5Fcodelineno-30-1)requestPermissions() => Promise<PermissionResult>
`

Request permission for reading and writing NFC tags.

This method is only needed on Web. On Android and iOS, `granted` is always returned.

**Returns:** `Promise<[PermissionResult](#permissionresult)>`

**Since:** 0.0.1

---

### addListener('commandReceived', ...)[¶](#addlistenercommandreceived "Permanent link")

`[](#%5F%5Fcodelineno-31-1)addListener(eventName: 'commandReceived', listenerFunc: (event: CommandReceivedEvent) => void) => Promise<PluginListenerHandle>
`

Called whenever a NFC reader sends an Application Protocol Data Unit (APDU).

Only available on Android.

| Param            | Type                                                           |
| ---------------- | -------------------------------------------------------------- |
| **eventName**    | 'commandReceived'                                              |
| **listenerFunc** | (event: [CommandReceivedEvent](#commandreceivedevent)) => void |

**Returns:** `Promise<[PluginListenerHandle](#pluginlistenerhandle)>`

**Since:** 6.3.0

---

### addListener('nfcLinkDeactivated', ...)[¶](#addlistenernfclinkdeactivated "Permanent link")

`[](#%5F%5Fcodelineno-32-1)addListener(eventName: 'nfcLinkDeactivated', listenerFunc: (event: NfcLinkDeactivatedEvent) => void) => Promise<PluginListenerHandle>
`

Called when the NFC link has been deactivated or lost.

Only available on Android.

| Param            | Type                                                                 |
| ---------------- | -------------------------------------------------------------------- |
| **eventName**    | 'nfcLinkDeactivated'                                                 |
| **listenerFunc** | (event: [NfcLinkDeactivatedEvent](#nfclinkdeactivatedevent)) => void |

**Returns:** `Promise<[PluginListenerHandle](#pluginlistenerhandle)>`

**Since:** 6.3.0

---

### addListener('nfcTagScanned', ...)[¶](#addlistenernfctagscanned "Permanent link")

`[](#%5F%5Fcodelineno-33-1)addListener(eventName: 'nfcTagScanned', listenerFunc: (event: NfcTagScannedEvent) => void) => Promise<PluginListenerHandle>
`

Called when a new NFC tag is scanned.

| Param            | Type                                                       |
| ---------------- | ---------------------------------------------------------- |
| **eventName**    | 'nfcTagScanned'                                            |
| **listenerFunc** | (event: [NfcTagScannedEvent](#nfctagscannedevent)) => void |

**Returns:** `Promise<[PluginListenerHandle](#pluginlistenerhandle)>`

**Since:** 0.0.1

---

### addListener('scanSessionCanceled', ...)[¶](#addlistenerscansessioncanceled "Permanent link")

`[](#%5F%5Fcodelineno-34-1)addListener(eventName: 'scanSessionCanceled', listenerFunc: () => void) => Promise<PluginListenerHandle>
`

Called when the scan session was canceled.

Only available on iOS.

| Param            | Type                  |
| ---------------- | --------------------- |
| **eventName**    | 'scanSessionCanceled' |
| **listenerFunc** | () => void            |

**Returns:** `Promise<[PluginListenerHandle](#pluginlistenerhandle)>`

**Since:** 0.0.1

---

### addListener('scanSessionError', ...)[¶](#addlistenerscansessionerror "Permanent link")

`[](#%5F%5Fcodelineno-35-1)addListener(eventName: 'scanSessionError', listenerFunc: (event: ScanSessionErrorEvent) => void) => Promise<PluginListenerHandle>
`

Called when an error occurs during the scan session.

| Param            | Type                                                             |
| ---------------- | ---------------------------------------------------------------- |
| **eventName**    | 'scanSessionError'                                               |
| **listenerFunc** | (event: [ScanSessionErrorEvent](#scansessionerrorevent)) => void |

**Returns:** `Promise<[PluginListenerHandle](#pluginlistenerhandle)>`

**Since:** 0.0.1

---

### removeAllListeners()[¶](#removealllisteners "Permanent link")

`[](#%5F%5Fcodelineno-36-1)removeAllListeners() => Promise<void>
`

Remove all listeners for this plugin.

**Since:** 0.0.1

---

### Interfaces[¶](#interfaces "Permanent link")

#### StartScanSessionOptions[¶](#startscansessionoptions "Permanent link")

| Prop                  | Type               | Description                                                                                                                                                                                                | Default                                            | Since |
| --------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------- | ----- |
| **alertMessage**      | string             | A custom message, which is displayed in the NFC Reader Session alert. Only available on iOS.                                                                                                               | 0.0.1                                              |       |
| **compatibilityMode** | boolean            | Whether or not to use the [NFCNDEFReaderSession](https://developer.apple.com/documentation/corenfc/nfcndefreadersession). **Attention:** This mode only supports reading NDEF tags. Only available on iOS. | false                                              | 6.4.0 |
| **techTypes**         | NfcTagTechType\[\] | The NFC tag technologies to filter on in this session. Only available on Android.                                                                                                                          | 0.0.1                                              |       |
| **mimeTypes**         | string\[\]         | Mime types to filter on in this session. Only available on Android.                                                                                                                                        | 0.0.1                                              |       |
| **pollingOptions**    | PollingOption\[\]  | Type of tags to detect during a polling sequence. Only available on iOS.                                                                                                                                   | \[PollingOption.iso14443, PollingOption.iso15693\] | 0.2.0 |

#### StopScanSessionOptions[¶](#stopscansessionoptions "Permanent link")

| Prop             | Type   | Description                                                                                        | Since |
| ---------------- | ------ | -------------------------------------------------------------------------------------------------- | ----- |
| **errorMessage** | string | A custom error message, which is displayed in the NFC Reader Session alert. Only available on iOS. | 0.0.1 |

#### WriteOptions[¶](#writeoptions "Permanent link")

| Prop        | Type                        | Description                | Since |
| ----------- | --------------------------- | -------------------------- | ----- |
| **message** | [NdefMessage](#ndefmessage) | The NDEF message to write. | 0.0.1 |

#### NdefMessage[¶](#ndefmessage "Permanent link")

| Prop        | Type           | Description                      | Since |
| ----------- | -------------- | -------------------------------- | ----- |
| **records** | NdefRecord\[\] | The records of the NDEF message. | 0.0.1 |

#### NdefRecord[¶](#ndefrecord "Permanent link")

| Prop        | Type                              | Description                                                                                                            | Since |
| ----------- | --------------------------------- | ---------------------------------------------------------------------------------------------------------------------- | ----- |
| **id**      | number\[\]                        | The record identifier as byte array.                                                                                   | 0.0.1 |
| **payload** | number\[\]                        | The payload field data as byte array.                                                                                  | 0.0.1 |
| **tnf**     | [TypeNameFormat](#typenameformat) | The record type name format which indicates the structure of the value of the type field.                              | 0.0.1 |
| **type**    | number\[\]                        | The type of the record payload. This should be used in conjunction with the tnf field to determine the payload format. | 0.0.1 |

#### RespondOptions[¶](#respondoptions "Permanent link")

| Prop     | Type       | Description    | Since |
| -------- | ---------- | -------------- | ----- |
| **data** | number\[\] | Bytes to send. | 6.3.0 |

#### TransceiveResult[¶](#transceiveresult "Permanent link")

| Prop         | Type       | Description                 | Since |
| ------------ | ---------- | --------------------------- | ----- |
| **response** | number\[\] | Bytes received in response. | 0.3.0 |

#### TransceiveOptions[¶](#transceiveoptions "Permanent link")

| Prop                     | Type                              | Description                                                                                                                                                                                                     | Since |
| ------------------------ | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |
| **techType**             | [NfcTagTechType](#nfctagtechtype) | The NFC tag technology to connect with. Only available on iOS.                                                                                                                                                  | 0.3.0 |
| **data**                 | number\[\]                        | Bytes to send.                                                                                                                                                                                                  | 0.3.0 |
| **iso15693RequestFlags** | Iso15693RequestFlag\[\]           | The request flags for the NFC tag technology type NfcV (ISO 15693-3). Only available on iOS 14+                                                                                                                 | 0.3.0 |
| **iso15693CommandCode**  | number                            | The custom command code defined by the IC manufacturer for the NFC tag technology type NfcV (ISO 15693-3). Valid range is 0xA0 to 0xDF inclusively, 0x23 and 0x24 are also supported. Only available on iOS 14+ | 0.3.0 |

#### ConnectOptions[¶](#connectoptions "Permanent link")

| Prop         | Type                              | Description                                                        | Since |
| ------------ | --------------------------------- | ------------------------------------------------------------------ | ----- |
| **techType** | [NfcTagTechType](#nfctagtechtype) | The NFC tag technology to connect with. Only available on Android. | 6.0.0 |

#### IsAvailableResult[¶](#isavailableresult "Permanent link")

| Prop    | Type    | Description                                                          | Since |
| ------- | ------- | -------------------------------------------------------------------- | ----- |
| **hce** | boolean | Whether or not Host Card Emulation (HCE) is available on the device. | 7.2.0 |
| **nfc** | boolean | Whether or not NFC is available on the device.                       | 7.2.0 |

#### IsSupportedResult[¶](#issupportedresult "Permanent link")

| Prop            | Type    | Description                                                          | Since |
| --------------- | ------- | -------------------------------------------------------------------- | ----- |
| **isSupported** | boolean | 0.0.1                                                                |       |
| **nfc**         | boolean | Whether or not NFC is supported on the device.                       | 6.3.0 |
| **hce**         | boolean | Whether or not Host Card Emulation (HCE) is supported on the device. | 6.3.0 |

#### IsEnabledResult[¶](#isenabledresult "Permanent link")

| Prop          | Type    | Since |
| ------------- | ------- | ----- |
| **isEnabled** | boolean | 0.0.1 |

#### GetAntennaInfoResult[¶](#getantennainforesult "Permanent link")

| Prop                  | Type        | Description                               | Since |
| --------------------- | ----------- | ----------------------------------------- | ----- |
| **availableAntennas** | Antenna\[\] | The available NFC antennas on the device. | 6.1.0 |
| **deviceHeight**      | number      | The height of the device in millimeters.  | 6.1.0 |
| **deviceWidth**       | number      | The width of the device in millimeters.   | 6.1.0 |
| **isDeviceFoldable**  | boolean     | Whether or not the device is foldable.    | 6.1.0 |

#### Antenna[¶](#antenna "Permanent link")

| Prop          | Type   | Description                                                   | Since |
| ------------- | ------ | ------------------------------------------------------------- | ----- |
| **locationX** | number | The location of the NFC antenna on the X axis in millimeters. | 6.1.0 |
| **locationY** | number | The location of the NFC antenna on the Y axis in millimeters. | 6.1.0 |

#### SetAlertMessageOptions[¶](#setalertmessageoptions "Permanent link")

| Prop        | Type   | Description                                                             | Since |
| ----------- | ------ | ----------------------------------------------------------------------- | ----- |
| **message** | string | The custom message, which is displayed in the NFC Reader Session alert. | 6.2.0 |

#### PermissionResult[¶](#permissionresult "Permanent link")

| Prop    | Type                                | Description                                        | Since |
| ------- | ----------------------------------- | -------------------------------------------------- | ----- |
| **nfc** | [PermissionState](#permissionstate) | Permission state for reading and writing NFC tags. | 0.0.1 |

#### PluginListenerHandle[¶](#pluginlistenerhandle "Permanent link")

| Prop       | Type                |
| ---------- | ------------------- |
| **remove** | () => Promise<void> |

#### CommandReceivedEvent[¶](#commandreceivedevent "Permanent link")

| Prop     | Type       | Description                                  | Since |
| -------- | ---------- | -------------------------------------------- | ----- |
| **data** | number\[\] | The command received from the remote device. | 6.3.0 |

#### NfcLinkDeactivatedEvent[¶](#nfclinkdeactivatedevent "Permanent link")

| Prop       | Type                                      | Description                               | Since |
| ---------- | ----------------------------------------- | ----------------------------------------- | ----- |
| **reason** | [DeactivationReason](#deactivationreason) | The reason why the deactivation occurred. | 6.3.0 |

#### NfcTagScannedEvent[¶](#nfctagscannedevent "Permanent link")

| Prop       | Type              | Description          | Since |
| ---------- | ----------------- | -------------------- | ----- |
| **nfcTag** | [NfcTag](#nfctag) | The scanned NFC tag. | 0.0.1 |

#### NfcTag[¶](#nfctag "Permanent link")

| Prop                 | Type                        | Description                                                                                         | Since |
| -------------------- | --------------------------- | --------------------------------------------------------------------------------------------------- | ----- |
| **atqa**             | number\[\]                  | The ATQA/SENS\_RES bytes of an NFC A tag. Only available on Android.                                | 0.0.1 |
| **applicationData**  | number\[\]                  | The Application Data bytes from ATQB/SENSB\_RES of an NFC B tag. Only available on Android and iOS. | 0.0.1 |
| **barcode**          | number\[\]                  | The barcode bytes of an NfcBarcode tag. Only available on Android.                                  | 0.0.1 |
| **canMakeReadOnly**  | boolean                     | Whether the NDEF tag can be made read-only or not. Only available on Android.                       | 0.0.1 |
| **dsfId**            | number\[\]                  | The DSF ID bytes of an NFC V tag. Only available on Android.                                        | 0.0.1 |
| **hiLayerResponse**  | number\[\]                  | The higher layer response bytes of an ISO-DEP tag. Only available on Android.                       | 0.0.1 |
| **historicalBytes**  | number\[\]                  | The historical bytes of an ISO-DEP tag. Only available on Android and iOS.                          | 0.0.1 |
| **id**               | number\[\]                  | The tag identifier (low level serial number) which is used for anti-collision and identification.   | 0.0.1 |
| **isWritable**       | boolean                     | Whether the NDEF tag is writable or not. Only available on Android and iOS.                         | 0.0.1 |
| **manufacturer**     | number\[\]                  | The manufacturer bytes of an NFC F tag. Only available on Android and iOS.                          | 0.0.1 |
| **manufacturerCode** | number                      | The Integrated Circuit (IC) manufacturer code of an NFC V tag. Only available on iOS.               | 6.3.0 |
| **maxSize**          | number                      | The maximum NDEF message size in bytes. Only available on Android and iOS.                          | 0.0.1 |
| **message**          | [NdefMessage](#ndefmessage) | The NDEF-formatted message.                                                                         | 0.0.1 |
| **protocolInfo**     | number\[\]                  | The Protocol Info bytes from ATQB/SENSB\_RES of an NFC B tag. Only available on Android.            | 0.0.1 |
| **responseFlags**    | number\[\]                  | The Response Flag bytes of an NFC V tag. Only available on Android.                                 | 0.0.1 |
| **sak**              | number\[\]                  | The SAK/SEL\_RES bytes of an NFC A tag. Only available on Android.                                  | 0.0.1 |
| **systemCode**       | number\[\]                  | The System Code bytes of an NFC F tag. Only available on Android and iOS.                           | 0.0.1 |
| **techTypes**        | NfcTagTechType\[\]          | The technologies available in this tag. Only available on Android and iOS.                          | 0.0.1 |
| **type**             | [NfcTagType](#nfctagtype)   | The NDEF tag type. Only available on Android and iOS.                                               | 0.0.1 |

#### ScanSessionErrorEvent[¶](#scansessionerrorevent "Permanent link")

| Prop        | Type   | Description        | Since |
| ----------- | ------ | ------------------ | ----- |
| **message** | string | The error message. | 0.0.1 |

### Type Aliases[¶](#type-aliases "Permanent link")

#### PermissionState[¶](#permissionstate "Permanent link")

`'prompt' | 'prompt-with-rationale' | 'granted' | 'denied'`

### Enums[¶](#enums "Permanent link")

#### NfcTagTechType[¶](#nfctagtechtype "Permanent link")

| Members              | Value                | Description                                                                   | Since |
| -------------------- | -------------------- | ----------------------------------------------------------------------------- | ----- |
| **NfcA**             | 'NFC\_A'             | The NFC-A (ISO 14443-3A) tag technology. Only available on Android.           | 0.0.1 |
| **NfcB**             | 'NFC\_B'             | The NFC-B (ISO 14443-3B) tag technology. Only available on Android.           | 0.0.1 |
| **NfcF**             | 'NFC\_F'             | The NFC-F (JIS 6319-4) tag technology. Only available on Android and iOS.     | 0.0.1 |
| **NfcV**             | 'NFC\_V'             | The NFC-V (ISO 15693) tag technology. Only available on Android and iOS.      | 0.0.1 |
| **IsoDep**           | 'ISO\_DEP'           | The ISO-DEP (ISO 14443-4) tag technology. Only available on Android.          | 0.0.1 |
| **Iso7816**          | 'ISO\_7816'          | The ISO 7816 tag technology. Only available on iOS.                           | 5.1.0 |
| **Ndef**             | 'NDEF'               | The NDEF tag technology. Only available on Android.                           | 0.0.1 |
| **MifareClassic**    | 'MIFARE\_CLASSIC'    | The MIFARE Classic tag technology. Only available on Android.                 | 0.0.1 |
| **MifareDesfire**    | 'MIFARE\_DESFIRE'    | The MIFARE Desfire tag technology. Only available on iOS.                     | 5.1.0 |
| **MifarePlus**       | 'MIFARE\_PLUS'       | The MIFARE Plus tag technology. Only available on iOS.                        | 5.1.0 |
| **MifareUltralight** | 'MIFARE\_ULTRALIGHT' | The MIFARE Ultralight tag technology. Only available on Android and iOS.      | 0.0.1 |
| **NfcBarcode**       | 'NFC\_BARCODE'       | The technology of a tag containing just a barcode. Only available on Android. | 0.0.1 |
| **NdefFormatable**   | 'NDEF\_FORMATABLE'   | The NDEF formatable tag technology. Only available on Android.                | 0.0.1 |

#### PollingOption[¶](#pollingoption "Permanent link")

| Members      | Value      | Description                                                   | Since |
| ------------ | ---------- | ------------------------------------------------------------- | ----- |
| **iso14443** | 'iso14443' | The option for detecting ISO 7816-compatible and MIFARE tags. | 0.2.0 |
| **iso15693** | 'iso15693' | The option for detecting ISO 15693 tags.                      | 0.2.0 |
| **iso18092** | 'iso18092' | The option for detecting FeliCa tags.                         | 0.2.0 |

#### TypeNameFormat[¶](#typenameformat "Permanent link")

| Members         | Value | Description                                                                                            | Since |
| --------------- | ----- | ------------------------------------------------------------------------------------------------------ | ----- |
| **Empty**       | 0     | An empty record with no type or payload.                                                               | 0.0.1 |
| **WellKnown**   | 1     | A predefined type defined in the RTD specification of the NFC Forum.                                   | 0.0.1 |
| **MimeMedia**   | 2     | An Internet media type as defined in RFC 2046.                                                         | 0.0.1 |
| **AbsoluteUri** | 3     | A URI as defined in RFC 3986.                                                                          | 0.0.1 |
| **External**    | 4     | A user-defined value that is based on the rules of the NFC Forum Record Type Definition specification. | 0.0.1 |
| **Unknown**     | 5     | Type is unknown.                                                                                       | 0.0.1 |
| **Unchanged**   | 6     | Indicates the payload is an intermediate or final chunk of a chunked NDEF Record.                      | 0.0.1 |

#### Iso15693RequestFlag[¶](#iso15693requestflag "Permanent link")

| Members                 | Value                 | Since |
| ----------------------- | --------------------- | ----- |
| **address**             | 'address'             | 0.3.0 |
| **commandSpecificBit8** | 'commandSpecificBit8' | 0.3.0 |
| **dualSubCarriers**     | 'dualSubCarriers'     | 0.3.0 |
| **highDataRate**        | 'highDataRate'        | 0.3.0 |
| **option**              | 'option'              | 0.3.0 |
| **protocolExtension**   | 'protocolExtension'   | 0.3.0 |
| **select**              | 'select'              | 0.3.0 |

#### DeactivationReason[¶](#deactivationreason "Permanent link")

| Members        | Value | Description                                                       | Since |
| -------------- | ----- | ----------------------------------------------------------------- | ----- |
| **LinkLoss**   | 0     | Indicates deactivation was due to the NFC link being lost.        | 6.3.0 |
| **Deselected** | 1     | Indicates deactivation was due to a different AID being selected. | 6.3.0 |

#### NfcTagType[¶](#nfctagtype "Permanent link")

| Members               | Value                   | Description                        | Since |
| --------------------- | ----------------------- | ---------------------------------- | ----- |
| **NfcForumType1**     | 'NFC\_FORUM\_TYPE\_1'   | Only available on Android.         | 0.0.1 |
| **NfcForumType2**     | 'NFC\_FORUM\_TYPE\_2'   | Only available on Android.         | 0.0.1 |
| **NfcForumType3**     | 'NFC\_FORUM\_TYPE\_3'   | Only available on Android and iOS. | 0.0.1 |
| **NfcForumType4**     | 'NFC\_FORUM\_TYPE\_4'   | Only available on Android.         | 0.0.1 |
| **MifareClassic**     | 'MIFARE\_CLASSIC'       | Only available on Android.         | 0.0.1 |
| **MifareDesfire**     | 'MIFARE\_DESFIRE'       | 0.0.1                              |       |
| **MifarePlus**        | 'MIFARE\_PLUS'          | Only available on Android.         | 0.0.1 |
| **MifarePro**         | 'MIFARE\_PRO'           | Only available on Android.         | 0.0.1 |
| **MifareUltralight**  | 'MIFARE\_ULTRALIGHT'    | Only available on Android.         | 0.0.1 |
| **MifareUltralightC** | 'MIFARE\_ULTRALIGHT\_C' | Only available on Android.         | 0.0.1 |

## Utils[¶](#utils "Permanent link")

This plugin provides a utility class `NfcUtils` that can be used for various NFC-related operations, for example, creating NDEF records:

`[](#%5F%5Fcodelineno-37-1)import { NfcUtils } from '@capawesome-team/capacitor-nfc';
[](#%5F%5Fcodelineno-37-2)
[](#%5F%5Fcodelineno-37-3)const createNdefTextRecord = () => {
[](#%5F%5Fcodelineno-37-4)  const utils = new NfcUtils();
[](#%5F%5Fcodelineno-37-5)  const { record } = utils.createNdefTextRecord({ text: 'Capacitor NFC Plugin' });
[](#%5F%5Fcodelineno-37-6)  return record;
[](#%5F%5Fcodelineno-37-7)};
`

See [docs/utils/README.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/nfc/docs/utils/README.md) for more information.

## Troubleshooting[¶](#troubleshooting "Permanent link")

##### `The connection to service named com.apple.nfcd.service.corenfc was invalidated from this process`[¶](#the-connection-to-service-named-comapplenfcdservicecorenfc-was-invalidated-from-this-process "Permanent link")

This error occurs on iOS when the required NFC capability is not added to the app. To fix this, add the `Near Field Communication Tag Reading` capability in Xcode under the `Signing & Capabilities` tab. See [Add a capability to a target](https://help.apple.com/xcode/mac/current/#/dev88ff319e7) for more information.

## Changelog[¶](#changelog "Permanent link")

See [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/nfc/CHANGELOG.md).

## Breaking Changes[¶](#breaking-changes "Permanent link")

See [BREAKING.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/nfc/BREAKING.md).

## License[¶](#license "Permanent link")

See [LICENSE](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/nfc/LICENSE).

May 17, 2026 

 Back to top 