Giter Club home page Giter Club logo

Comments (6)

don avatar don commented on August 26, 2024

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.

Armaldio avatar Armaldio commented on August 26, 2024

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.

Armaldio avatar Armaldio commented on August 26, 2024

Is it possible to get only the payload ?
I'm not able to convert NdefMessage to String.

from ndef.

don avatar don commented on August 26, 2024

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.

don avatar don commented on August 26, 2024

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.

Armaldio avatar Armaldio commented on August 26, 2024

All is working, thank you very much :)

from ndef.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.