PC SOFT

FORUMS PROFESSIONNELS
WINDEVWEBDEV et WINDEV Mobile

Accueil → WINDEV 2024 → Android wd18 questions (NFC)
Android wd18 questions (NFC)
Débuté par JP, 20 nov. 2014 01:39 - 4 réponses
Posté le 20 novembre 2014 - 01:39
How to simulate back button on Android?
Is it possible to change the background when reading nfc (NFCReadTag)?
Is it posible use half screen in the function NFCReadTag and in he other half show data in the screen?

Regards
Posté le 20 novembre 2014 - 09:18
Hello,

Backbutton closes your Window or application, what would be the specific use of simulating this ?

Do you want to change the background of your application ? You can use the NFC functions to read a card in the background and when read a callback function is called where you can do whatever you want in your program, show the code, change the background color,...

Maybe you can give us a bit more info.

Danny
Posté le 20 novembre 2014 - 17:45
Danny:

I need to change the window background color and show text in the window while using the NFCReadTag function depending on the last data read from the NFC tag, without stopping the read NFC function. To show the new background with the new text and that the NFCReadTag function continue working.

Not stopping is ok. But I can't change the backgroud in the window or show the new text because the NFCReadTag function makes the window dark.

I need a half window or a popup to show new data.

I don't know how to show half the screen with the NFCReadTag image and the other half showing some text in the window and a backgroud relative to the NFC data.

NextTitle can write in the screen but without color and with a font very little. If a can show a background color and a bigger font in NextTitle window it it would be great.

Clicking the cellular Backbutton iluminates the window and shows background color for a moment while read NFC function is working. Maybe with a timer i can send the key to the app.

If is possible read NFC in the background without showing the reader NFC image, is good solution too.

Thanks
Posté le 20 novembre 2014 - 22:44
Dear JP,

You must use the NFCRead in non locking mode (zie details @ <a class="ExternalLink" rel="nofollow" target="_blank" href="http://doc.pcsoft.fr/en-US/?1000020416&name=nfcreadtag_function">http://doc.pcsoft.fr/en-US/?1000020416&name=nfcreadtag_function</a>)

// Read a NFC tag in non-locking mode IF NOT NFCReadTag(ReadNFCTag) Error("Failure starting the NFC detection.", ErrorInfo()) END PROCEDURE ReadNFCTag(tag is nfcTag) Info(StringBuild("A NFC tag of %1 type was detected.", tag..Type)) // Keep detection active for other cards to be read RESULT False

Procedure Name: Character string (with or without quotes)
Name of the WLanguage procedure ("callback") called when a NFC tag was read.

Use in locking mode (Syntax 1)
The call to NFCReadTag automatically opens a window asking the user to move his device near another device compatible with NFC. This window will be automatically closed:
once the sending is over
if the user cancels the sending by pressing the Back key of the device.
Note: To customize the message displayed in this window, use NextTitle before the call to NFCReadTag.

Use in non-locking 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 it will have to be restarted by a call to NFCReadTag.


So if you use the non-locking mode you have your own window and can display whatever you want. I have created a small NFC reader program that has its own Window and displays some messages and the card ID that is scanned. The ID is also saved in a logfile. User can keep scanning cards as long as the Program is active in the front.

So it is all very simple, a few lines of code inside the callback function and your done ! :xcool:

Hope it will work for you
Danny
Posté le 20 novembre 2014 - 23:10
Thanks!!!