sensor NearField.... how to use?

79 views
Skip to first unread message

piero alabrese

unread,
Nov 5, 2019, 6:29:11 AM11/5/19
to MIT App Inventor Forum
Hello,
I would like to create a simple app that uses the NearField sensor to make what the phone receives when it is approached to an NFC sticker appears on a label.
where can I find examples of using this sensor? could someone pass me tutorials or anything else where I can document?

thank you all
Piero

gerrikoio

unread,
Nov 5, 2019, 6:46:36 AM11/5/19
to mitappinv...@googlegroups.com
As you might know, the NearField component is found under the Sensors category (LHS palette). If you click on the "?" you will be given a help tip, as follows:

For now this component supports the reading and writing of text tags only (if supported by the device). In order to read and write text tags, the component must have its ReadMode property set to True or False respectively. Note: This component will only work on Screen1 of any App Inventor app.

What this means is that the NearField component can only read NDEF text format. Other than that there is not much else you can get from this component, such as MAC address of sticker, I'm afraid.

So if you want to read/write NDEF text, you will need to format your NFC sticker as such.

So, you will need to use a separate NFC utility app for this, to format the sticker as NDEF - then, once formatted, you can write to the sticker via your app (using set TextToWrite method) or use a different app for this. One such utility app would be NXP TagWriter. Use Google Play to search.

Then, once you have text stored on the sticker you can use the "when TagRead(text message)" event block in your app to receive the text when your phone has detected the sticker.

Hope that helps.
Reply all
Reply to author
Forward
0 new messages