[Samsung Galaxy Nexus] m.klinge:
Hiya (again) :D

So Ascsa we had a little chat about the NFC API being quite crap when it comes to "detecting when a tag isn't present anymore) - I've been thinking about it (Couldn't let it go as I really need it). I've been playing around with Tasker to try to simulate/force android to detect when a tag isn't present (anymore) - and i actually found a quite useful way - though not 100% perfect it actually does the job quite well - but it would be better, if it was controlled from your app in the first place.

So what I've done n NFC Retag:

- Every tag triggers a corresponding Tasker task (Named Tag1, Tag2 etc...)

And here what I've done in Tasker:

- Tag1: Set a variable Tag1 = &TIMES+5 (The current time in seconds plus 5 seconds). Then launches a task called "Check for new tags"

- Tag2: Set a variable Tag2 = &TIMES+5 (The current time in seconds plus 5 seconds). Then launches a task called "Check for new tags"

- Check for new tags: Wait one second, if Tag1>%TIMES (This means the tag has just been scanned) do [Whatever I want to do when Tag1 is in range] else do [Whatever I want to do when Tag1 isn't in range] (This repeats for the other tags as well)

- When the display is unlocked call the task "Check for new tags"

Now the above Tasker tasks make sure that every time I unlock my phone (Even though I don't use any lock pattern/slide to unlock) Tasker simply checks if any of the Tag1/Tag2/etc.. variables has been updated within the last 5 seconds - if that is the case then the Tag is in fact still present and it fires the Task (For instance turn sound off). If the variable hasn't been updated within the lat 5 seconds the tag isn't present anymore and it fires another task (For instance turn sound on).

Right now there's a few limitations:

- The state of each tag only changes when the screen is unlocked - however that might be enough for most cases

- It fires false positives if the following happens: I scanned a tag a few hours ago and removed it shortly after (When the tag is scanned turn off sound, else turn on) - then manually turns off sound then turn off the screen and turns it back on. Since the tag variable hasn't been updated the last few hours then the tag must have been removed - however it hasn't been present for the last few hours. Is is would lead to the sound being turn back on. Im sure it would be quite easy to fix by checking if the tag variable has been updated since the last time the screen was unlocked - if not then the tag hasn't been present and ultimately the "tag removed task" should no fire.

- Tasker doesn't play nice when I want to fire complex tasks from within another task

Now I would like to see the above introduced in NFC ReTag rather than Tasker - why you might ask. Well theres something for both of us if you could implement it :)

I can fire complex (Tasker) tasks upon scanning and removing tag and i don't have to fiddle with yet another 10 variables in Tasker.

You could implement it in such a way that the user don't have to know anything of the above but are just presented with the opportunity to set a "When tag scanned"-action (From your pick list) and to set a "When screen is unlocked and tag isn't there anymore"-action (From your pick list)

Just a few uses for this feature:

- Make a night mode when phone is put above a tag, the night mode turns off the first time i unlocks the display (Hence I'm awake)

- Car mode - auto turn on/off bluetooth/Navigation/whatever

- Work mode - Stops syncs/turn off sound/change ringtone etc..

In short NFC is a lot more useable when you don't have to manually revert the settings that changes upon a scanned tag :)

I sincerely hope you will be giving my request a go - I'll be more than happy to help you out as much as a non-conding guy can :D

//M