NFC Tags are awesome for automating stuff. Want easy to activate sleep tracking? Just set up a tag near your bed. Want easy to activate car mode? Set up a tag somewhere in your car. But they have one big flaw: to use them, you must take your big ass phone out of your pocket.
(In above example, I activate sleep tracking, disable always-on mode and enable theater mode by just touching the tag. Always-on mode is then automagically re-enabled in the morning when sleep tracking stops.)
NfcTagRelay is simple and light tool that reads tags using your smartwatch and then relays the tag detection event to the phone, so it can be acted upon using various automation apps such as Tasker.
How it works
Every NFC tag has unique ID that can be used to identify it. That ID is broadcasted via Intent to all apps on the phone whenever tag is scanned. It is broadcasted via two different intents:
Intent 1
Action: com.matejdro.weartagrelay.RECEIVED_TAG
Extras:
Action: com.matejdro.weartagrelay.TAG_<ID of the tag>
(This second one is more useful for apps that cannot filter Intents by extras such as Tasker).
Tasker example
Here is my example on how I'm receiving tags via Tasker. As mentioned above, app sends events via Intents. That is why we will be using System -> Intent Received Tasker event.
1. ID Receiving Context
First we have to figure out what is the ID of the tag that we are scanning. For that we can use com.matejdro.weartagrelay.RECEIVED_TAG which also broadcasts tag ID.
2. TAG Context
Now that we have the ID, we can create context that will be activated whenever tag with that ID is scanned. For that we will use com.matejdro.weartagrelay.TAG_<ID> intent.
Installation
Huge thanks to user ebones. Without him, this would not be possible.
(In above example, I activate sleep tracking, disable always-on mode and enable theater mode by just touching the tag. Always-on mode is then automagically re-enabled in the morning when sleep tracking stops.)
NfcTagRelay is simple and light tool that reads tags using your smartwatch and then relays the tag detection event to the phone, so it can be acted upon using various automation apps such as Tasker.
How it works
Every NFC tag has unique ID that can be used to identify it. That ID is broadcasted via Intent to all apps on the phone whenever tag is scanned. It is broadcasted via two different intents:
Intent 1
Action: com.matejdro.weartagrelay.RECEIVED_TAG
Extras:
- tagid = <ID of the tag>
Action: com.matejdro.weartagrelay.TAG_<ID of the tag>
(This second one is more useful for apps that cannot filter Intents by extras such as Tasker).
Tasker example
Here is my example on how I'm receiving tags via Tasker. As mentioned above, app sends events via Intents. That is why we will be using System -> Intent Received Tasker event.
1. ID Receiving Context
First we have to figure out what is the ID of the tag that we are scanning. For that we can use com.matejdro.weartagrelay.RECEIVED_TAG which also broadcasts tag ID.
- Create new context with System -> Send Intent event
- Under intent action enter com.matejdro.weartagrelay.RECEIVED_TAG (See attached picture 1.)
- In task that is triggered by this, copy contents of the %tagid variable to the clipboard. For convenience, you can also copy it along the rest of the second intent (see attached picture 2).
- After you get the tag ID, you can delete that context or just disable it to add more tags later. It is triggered when you scan any tag so you likely won't need it.
2. TAG Context
Now that we have the ID, we can create context that will be activated whenever tag with that ID is scanned. For that we will use com.matejdro.weartagrelay.TAG_<ID> intent.
- Create new context with System -> Send Intent event
- Under intent action enter com.matejdro.weartagrelay.TAG_<ID>, where you replace "<ID>" with the actual ID of the tag (See attached picture 3.)
- In task that is triggered by this, add whatever you want. This task will be triggered every time you scan tag with specified ID.
Installation
- Install Sony SmartWatch 3 NFC Support Package. Without that, NFC will not work at all on your watch.
- Install included APK to your phone
- After some time (usually up to a minute), app will be automatically installed to the watch (you will get notification). After that you may also need to grant the app NFC permissions (it will ask on the watch). Make sure you do, otherwise it won't work.
Huge thanks to user ebones. Without him, this would not be possible.
No comments:
Post a Comment