Giter VIP home page Giter VIP logo

Comments (5)

whitedogg13 avatar whitedogg13 commented on July 19, 2024

Yes, sorry for the late response!

This library currently only support making tags read-only with ndef write (because normally we freeze a tag after writing some new stuff to it) If it's you use case, you can passing formatReadOnly as true when calling requestNdefWrite API to make it happens, like this:

NfcManager.requestNdefWrite(null, {formatReadOnly: true})
    .then(() => console.log('done!'))
    .catch(err => console.warn(err))

For the case without ndef writing, I can bridge the makeReadOnly API into this library later, and response to this thread when it's done.

Thanks!

from react-native-nfc-manager.

whitedogg13 avatar whitedogg13 commented on July 19, 2024

Hi, I have added a new method makeReadOnly into latest release (0.5.2) which can force this behavior. Here's an example:

NfcManager.registerTagEvent(tag => console.log(tag))
    .then(() => NfcManager.requestTechnology(NfcTech.Ndef))
    .then(() => NfcManager.makeReadOnly())
    .then(result => console.log('makeReadOnly result ', result))

Please use latest release to try it, thanks!

from react-native-nfc-manager.

MatheusNaldi avatar MatheusNaldi commented on July 19, 2024

Hi, sorry for the late response, I was doing other tasks first.

Thanks for your time on this, I will update and test the makeReadOnly function today!

from react-native-nfc-manager.

MatheusNaldi avatar MatheusNaldi commented on July 19, 2024

It worked, thanks!!!

I just have one question, I only work with Ndef tags, is it really required to ask for technology every time? It isn't better to just throw any error and let the application handle it? Or it isn't possible?

But this is not a problem, it's just a question, thanks for solving my problem!

from react-native-nfc-manager.

whitedogg13 avatar whitedogg13 commented on July 19, 2024

Hi @MatheusNaldi , it's good to hear that your app works!
Regarding you question, in Android simply reading NDEF (which used by most users) and write / make readonly are using different APIs, and the later one requires more setup such as casting tag handle to specific tech type. So in short, what you mentioned is possible, but I'd like to keep the way Android provides us for now~

from react-native-nfc-manager.

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.