PC SOFT

ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Home | Sign in | English EN
This content has been translated automatically. Click here to view the French version.
  • Operating mode
  • Required permissions
  • Application in the background: Specific case from Android 10
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.
Versions 26 and later
iPhone/iPad This function is now available for iPhone/iPad applications.
New in version 26
iPhone/iPad This function is now available for iPhone/iPad applications.
iPhone/iPad This function is now available for iPhone/iPad applications.
Example
// Ecrit une url dans un tag NFC (mode bloquant)
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("Echec de l’écriture sur le tag NFC.", ErrorInfo())
END
Versions 26 and later
// Ecrit une url dans un tag NFC (mode non bloquant)
tag is nfcTag
url is nfcData
url.Type = nfcURI
url.Content = "http://www.pcsoft.com"
Add(tag.Data, url)
IF NOT NFCWriteTag(tag, EcritureTagNFC) THEN
Error("Echec lors de l'écriture NFC.", ErrorInfo())
END
 
 
INTERNAL PROCÉDURE EcritureTagNFC(nRésultatNFC is int)
IF nRésultatNFC <> nfcOK THEN
Trace("Un problème est survenu")
END
END
New in version 26
// Ecrit une url dans un tag NFC (mode non bloquant)
tag is nfcTag
url is nfcData
url.Type = nfcURI
url.Content = "http://www.pcsoft.com"
Add(tag.Data, url)
IF NOT NFCWriteTag(tag, EcritureTagNFC) THEN
Error("Echec lors de l'écriture NFC.", ErrorInfo())
END
 
 
INTERNAL PROCÉDURE EcritureTagNFC(nRésultatNFC is int)
IF nRésultatNFC <> nfcOK THEN
Trace("Un problème est survenu")
END
END
// Ecrit une url dans un tag NFC (mode non bloquant)
tag is nfcTag
url is nfcData
url.Type = nfcURI
url.Content = "http://www.pcsoft.com"
Add(tag.Data, url)
IF NOT NFCWriteTag(tag, EcritureTagNFC) THEN
Error("Echec lors de l'écriture NFC.", ErrorInfo())
END
 
 
INTERNAL PROCÉDURE EcritureTagNFC(nRésultatNFC is int)
IF nRésultatNFC <> nfcOK THEN
Trace("Un problème est survenu")
END
END
Syntax

Write a tag in blocking mode Hide the details

<Result> = NFCWriteTag(<Tag>)
<Result>: entier
  • 1 if the set 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 occurs. To get the details of the error, use ErrorInfo.
<Tag>: nfcTag variable
Name of the nfcTag variable describing the data to write.
Versions 26 and later

Write a tag in non-blocking mode Hide the details

<Result> = NFCWriteTag(<Tag> , <WLanguage procedure>)
<Result>: Boolean
  • True if set has been started,
  • False otherwise.
<Tag>: nfcTag variable
Name of the nfcTag variable describing the data to write.
<WLanguage procedure>: Procedure name
Name of the Procedure WLanguage (also called "callback") called during set. This Procedure makes it possible to know if the set has been carried out or if it has failed.. This procedure has the following format :
PROCEDURE <Nom de la procédure>(<Résultat>)
where <Result> corresponds to the set result :
  • 1 if the set was successful,
  • otherwise, one of the following constants:
    Versions 26 and later
    nfcErrCancellation
    New in version 26
    nfcErrCancellation
    nfcErrCancellation
    The action was canceled by the user.
    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.
    Versions 26 and later
    nfcErrUnavailable
    New in version 26
    nfcErrUnavailable
    nfcErrUnavailable
    The NFC sensor does not exist or is unavailable.
    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.
    Versions 26 and later
    nfcOK
    New in version 26
    nfcOK
    nfcOK
    The operation was carried out.
New in version 26

Write a tag in non-blocking mode Hide the details

<Result> = NFCWriteTag(<Tag> , <WLanguage procedure>)
<Result>: Boolean
  • True if set has been started,
  • False otherwise.
<Tag>: nfcTag variable
Name of the nfcTag variable describing the data to write.
<WLanguage procedure>: Procedure name
Name of the Procedure WLanguage (also called "callback") called during set. This Procedure makes it possible to know if the set has been carried out or if it has failed.. This procedure has the following format :
PROCEDURE <Nom de la procédure>(<Résultat>)
where <Result> corresponds to the set result :
  • 1 if the set was successful,
  • otherwise, one of the following constants:
    Versions 26 and later
    nfcErrCancellation
    New in version 26
    nfcErrCancellation
    nfcErrCancellation
    The action was canceled by the user.
    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.
    Versions 26 and later
    nfcErrUnavailable
    New in version 26
    nfcErrUnavailable
    nfcErrUnavailable
    The NFC sensor does not exist or is unavailable.
    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.
    Versions 26 and later
    nfcOK
    New in version 26
    nfcOK
    nfcOK
    The operation was carried out.

Write a tag in non-blocking mode Hide the details

<Result> = NFCWriteTag(<Tag> , <WLanguage procedure>)
<Result>: Boolean
  • True if set has been started,
  • False otherwise.
<Tag>: nfcTag variable
Name of the nfcTag variable describing the data to write.
<WLanguage procedure>: Procedure name
Name of the Procedure WLanguage (also called "callback") called during set. This Procedure makes it possible to know if the set has been carried out or if it has failed.. This procedure has the following format :
PROCEDURE <Nom de la procédure>(<Résultat>)
where <Result> corresponds to the set result :
  • 1 if the set was successful,
  • otherwise, one of the following constants:
    Versions 26 and later
    nfcErrCancellation
    New in version 26
    nfcErrCancellation
    nfcErrCancellation
    The action was canceled by the user.
    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.
    Versions 26 and later
    nfcErrUnavailable
    New in version 26
    nfcErrUnavailable
    nfcErrUnavailable
    The NFC sensor does not exist or is unavailable.
    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.
    Versions 26 and later
    nfcOK
    New in version 26
    nfcOK
    nfcOK
    The operation was carried out.
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: Specific case from Android 10

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). 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.
New in version 25
Android

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.
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). 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.
Android

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.
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). 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.
Related Examples:
WM_System 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: wd260android.aar
Minimum version required
  • Version 18
Comments
Click [Add] to post a comment