|
|
|
|
|
- Operating mode
- Required permissions
- Application in the background: Specific case from Android 10
NFCWriteTag (Function) In french: NFCEcritTag Starts writing data to an NFC tag. Note: NFC functions cannot be used in the simulator or emulator.
tag is nfcTag
url is nfcData
url.Type = nfcURI
url.Content = "http://www.pcsoft.com"
Add(tag.Data, url)
NFCWriteTag(tag)
IF ErrorOccurred THEN
Error("Echec de l'écriture sur le tag NFC.", ErrorInfo())
END
tag is nfcTag
url is nfcData
url.Type = nfcURI
url.Content = "http://www.pcsoft.com"
Add(tag.Data, url)
IF NOT NFCWriteTag(tag, EcritureTagNFC) THEN
Error("Echec lors de l'écriture NFC.", ErrorInfo())
END
INTERNAL PROCEDURE EcritureTagNFC(nRésultatNFC is int)
IF nRésultatNFC <> nfcOK THEN
Trace("Un problème est survenu")
END
END
Syntax <Result>: Integer - 1 if the writing was successful,
- otherwise, one of the following constants:
| | nfcErrDetection | The NFC tag has exited from the detection control during the write process. | nfcErrDisabled | NFC is not enabled on the device. | nfcErrEmulator | Function called from the emulator. | nfcErrFormat | The format of the data to write is invalid. | nfcErrMaxSize | The size of the data to write exceeds the maximum size of data that can be stored on the NFC tag. | nfcErrNDEF | The NFC tag cannot be formatted to the NDEF format (NFC Data Exchange Format). | nfcErrProtection | The NFC tag cannot be protected in write mode (mode not supported by the tag). | nfcErrReadOnly | The NFC tag is protected in write mode. | nfcErrUnknown | Unknown error. |
If an error occurs, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<Tag>: nfcTag variable Name of the nfcTag variable describing the data to write.
Writing a tag in non-blocking mode Hide the details
<Result> = NFCWriteTag(<Tag> , <WLanguage procedure>)
<Result>: Boolean - True if the writing was started,
- False otherwise.
<Tag>: nfcTag variable Name of the nfcTag variable describing the data to write. <WLanguage procedure>: Procedure name Name of the WLanguage procedure ("callback") called when writing data to the tag. This procedure is used to determine whether or not the data could be written to the tag. This procedure has the following format: PROCEDURE <Procedure name>(<Result>) where <Result> is the result of the writing operation: - 1 if data was successfully written to the tag,
- otherwise, one of the following constants:
| | nfcErrCancellation | The action was canceled by the user. | nfcErrDetection | The NFC tag has exited from the detection control during the write process. | nfcErrDisabled | NFC is not enabled on the device. | nfcErrEmulator | Function called from the emulator. | nfcErrFormat | The format of the data to write is invalid. | nfcErrMaxSize | The size of the data to write exceeds the maximum size of data that can be stored on the NFC tag. | nfcErrNDEF | The NFC tag cannot be formatted to the NDEF format (NFC Data Exchange Format). | nfcErrProtection | The NFC tag cannot be protected in write mode (mode not supported by the tag). | nfcErrReadOnly | The NFC tag is protected in write mode. | nfcErrUnavailable | The NFC sensor does not exist or is not available. | nfcErrUnknown | Unknown error. | nfcOK | The operation was completed. |
Remarks Operating mode The call to NFCWriteTag automatically opens a window to prompt users to hold their devices closer to the NFC tag to which they want to write. This window will be automatically closed: - at the end of the write operation,
- if the user cancels the operation by pressing the Back key of the device.
Note: To personalize the message displayed in this window, use the NextTitle function before calling the NFCWriteTagfunction. . A vibration is triggered when the device detects the NFC tag. The device must be located near the NFC tag during the entire display of the capture window otherwise the write process will be interrupted. Required permissions This function changes the permissions required by the application. Required permissions: - NFC: Enables applications to perform input/output operations using NFC technology.
- VIBRATE: Accesses the vibrate function.
Related Examples:
|
Cross-platform examples (WINDEV Mobile): WM System
[ + ] This application is an example of some of the features of WINDEV Mobile available for Android/iOS. The following system functions are used: - NFC - Multimedia control - Brightness - Volume - Wi-Fi - Bluetooth - Toast - Compass - Accelerometer - Camera control - LED - Vibration - Notifications - Drawing functions - Internet
|
Business / UI classification: Business Logic Component: wd300android.aar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|