react-native-nfc | scan NFC tags and read the NDEF records | DevOps library
kandi X-RAY | react-native-nfc Summary
kandi X-RAY | react-native-nfc Summary
This project has the goal of making it easy (or easier) to scan NFC tags and read the NDEF records they contain.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Called when a restart is suspended
- Process tag
- Process an array of NDEF messages
- Handles incoming NDEF messages
- Parse an array of NDEF messages
- Parse a text record
- Converts a NDEF message into an array of records
- Parse a MIME record
- Clone a WritableArray
- Clone a ReadableArray
- Clone a ReadableMap
- Requests that the NFC data has been acquired
- Clone a WritableMap
- Parse a tag
- Converts a byte array into a hexadecimal string
- Create native modules
- Handle a new intent
- Create a list of JavaScript modules
- Create view managers
react-native-nfc Key Features
react-native-nfc Examples and Code Snippets
Community Discussions
Trending Discussions on react-native-nfc
QUESTION
I’m writing a React Native application which has to communicate with NFC MiFare Ultralight tags. I have NXP NTAG I2C PLUS ISO14443-3 tags.
I’m using the react-native-nfc-manager library for this. On android I didn’t notice any problems just on the iOS side. I’m testing on iOS 13 and 14 and my device is an iPhone 7.
I am able to find and connect to NFC Mifare Ultralight tags (can read and write them too), but in the 75% of the situations I get the following error during the communications:
ANSWER
Answered 2021-Feb-18 at 07:40At the end I managed to try out our app on multiple iPhones and the NFC worked properly. We also found out that our test device is a refurbished unit and we think that maybe that is the problem's cause.
QUESTION
Version 2 of react-native-nfc-manager is supposed to support disabling the scan sound (https://github.com/whitedogg13/react-native-nfc-manager/issues/60#issuecomment-464352677), however it doesn't seem to work.
This is the call:
...ANSWER
Answered 2020-Jul-11 at 22:38Update:
Impossible for ios, and supposed to work for android (it does work natively)
That undocumented Flag is very specific to the undocumented in this library Advanced Android Native direct enableReaderMode
API usage.
The iOS NFC API's and the basic older Android API's have no control over the sounds made by the platform on Tag detection.
Additional Android Specific
And looking at the code for Android https://github.com/whitedogg13/react-native-nfc-manager/blob/master/android/src/main/java/community/revteltech/nfc/NfcManager.java
The following seems to be reported to partially work (I note that it sets other advanced options that mean it probably would only detect a tag once every 10 seconds)
QUESTION
I am trying to emulate an NDEF message (NFC Forum Type 4 Tag) using ReactNative. I could not find any working source code or module to achieve this. The only working application is from Maxsoft.bg named NFC NDEF Tag Emulator which is not open source.
So far I've used react-native-nfc-manager
and react-native-nfc-hce
, but I couldn't make it work.
I also checked the android documentation but I couldn't find a working example/sourcecode there as well.
I found it really strange that I couldn't find even one working source code! So, it would be great if you could help me with a working ReactNative or Android source code.
...ANSWER
Answered 2020-Jul-13 at 20:09NDEF Message with HCE Android should provide you with the answer for Native Java for Android, the best answer also has linked a github repo with source code demo.
QUESTION
I have ntag213. I'm trying to understand how work blocks, sections of memory of my tag. I found project https://github.com/lepunk/react-native-nfc-demo/blob/master/RNNFCDemo/App.js but cannot understand what is agruments for transceive method:
...ANSWER
Answered 2020-May-19 at 11:40You need to read Section 10 of the datasheet for the card e.g. https://www.nxp.com/docs/en/data-sheet/NTAG213_215_216.pdf
Basically with the write command (the 0xA2
first byte of the array), then you need to give it the block address, in first command this is block 4 and then block 5 (note block 4 is the first one you can write to) and then the next 4 bytes of data (as you can only write one 4 byte block at once).
So basically the commands are
[Write Command, Block Address, Data1 Byte, Data2 Byte, Data3 Byte, Data4 Byte]
So overall that code is encoding some text in a custom format to the card. Blocks 4 and 5 are header blocks for the custom format, then it writes the text in 4 byte chucks to blocks 6 onwards all with no checking that each write was a success (other than logging the response)
Update: to answer question
for
QUESTION
this is my very first post so please be gentle. I am mostly looking for Information that could lead me to a good library or a document that could help me out with what im trying to achieve. So far I tried using this library that I found on github to add nfc functionality to my app, which works great with cards and tags but I have no idea how to make it communicate with my pi reader.
Any help would be much appreciated. Thanks in advance!
...ANSWER
Answered 2020-Mar-26 at 22:12I don't know about React-Native library but you can access the underlying Android API's so here is a pointer using the Android API's
But some background first, normally in NFC there is a reading device and a NFC Card. The Reader initialise the NFC comms and the card responds. BUT there is the option of device to device (peer to peer) comms, this uses different underlying comm protocols than device to card
The right hand column of the image below describes it well
The Peer to Peer method is called Android Beam and unfortunately been depreciated in favour of Bluetooth/Wifi Direct and is not available in Android 10 and above.
Documentation for Android Beam is https://developer.android.com/guide/topics/connectivity/nfc/nfc#p2p
and
BUT
there is another more complicated option, it is possible for an Android Device to Emulate a NFC card, this is called Host Card Emulation (HCE), this is probably possible to do on the Raspberry Pi as well.
Therefore one device pretends to be a NFC Card and the other device reads/writes to it as a Card.
With HCE you can emulate a Standard Type 4 Tag and then read/write NDEF messages, the answer here https://stackoverflow.com/a/60813707/2373819 goes in to more detail about how to do this.
QUESTION
I recently upgraded (painfully) from react-native 0.59.10 to 0.61.2 and when I build and run thru Xcode 11 the splash screen loads but then errors show up in the console and the app doesn't load.
I've tried:
cd ios && rm -rf Pods && pod cache clean --all && pod install && cd ..
react-native bundle --entry-file index.js --platform ios --dev false --bundle-output ios/main.jsbundle --assets-dest ios
and done another clean install of react-native but to no avail.
package.json
...ANSWER
Answered 2019-Oct-16 at 21:43Fixed my issue. Was missing dependencies from the upgrade that didn't add to Podfile automatically. For reference, in my case it was:
QUESTION
FAILURE: Build failed with an exception.
- What went wrong:
Execution failed for task
':app:transformClassesAndResourcesWithProguardForDebug'
.java.io.IOException: Can't write [/home/user/Desktop/pratap/react-projects/test/android/app/build/intermediates/transforms/proguard/debug/0.jar] (Can't read [/root/.gradle/caches/transforms-2/files-2.1/25cd9e2eed8b822cb2ad78849b3b28bf/jars/classes.jar(;;;;;;;**.class)] (Duplicate jar entry [android/support/v4/app/INotificationSideChannel$Stub$Proxy.class]))
I'm running react-native run-android
command to run the app and getting above error I don't know what's going on with java.io.IOException
I have tried:
- remove android > build folder and run again
- run cd android && gradlew clean and then cd .. && react-native run-android
- remove node_modules folder and reinstall it by npm install
GRADLE -
...ANSWER
Answered 2019-Jul-25 at 07:11You may try running 'jetifier' to migrate libraries to AndroidX if that is the case.(if there are native dependencies using AndroidX.)
- npm install --save-dev jetifier
- npx jetify
- npx react-native run-android
QUESTION
I am trying to read from a Bloodsugar Meter using NFC, right now on an Android, haven't tried iOS yet (don't have a phone with NFC).
I am using react-native-nfc-manager as library and the example that comes with it: https://github.com/whitedogg13/react-native-nfc-manager
I am receiving this tag:
...ANSWER
Answered 2019-Jan-14 at 10:16Since your tag does not contain Ndef
in its techTypes
list, it does not contain an NDEF message. Consequently, you won't be able to read any such message. As your "tag" is a blood sugar meter, I assume that it's not even expected to contain an NDEF message.
Instead, you will have to find out what commands the blood sugar meter actually supports (probably it will support the ISO/IEC 15693 READ SINGLE BLOCK command (see here). In order to send such low-level commands, you will need to use the Generic NfcTech API by requesting the tag technology:
QUESTION
Currently using React Native and attempting to use react-native-nfc-ios and react-native-nfc so I can have cross-device communication between ios and Android. I'm finding that they cannot communicate, however I think it's due to a broader issue (as other existing apps also don't work).
If I download a NFC reader app on iPhone 7, and an NFC writer app on Android they cannot communicate. Why is this?
Instructions to Duplicate
- Turn on NFC Reader on iPhone 7
- Put some arbitrary data in NFC write mode on Android
- Bringing devices together has no effect.
Not understanding the intricacies of NFC, it's hard for me as a casual programmer to understand what the actual problem is.
I understand that IOS11 on iPhone 7 (plus) supports NFC read, and generally speaking there are card emulation, peer to peer, and read write modes.
- Should they not communicate? The iPhone is not able to pick up the Android writer. Why is this?
- How does card emulation (I assume to be Apple Pay), differ from a write mode?
ANSWER
Answered 2018-Mar-06 at 22:55The reason is because Apple's iOS 11 update only allows reading from NFC tags (writing is only permitted for Apple Pay). At the moment, their software does not share the same enjoyment afforded by Android phones which enable card emulation, peer-to-peer, and reader/writer NFC usage. So our only hope is to wait for a software update that will finally enable this existing feature for developers to use.
QUESTION
I started getting this error when I run react-native run-android
.
What went wrong: Could not resolve all files for configuration ':app:debugCompileClasspath'.
Could not find play-services-basement.aar (com.google.android.gms:play-services-basement:15.0.1). Searched in the following locations: https://jcenter.bintray.com/com/google/android/gms/play-services-basement/15.0.1/play-services-basement-15.0.1.aar Could not find play-services-measurement-base.aar (com.google.android.gms:play-services-measurement-base:15.0.2).
Searched in the following locations: https://jcenter.bintray.com/com/google/android/gms/play-services-measurement-base/15.0.2/play-services-measurement-base-15.0.2.aar
- Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
I'm kinda clueless about what to do, I tried adding
...ANSWER
Answered 2018-Oct-25 at 06:30Adding google() before jcenter() in bulild.gradle as mentioned in below site fixed my issue.
https://www.developerfaqs.com/4120/android-gradle-failed-to-resolve-play-services-basement
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install react-native-nfc
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page