Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DATA gets cleared while doing write operation on NFC TAG #50

Open
pruthvirajkarurcodewave opened this issue Jan 3, 2023 · 0 comments
Open

Comments

@pruthvirajkarurcodewave
Copy link

pruthvirajkarurcodewave commented Jan 3, 2023

Hi Team,

Data in the NFC is getting erased. Our product is already live and erase issues are coming which is very alarming for the business.
Please help us out in resolving in this issue.

I am using the following code for writing please suggest.

`
const writeTestFinal = async text => {

var result = false;

let type = 'TEXT';

try {

  var value = 'test data to write';

  await NfcManager.requestTechnology(NfcTech.Ndef, {
    alertMessage: 'Ready to write some NDEF',
  });

  let bytes = null;
  if (type === 'TEXT') {
    bytes = Ndef.encodeMessage([Ndef.textRecord(value)]);
  } else if (type === 'URI') {
    bytes = Ndef.encodeMessage([Ndef.uriRecord(value)]);
  }

  if (bytes) {
    await NfcManager.ndefHandler.writeNdefMessage(bytes);

    result = true;
  }
} catch (ex) {
  console.warn('ERROR IN WRITETESTFINAL : ', ex);
} finally {
  NfcManager.cancelTechnologyRequest();
}

return result;

};`
Happy flow works: If the users just taps just once then the data write successfully.

Real world scenario: If the user tries to move the nfc fast to make the transfer fast and moves the nfc in a circular format attached to the device then the NFC tag is getting cleared after this line await NfcManager.ndefHandler.writeNdefMessage(bytes);
I tried with the existing application from the playstore /appstore NFC Rewriter in that app also i am getting this issue of data clearance . Please suggest how to resolve this.

Debug info:

"react-native-nfc-manager": "^3.14.2", "react-native": "0.68.1",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant