Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

capacitor-nfc-launch

Package Overview
Dependencies
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

capacitor-nfc-launch

Launch the app by a NFC tag and read the data

  • 6.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

npm version capacitor support

capacitor-nfc-launch

This plugin reads the message of a self-written NFC tag. Just tap the device on a NFC tag and you will get the response in the 'message' listener. Your app will also start automatically and trigger the event listener.

Supported platforms

PlatformSupported
Android
iOS
Web

Install

npm i capacitor-nfc-launch
npx cap sync android

AndroidManifest.xml

<intent-filter android:autoVerify="true">
    <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
    <category android:name="android.intent.category.DEFAULT" />
    // The plugin will only fire the event, if a NFC tag with this Content-Type has been sent
    <data android:mimeType="application/APPBUNDLEID" />
</intent-filter>

How to write the tag

Download and open the app NFC Tools. Choose 'write' and add a dataset of the type 'data' (last entry in list). Content-Type: application/APPBUNDLEID Data: 'My example data'

Usage

app.component.ts

import { NFCLaunch } from 'capacitor-nfc-launch';

if (Capacitor.isNativePlatform()) {
  NFCLaunch.addListener('message', (data: any) => {
    console.log(data.message); // Outputs: My example data
  });
}

API

addListener('message', ...)

addListener(eventName: 'message', listenerFunc: MessageListener) => Promise<PluginListenerHandle> & PluginListenerHandle

Add a listener to a NFC message event

ParamType
eventName'message'
listenerFuncMessageListener

Returns: any


removeAllListeners()

removeAllListeners() => any

Removes all listeners.

Returns: any


Interfaces

PluginListenerHandle
PropType
remove() => any

Type Aliases

MessageListener

(response: any): void

Keywords

FAQs

Package last updated on 07 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc