TOPIC: nfc write usage
11 months 3 weeks ago #1159
I am trying the write function in nfc, but don't know well how it works.
This is my button click event handler.
private void buttonNfcWrite_buttonClick(final Button.ClickEvent event) {
//nfcResult is a XdevLabel

final Record record = Record.textRecord(this.textField.getValue());
this.nfcResult.setValue("begin 2");
NfcService.getInstance().write(success -> {
System.out.println("NFC write success: " + success);
this.nfcResult.setValue("OK " + this.textField.getValue());
}, error -> {
this.nfcResult.setValue("Error " + error.getMessage());
}, record);
this.nfcResult.setValue("post 1");

What I see after clicking the button is the final "post 1" while I was expecting the success or error message.
Have I to use the other nfc functions (StartListening and StopListening) before and after? If yes, how?
Thank you all.
The administrator has disabled public write access.