react-native-nfc-rewriter icon indicating copy to clipboard operation
react-native-nfc-rewriter copied to clipboard

Documentation Request.

Open farry19 opened this issue 4 years ago • 2 comments

Can you provide the full documentation of the package, as i have gone through the samples but didn't understand how to write custom tags. e.g. vCard or other. Thanks

farry19 avatar Jun 23 '21 17:06 farry19

Hi @farry19 because this repo is an app, currently we don't have any plan to provide documentation.

Regarding vCard, you can try this code snippet:

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

  const {name, tel, org, email} = value;
  const vCard = `BEGIN:VCARD\nVERSION:2.1\nN:;${name}\nORG: ${org}\nTEL;HOME:${tel}\nEMAIL:${email}\nEND:VCARD`;
  const bytes = Ndef.encodeMessage([
    Ndef.record(Ndef.TNF_MIME_MEDIA, 'text/vcard', [], vCard),
  ]);

  await NfcManager.ndefHandler.writeNdefMessage(bytes);
  NfcManager.cancelTechnologyRequest();
}

Hope that helps!

whitedogg13 avatar Jun 28 '21 13:06 whitedogg13

hi , i want to try this app and clone it , so i have a mifare card, when i try to write a text or mail there is an error pop up like "NFC Error Error: unsupported tag api" why do i get this ? is something wrong about my card?

nurfync avatar Jul 07 '21 13:07 nurfync