NFC continuous detection

1,065 views
Skip to first unread message

Aleksandar

unread,
Jan 10, 2016, 8:54:21 AM1/10/16
to Automate
Hello Auto-Mates ;),

I'm trying to scan/detect NFC tag in continuous mode, periodically checking tag presence.
In my opinion, the simplest way should be having loop: check-notify-delay-check, as it's shown in next example (screenshot of fiber).

There is trouble:
This flow shows only one loop pass notification, it can't repeat NFC tag detection when NFC tag is constantly near my phone, and can't detect moment when NFC tag is put away from phone.
Do you have some suggestion, or you see my wrong way to detect NFC continuously (periodically).

Thank a lot,
Aleksandar

Adriano Marzano de Carvalho

unread,
Jan 10, 2016, 9:49:59 AM1/10/16
to Automate
Is the phone unlocked and screen on?
That's a limitation with nfc scanning.

Aleksandar

unread,
Jan 10, 2016, 9:57:11 AM1/10/16
to Automate
I am aware of that limitation, thanks.
This flow doesn't perform periodically NFC scanning even if if force screen turned on.
Is there needed implementation some kind of NFC scan re-initialization?

Adriano Marzano de Carvalho

unread,
Jan 10, 2016, 11:19:36 AM1/10/16
to Automate
Did you test with a delay that screen is always on and unlocked (ie: 5s)?
I mean, screen might be on, but if it's not unlocked, it won't work.

Aleksandar

unread,
Jan 10, 2016, 2:25:21 PM1/10/16
to Automate
Yes, of course. I have tested many different delays, all much smaller than screen-off and lock period (both are 30 sec).

The most strange thing is:
NFC detection works only when i physically change distance of phone and NFC tag. There is no repeating of loop inside Automate fiber while NFC is always near phone.

As I understand this fiber, it should check NFC presence every 3 sec and show message abot NFC presence....that's what I'm trying to get.

Adriano Marzano de Carvalho

unread,
Jan 10, 2016, 5:25:57 PM1/10/16
to Automate
Ah, the tag is always near then. In such case, I believe it's a hardware limitation, the tag shall be far, then near to "trigger" it I guess.

Adriano Marzano de Carvalho

unread,
Jan 10, 2016, 5:27:04 PM1/10/16
to Automate

Henrik Lindqvist

unread,
Jan 10, 2016, 7:37:30 PM1/10/16
to Automate
NFC tag detection in Android doesn't work that way, it only triggers when a tag comes within range.

Using a 3 second Delay may make cause the flow to miss a tag during the delay, always return to a condition block as soon as possible.
If you need to perform any lengthy operations, do so in a new forked fiber.

The Catch failure block is useless in that location, it can only catch failure in the current fiber.

Aleksandar

unread,
Jan 11, 2016, 10:43:59 AM1/11/16
to Automate
Capturing single NFC event (entering tag in RF range) is not a problem.
It looks that my Idea about repetition of NFC detection, which is already within range, couldn't be achieved due to hardware/OS limitations?

Henrik Lindqvist

unread,
Jan 11, 2016, 4:18:28 PM1/11/16
to Automate
Android only sends the detection event once. It may be possible to somehow poll if the tag is still readable, but that's not officially support, nor is it how the Android API are supposed to work.
Reply all
Reply to author
Forward
0 new messages