Home | Sign in | English UK
  • Operating mode
  • Required permissions
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Stored procedures
Starts writing data onto a NFC tag.
  • The NFC functions cannot be used in the simulator or in the emulator.
  • |The NFC functions are available for the devices running Android version 2.3.3 or later (api level 10).
    A fatal error occurs if the function is used with an earlier system version.
    Reminder: To find out the version of Android system on which the application is run, use SysAndroidVersion.
Remark: The NFC functions cannot be used in the simulator or in the emulator.
// Write a url into an NFC tag
tag is nfcTag
url is nfcData
url..Type = nfcURI
url..Content = "http://www.pcsoft.com"
Add(tag..Data, url)
IF ErrorOccurred THEN
Error("Failure writing onto the NFC tag.", ErrorInfo())
<Result> = NFCWriteTag(<Tag>)
<Result>: Integer
  • 1 if the writing was successful,
  • otherwise, one of the following constants:
    nfcErrDisabledThe NFC is not enabled on the device.
    nfcErrDetectionThe NFC tag has exited from the detection control during the write process.
    nfcErrEmulatorFunction called from the emulator.
    nfcErrFormatThe format of the data to write is invalid.
    nfcErrUnknownUnknown error.
    nfcErrReadOnlyThe NFC tag is protected in write mode.
    nfcErrNDEFThe NFC tag cannot be formatted to the NDEF format (NFC Data Exchange Format).
    nfcErrProtectionThe NFC tag cannot be protected in write mode (mode not supported by the tag).
    nfcErrMaxSizeThe size of the data to write exceeds the maximum size of data that can be stored on the NFC tag.

    The ErrorOccurred variable is set to True if an error occurred. To find out the error details, use ErrorInfo.
<Tag>: nfcTag variable
Name of the nfcTag variable describing the data to write.

Operating mode

The call to NFCWriteTag automatically opens a window asking the user to move his device near the NFC tag into which he wants 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:
Android System Android (WINDEV Mobile): Android System
[ + ] This application is a tutorial example presenting some of the new features of WINDEV Mobile for Android.
The following system functions are used:
- Multimedia control
- Brightness
- Volume
- Bluetooth
- Toast
- Progress Bar control
- 9-image mode
- Compass
- Accelerometer
- Camera control
- Vibrations
- Notifications
- Drawing functions
- Internet
Component : wd250android.jar
Minimum version required
  • Version 18
Click [Add] to post a comment