All Projects → whitedogg13 → React Native Nfc Manager

whitedogg13 / React Native Nfc Manager

Licence: apache-2.0
React Native NFC module for Android & iOS

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to React Native Nfc Manager

flutter-nfc
Flutter Android plugin for NFC
Stars: ✭ 14 (-97.9%)
Mutual labels:  nfc
Plantain
Android приложение для чтения/записи информации на карты Mifare Classic
Stars: ✭ 14 (-97.9%)
Mutual labels:  nfc
Nfcgate
An NFC research toolkit application for Android
Stars: ✭ 425 (-36.38%)
Mutual labels:  nfc
cie-PN532
Arduino library for SPI and I2C access to the NFC chip in the Italian Electronic Identity Card (CIE)
Stars: ✭ 22 (-96.71%)
Mutual labels:  nfc
nfc attendance system esp32
NFC Attendance System | 智慧校園NFC考勤系統 | 基於ESP32的智慧校園NFC考勤系統控制器
Stars: ✭ 27 (-95.96%)
Mutual labels:  nfc
Tretjapannfcreader
NFC (FeliCa) Reader for iOS 13 Core NFC / 日本の NFC、FeliCa カード向けリーダーライブラリ(iOS 13.0 以降 Core NFC)交通系IC(Suica、PASMO など)、楽天Edy、nanaco、WAON など、運転免許証、マイナンバーカードの読み取り
Stars: ✭ 323 (-51.65%)
Mutual labels:  nfc
HPlayer2
Modular Media Player for Raspberry Pi and more...
Stars: ✭ 28 (-95.81%)
Mutual labels:  nfc
Homepwn
HomePwn - Swiss Army Knife for Pentesting of IoT Devices
Stars: ✭ 526 (-21.26%)
Mutual labels:  nfc
Core-NFC-Example
An example project which demonstrate the usage of iOS 11 Core NFC framework.
Stars: ✭ 19 (-97.16%)
Mutual labels:  nfc
Vsmartcard
umbrella project for emulation of smart card readers or smart cards
Stars: ✭ 404 (-39.52%)
Mutual labels:  nfc
nfc-laboratory
NFC signal and protocol analyzer using SDR receiver
Stars: ✭ 41 (-93.86%)
Mutual labels:  nfc
hydranfc
HydraNFC is an open source NFC (13.56MHz) Shield hardware for researcher, hackers, students, embedded software developers or anyone interested in debugging/hacking/developing/penetration testing NFC hardware.
Stars: ✭ 66 (-90.12%)
Mutual labels:  nfc
Nfcpy
A Python module to read/write NFC tags or communicate with another NFC device.
Stars: ✭ 360 (-46.11%)
Mutual labels:  nfc
NFCReaderWriter
NFCReaderWriter which supports to read data from NFC chips(iOS 11), write data to NFC chips(iOS 13) and read NFC tags infos(iOS 13) by iOS devices. Compatible with both Swift and Objective-C. I will appreciate you if give me a star on the top right of page.
Stars: ✭ 58 (-91.32%)
Mutual labels:  nfc
Nfcpassportreader
NFCPassportReader for iOS 13
Stars: ✭ 458 (-31.44%)
Mutual labels:  nfc
nfcproxy
用两个安卓手机的nfc功能截取iso14443交互数据 fork by https://github.com/nfcproxy/NFCProxy
Stars: ✭ 30 (-95.51%)
Mutual labels:  nfc
Nfc Pcsc
Easy reading and writing NFC tags and cards in Node.js
Stars: ✭ 322 (-51.8%)
Mutual labels:  nfc
Smarthotel360 Mobile
SmartHotel360 Mobile
Stars: ✭ 535 (-19.91%)
Mutual labels:  nfc
Ios Nfc Example
📱 Example showing how to use the Core NFC API in iOS
Stars: ✭ 480 (-28.14%)
Mutual labels:  nfc
Mifareonetool
A GUI Mifare Classic tool on Windows(停工/最新版v1.7.0)
Stars: ✭ 404 (-39.52%)
Mutual labels:  nfc

react-native-nfc-manager

npm version build issues

Bring NFC feature to React Native. Inspired by phonegap-nfc and react-native-ble-manager

Contributions are welcome!

We also have a slack channel, you're welcome to chat with us for any issue or idea! join us here

Install

javascript part

npm i --save react-native-nfc-manager

native part

This library use native-modules, so you will need to do pod install for iOS:

cd ios && pod install && cd ..

For Android, it should be properly auto-linked, so you don't need to do anything.

Setup

Please see here

Demo App

Please see this project: React Native NFC ReWriter App

Latest Changes

v2 to v3 is primarily a refactor, to let long-term maintain easier. During the refactor, there're also several major enhancements:

  • Separate each NFC technology into its own handler, and provide getter from main NfcManager object to access them. This way we can avoid namespace corrupting due to individual tech methods.
  • Provide compatibility layer for common NFC tech handler, such as NfcA or IsoDep, so we don't need to do lots of if/else according to Platform.OS.

Basic Usage

If all you want to do is to read NDEF data, you can use this example:

import NfcManager, {NfcEvents} from 'react-native-nfc-manager';

// Pre-step, call this before any NFC operations
async function initNfc() {
  await NfcManager.start();
}

function readNdef() {
  const cleanUp = () => {
    NfcManager.setEventListener(NfcEvents.DiscoverTag, null);
    NfcManager.setEventListener(NfcEvents.SessionClosed, null);
  };

  return new Promise((resolve) => {
    let tagFound = null;

    NfcManager.setEventListener(NfcEvents.DiscoverTag, (tag) => {
      tagFound = tag;
      resolve(tagFound);
      NfcManager.setAlertMessageIOS('NDEF tag found');
      NfcManager.unregisterTagEvent().catch(() => 0);
    });

    NfcManager.setEventListener(NfcEvents.SessionClosed, () => {
      cleanUp();
      if (!tagFound) {
        resolve();
      }
    });

    NfcManager.registerTagEvent();
  });
}

Anything else, ex: write NDEF, send custom command, please read next section.

Advanced Usage

In high level, there're 3 steps to perform advanced NFC operations:

  1. request your specific NFC technology
  2. select the proper NFC technology handler, which is implemented as getter in main NfcManager object, including:
    • ndefHandler
    • nfcAHandler
    • isoDepHandler
    • iso15693HandlerIOS
    • mifareClassicHandlerAndroid
    • mifareUltralightHandlerAndroid
  3. call specific methods on the NFC technology handler
  4. clean up your tech registration

For example, here's an example to write NDEF:

import NfcManager, {NfcTech, Ndef} from 'react-native-nfc-manager';

// Pre-step, call this before any NFC operations
async function initNfc() {
  await NfcManager.start();
}

async function writeNdef({type, value}) {
  let result = false;

  try {
    // Step 1
    await NfcManager.requestTechnology(NfcTech.Ndef, {
      alertMessage: 'Ready to write some NDEF',
    });

    const bytes = Ndef.encodeMessage([Ndef.textRecord('Hello NFC')]);

    if (bytes) {
      await NfcManager.ndefHandler // Step2
        .writeNdefMessage(bytes); // Step3

      if (Platform.OS === 'ios') {
        await NfcManager.setAlertMessageIOS('Successfully write NDEF');
      }
    }

    result = true;
  } catch (ex) {
    console.warn(ex);
  }

  // Step 4
  NfcManager.cancelTechnologyRequest().catch(() => 0);
  return result;
}

To see more examples, please see React Native NFC ReWriter App

API

Please see here

FAQ

Please see here

Legacy (v1, v2) docs

Please see v2 branch

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].