Comments (6)
It sounds like the Arduino part of your code is working fine. Those 2 NFC records you're seeing are the default records that an Android apps shares via beam. Basically it's a link to the Play store. Normally Android will disable this when you're sharing a NFC record from your app. I think you have a problems with the Cordova app.
Try using this sample project https://github.com/don/nfc-share to get started with phonegap-nfc and sharing tags. If the default code sends a URI correctly, you can modify the code to send a Text Record
Replace https://github.com/don/nfc-share/blob/master/www/js/index.js#L41
nfc.share([ ndef.uriRecord("http://cordova.io") ], success, failure);
with
nfc.share([ ndef.textRecord("Hello Arduino!") ], success, failure);
from ndef.
Hello again.
I just test you code.
it seems to your well with uri record
NDEF Message 1 record, 15 bytes
NDEF Record
TNF 0x1 Well Known
Type Length 0x1 1
Payload Length 0xB 11
Type 55 U
Payload 03 63 6F 72 64 6F 76 61 2E 69 6F .cordova.io
Record is 15 bytes
but when textrecord is occured
NDEF Message 2 records, 108 bytes
NDEF Record
TNF 0x1 Well Known
Type Length 0x1 1
Payload Length 0x45 69
Type 55 U
Payload 03 70 6C 61 79 2E 67 6F 6F 67 6C 65 2E 63 6F 6D 2F 73 74 6F 72 65 2F 61 70 70 73 2F 64 65 74 61 69 6C 73 3F 69 64 3D 6E 6F 74 2E 79 65 74 2E 73 70 65 63 69 66 69 65 64 26 66 65 61 74 75 72 65 3D 62 65 61 6D .play.google.com/store/apps/details?id=not.yet.specified&feature=beam
Record is 73 bytes
NDEF Record
TNF 0x4 External
Type Length 0xF 15
Payload Length 0x11 17
Type 61 6E 64 72 6F 69 64 2E 63 6F 6D 3A 70 6B 67 android.com:pkg
Payload 6E 6F 74 2E 79 65 74 2E 73 70 65 63 69 66 69 65 64 not.yet.specified
Record is 35 bytes
Thank you.
from ndef.
Is it possible to get only the payload ?
I'm not able to convert NdefMessage to String.
from ndef.
Your second example for the text record looks like the default NFC share generated by Android, which likely means that you have an error in your Cordova code. Try running jshint
on index.js.
from ndef.
To get the payload as a String try something like https://github.com/don/NDEF/blob/master/examples/ReadTagExtended/ReadTagExtended.ino#L70
You'll need to do more work if you have non-ascii characters in your string.
from ndef.
All is working, thank you very much :)
from ndef.
Related Issues (20)
- NdefMessage addTextRecord maxing out. HOT 3
- Unable to send message to phone
- How to choose which sector to write to ? And store nice data to a variable ?
- Pn7150
- Error compiling for board Arduino Uno.
- Is the P2P_Receive cord in example works only url record??
- When the text record on tag is longer than 259 bytes then it can't be properly read
- How should be the wiring for Nodemcu?
- Crashing on bad read HOT 1
- MifareClassic.cpp "Read failed" out of memory
- possible nfc.begin timeout?
- payloadAsString doesn't work as expected? HOT 2
- NDEF library in C
- Use a mobile phone instead of a card
- nfc.read timer
- Error. Failed read block 4 In read mode tag
- 1k Mifare Classic write 390 characters
- My progress reading NDEF from an Android phone. Any ideas?
- Sleep mode
- How to set array adapter
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ndef.