|
|
|
|
- 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. Remark: The NFC functions cannot be used in the simulator or in the emulator.
// Write URL to NFC tag (blocking mode) 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("Unable to write NFC tag.", ErrorInfo()) END
// Write URL to NFC tag (non-blocking mode) tag is nfcTag url is nfcData url.Type = nfcURI url.Content = "http://www.pcsoft.com" Add(tag.Data, url) IF NOT NFCWriteTag(tag, WriteNFCTag) THEN Error("Unable to write NFC tag.", ErrorInfo()) END INTERNAL PROCEDURE WriteNFCTag(nNFCResult is int) IF nNFCResult <> nfcOK THEN Trace("A problem occurred") 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.
Remark: To customize the message displayed in this window, use NextTitle before the call to NFCWriteTag. 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 The call to this function modifies the permissions required by the application. Required permissions: - NFC: Allows the applications to perform input/output operations via the NFC technology.
- VIBRATE: Used to access the sensor feature.
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: wd290android.aar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|