Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
nfc-ndef-react-native
Advanced tools
Readme
nfc-ndef-react-native is a react-native module for android to write/read tags that support the NDEF format (tested on Mifare Classic). This is a fork of Lube's nfc-react-native. It only writes strings to the ndef records. So you can write and read essentially an array of strings to your card. With some minor tweaking to the Java, you could make it support other data types as well.
$ git clone https://github.com/observ3r/nfc-ndef-react-native
$ cd nfc-ndef-react-native/example
$ npm install
$ react-native run-android
$ npm install nfc-ndef-react-native --save
After running this command, go through the Configuration section:
$ react-native link nfc-ndef-react-native
If it doesn't work for any reason, follow the manual installation AND the configuration section.
android/app/src/main/java/[...]/MainApplication.java
import es.tiarg.nfcndefreactnative.NfcNdefReactNativePackage;
to the imports at the top of the filenew NfcNdefReactNativePackage()
to the list returned by the getPackages()
methodandroid/settings.gradle
:
include ':nfc-ndef-react-native'
project(':nfc-ndef-react-native').projectDir = new File(rootProject.projectDir, '../node_modules/nfc-ndef-react-native/android')
android/app/build.gradle
:
compile project(':nfc-ndef-react-native')
Take a look at the example.
In your manifest add:
<uses-permission android:name="android.permission.NFC" />
....
Your main activity should look something like this:
...
<activity
android:name=".MainActivity"
android:launchMode="singleTask"
android:label="@string/app_name"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.nfc.action.NDEF_DISCOVERED"/>
<category android:name="android.intent.category.DEFAULT"/>
<data android:mimeType="text/plain" />
<action android:name="android.nfc.action.TECH_DISCOVERED"/>
</intent-filter>
<meta-data android:name="android.nfc.action.TECH_DISCOVERED"
android:resource="@xml/nfc_tech_filter" />
</activity>
Add android/app/src/main/res/xml/nfc_tech_filter.xml (create directories that don't exist) with the following:
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<tech-list>
<tech>android.nfc.tech.Ndef</tech>
<tech>android.nfc.tech.NdefFormatable</tech>
</tech-list>
</resources>
Please feel free to contribute in anyway!
This repository is distributed under MIT license
FAQs
NFC Wrapper using the NDEF format. Built from Lube's nfc-react-native.
The npm package nfc-ndef-react-native receives a total of 2 weekly downloads. As such, nfc-ndef-react-native popularity was classified as not popular.
We found that nfc-ndef-react-native demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.