NFC re-check condition

Post your questions and help other users.

Moderator: Martin

Post Reply
rathmannm
Posts: 7
Joined: 29 Apr 2013 17:08

NFC re-check condition

Post by rathmannm » 29 Apr 2013 17:16

Hi,

I've got the following problem I am trying to resolve:

I have NFC tag in my car holder for the phone. I use the tag to switch on Bluetooth in order to be able to connect to the car radio. When the car radio disconnects I have another trigger to switch Bluetooth off again. This works all very well but I get a problem when I turn off the radio and/or car briefly and do not remove the phone from the car holder. What happens is that Bluetooth gets switched off but it never gets switched on again as I would have to re-tap the NFC tag (meaning basically having to removed and re-insert my phone in the holder). I was looking for either a way to check if the NFC tag is still near or poll it again which I could use for a condition. So basically if the phone is still near the NFC tag whilst the car radio disconnects do NOT switch off Bluetooth. Just writing this I realize this might be too sophisticated :)

Anyone any ideas?

Cheers,
Manuel

User avatar
Martin
Posts: 4468
Joined: 09 Nov 2012 14:23

Re: NFC re-check condition

Post by Martin » 29 Apr 2013 18:35

Hi,

Disabling and enabling the NFC setting of Android re-scans the NFC tag. Unfortunately action Set NFC State requires root. Alternatively you can launch the settings page and change the NFC setting using an action Control UI.

Something like this might work (untested):
Flow NFC scanner:
-trigger NFC Tag: TAG_CAR
-action Script: global_nfc_tag=true

Flow 2:
-trigger bluetooth disconnected
-action Script: global_nfc_tag=false
-action Set NFC State: Off
-action Sleep: 1s
-action Set NFC State: On
-action Sleep: 2s
-condition global_nfc_tag
--> false: switch off bluetooth


Regards,
Martin

rathmannm
Posts: 7
Joined: 29 Apr 2013 17:08

Re: NFC re-check condition

Post by rathmannm » 30 Apr 2013 17:04

Excellent thanks that actually worked :)

Post Reply