Home | Sign in | English EN
  • Operating mode
  • Reading the NFC sent
  • Required permissions
  • Application in the background: Specific case from Android 10
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WindowsLinuxPHPWEBDEV - Browser code
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Stored procedures
Sends an NFC tag to another device.
Remark: The NFC functions cannot be used in the simulator or in the emulator.
// Sends an URL to another device
tag is nfcTag
url is nfcData
url.Type = nfcURI
url.Content = "www.pcsoft.com"
Add(tag.Data, url)
IF NFCSendTag(tag) = False THEN
Error("Unable to write NFC tag.", ErrorInfo())
<Result> = NFCSendTag(<Tag>)
<Result>: Boolean
  • True if the sending was performed,
  • False otherwise. 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 that describes the data to be sent.

Operating mode

  • The NFC tags are sent by the Android Beam feature of the device. This feature must be enabled on the transmitter device and on the receiver device.
    The Android Beam feature is enabled in the window for configuring the wireless communications.
  • The call to NFCSendTag automatically opens a window to prompt the users to hold their devices closer to another NFC-enabled device. This window will be automatically closed:
    • when the sending is over,
    • if the user cancels the sending by pressing the Back key of the device.
      Remark: To customize the message displayed in this window, use NextTitle before the call to NFCSendTag.
  • On the destination device, the tag sent can be read like a standard NFC tag:
    • by an application developed with WINDEV Mobile by using NFCReadTag,
    • by a compatible external application.

Reading the NFC sent

For a device to read the NFC tag sent by NFCSendTag, it must support:
  • the NDEF Push Protocol (com.android.npp),
  • the SNEP protocol (Simple NDEF Exchange Protocol).
If it is running version 4.0 or later, it must support the two protocols.

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.

Application in the background: Specific case from Android 10

From Android 10, it is no longer possible to open a window when the application is in the background.
NFCSendTag can open a window. If this function is used while the application is in the background, a fatal error will occur.
  • It is possible to determine if the application is in the background using InBackgroundMode.
  • If an application needs to interact with the user while it is in the background, the solution is to display a notification (via the Notification type). The application will be brought back to the foreground when the notification is clicked, if the ActivateApplication property is set to True. You can also open a window from the procedure passed to the ActionClick property.
Component: wd270android.jar
Minimum version required
  • Version 18
Click [Add] to post a comment