Set up NFC Manager as a plugin in app.json Expo eas build to write Ndef

See original GitHub issue

Hi there!

I try to develop my own IOS NFC app for my access control system.

Expo Completed the NFC integration in development Clients. EXPO NFC LINK The problem is that I’m not able to write Ndef messages to tags. With NFC Tools which an App in Appstore I’m able to write Ndef messages, therefore I think I have to add some permissions to my app, but I don’t know how to do that. I have this in app.json

"plugins": [
      [
        "react-native-nfc-manager",
      ]
    ]

Should I do something more in here to be able to write Ndef messages? When I try to write Ndef Messages the program never reaches

console.log(“--------------------------------------------”);

_testNdef = async () => {
      //WritePayload("uniqueId");
      //writeNdef('Hello');
    let result = false;

  try {
    
    // Step 1
    console.log("**********************************************");
    /*await NfcManager.requestTechnology(NfcTech.Ndef, {
      alertMessage: 'Ready to write some NDEF',
    });*/
    await NfcManager.requestTechnology(NfcTech.Ndef);
    console.log("--------------------------------------------");
    let bytes = Ndef.encodeMessage([Ndef.textRecord('Hello NFC')]);
    await NfcManager.ndefHandler.writeNdefMessage(bytes);
    /*if (bytes) {
      await NfcManager.ndefHandler // Step2
        .writeNdefMessage(bytes); // Step3

      if (Platform.OS === 'ios') {
        await NfcManager.setAlertMessageIOS('Successfully write NDEF');
      }
    }*/

    result = true;
  } catch (ex) {
    console.warn(ex);
  }finally{
    NfcManager.cancelTechnologyRequest();
  }

  // Step 4
  NfcManager.cancelTechnologyRequest().catch(() => 0);
  return result;

  }

Thank you in advance!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
EvanBaconcommented, Sep 15, 2021

@freeridre sorry I didn’t see this issue until now, the problem seems to have been resolved in https://github.com/revtel/react-native-nfc-manager/pull/414 sorry for the confusion.

2reactions
whitedogg13commented, Jul 29, 2021

@freeridre thanks for spotting this, I will check it out~

Read more comments on GitHub >

github_iconTop Results From Across the Web

NFC | Voters - Expo - Canny
The package has a config plugin built-in, so setup is pretty easy! ... react-native-nfc-manager. to the. expo.plugins. array in your. app.json . Build...
Read more >
Config Plugins - Expo Documentation
Plugins are functions that can change values on your Expo config. Plugins are mostly meant to be used with npx expo prebuild or...
Read more >
Configuring EAS Build with eas.json - Expo Documentation
eas.json is the configuration file for EAS CLI and services. ... To do this, use the following configuration for development profile:
Read more >
app.json / app.config.js - Expo Documentation
Expo is an open-source platform for making universal native apps for Android, iOS, and the web with JavaScript and React.
Read more >
Configuring EAS Submit with eas.json - Expo Documentation
Expo is an open-source platform for making universal native apps for Android, iOS, and the web with JavaScript and React.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found