PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Operating mode
  • Reading the NFC sent
  • Required permissions
  • Application in the background: Android 10 specific case
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Sends a NFC tag to another device.
Remark: The NFC functions cannot be used in the simulator or in the emulator.
Example
// 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("Failure writing onto the NFC tag.", ErrorInfo())
END
Syntax
<Result> = NFCSendTag(<Tag>)
<Result>: Boolean
  • True if the sending was performed,
  • False otherwise. The ErrorOccurred variable is set to True if an error occurs. To find out the error details, use ErrorInfo.
<Tag>: nfcTag variable
Name of the nfcTag variable describing the data to send.
Remarks

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 asking the user to move his device near another device compatible with NFC. 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

In order 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.
Versions 25 and later
Android

Application in the background: Android 10 specific case

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.
Tips:
  • 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). When the notification is clicked on, the application will be brought back to the foreground if ..ActivateApplication is set to True. It is also possible to open a window from the procedure passed to ..ActionClick.
New in version 25
Android

Application in the background: Android 10 specific case

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.
Tips:
  • 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). When the notification is clicked on, the application will be brought back to the foreground if ..ActivateApplication is set to True. It is also possible to open a window from the procedure passed to ..ActionClick.
Android

Application in the background: Android 10 specific case

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.
Tips:
  • 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). When the notification is clicked on, the application will be brought back to the foreground if ..ActivateApplication is set to True. It is also possible to open a window from the procedure passed to ..ActionClick.
Component : wd250android.jar
Minimum version required
  • Version 18
Comments
Click [Add] to post a comment