|
|
|
|
|
- Use in blocking mode (Syntax 1)
- Use in non-blocking mode (Syntax 2)
- Other notes
- Required permissions
- AppID required
- Application in the background: Specific case from Android 10
NFCReadTag (Function) In french: NFCLitTag Starts reading an NFC tag or enables the detection of NFC tags for the current window.
tag is nfcTag
tag = NFCReadTag()
IF NOT ErrorOccurred THEN
Info(StringBuild("Lecture d'un tag NFC de type %1", tag.Type))
FOR EACH donnée OF tag.Data
SWITCH donnée.Type
CASE nfcText
Info(donnée.Contenu)
CASE nfcURI
IF StringStartsWith(donnée.Contenu, "http") THEN
BrowserRunApp(donnée.Contenu)
END
CASE nfcMedia
IF donnée.TypeMIME ~= "image/png" THEN
fSaveBuffer(CompleteDir(SysDirStorageCard()) + "image.png", donnée.Contenu)
END
END
END
END
IF NOT NFCReadTag(LectureTagNFC) THEN
Error("Echec du lancement de la détection NFC.", ErrorInfo())
END
INTERNAL PROCEDURE LectureTagNFC(tag is nfcTag)
Info(StringBuild("Tag NFC de type %1 détecté.", tag.Type))
RETURN True
END
Syntax
Reading an NFC tag in non-locking mode Hide the details
<Result> = NFCReadTag(<WLanguage procedure>)
<Result>: Boolean - True if the detection of NFC tags was triggered,
- False otherwise. If an error occurs, the ErrorOccurred variable is set to True. To get more details on the error, use ErrorInfo.
<WLanguage procedure>: Procedure name Name of the WLanguage procedure ("callback") called when an NFC tag was read. This procedure has the following format: PROCEDURE <Procedure Name> (<Tag>) where <Tag> is a nfcTag variable containing the information read in the NFC tag. Remarks: - The parameters of this procedure are optional. There is no need to pass parameters to this procedure. Indeed, these parameters are automatically filled during each call.
- If the procedure returns True, the detection of NFC tags will be automatically stopped after the reading.
- If the procedure returns False or if it returns no value, the detection will remain active as long as the window in which the procedure was triggered is not closed.
Remarks Use in non-blocking mode (Syntax 2) The call to NFCReadTag starts detecting the NFC tags for the current window at the time of the call. The detection will be active when this window is displayed in the foreground of the application. When the window is closed, the detection is stopped and will have to be restarted by calling NFCReadTag. A fatal error will occur if there is no current window when NFCReadTag is called. Other notes - The NFC functions cannot be used in the simulator or in the emulator.
The NFC functions are only available in read-only mode.
Required permissions This function changes the permissions required by the application. Required permissions: - NFC: Enables applications to perform input/output operations using NFC technology.
- VIBRATE: Accesses the vibrate function.
Related Examples:
|
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: wd300android.jar
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|