PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Operating mode
  • 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
Starts writing data onto a NFC tag.
Remark: The NFC functions cannot be used in the simulator or in the emulator.
Example
// 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)
NFCWriteTag(tag)
IF ErrorOccurred THEN
Error("Failure writing onto the NFC tag.", ErrorInfo())
END
Syntax
<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. For more details about the error, use ErrorInfo.
<Tag>: nfcTag variable
Name of the nfcTag variable describing the data to write.
Remarks

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.
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.
NFCWriteTag 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.
NFCWriteTag 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.
NFCWriteTag 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.
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:
- NFC
- Multimedia control
- Brightness
- Volume
- WIFI
- Bluetooth
- Toast
- Progress Bar control
- 9-image mode
- Compass
- Accelerometer
- Camera control
- LED
- Vibrations
- Notifications
- Drawing functions
- Internet
Component : wd250android.jar
Minimum version required
  • Version 18
Comments
Click [Add] to post a comment