Detecting NFC Tags in your DroidScript apps

295 views
Skip to first unread message

Dave Smart

unread,
Sep 26, 2017, 6:32:29 PM9/26/17
to DroidScript
Did you know that you can handle NFC tags and trigger your DroidScript apps automatically?

If you use an app called NFC TagWriter from Google Play and get programmable stick-on NFC tags like those made by whiztags.com.  Then you create a "Link" type tag with a URI like this:-

ds://fred


And your DroidScript app will be launched automatically when the tag is held to the back of your phone and the URI will be passed to your app in the data field of the OnData intent handler function (see 'Receive Intent' sample)

If you don't build an APK, then DroidScript will be launched and you won't see the intent data, so you need to build an APK if you want to differentiate between tags by altering the URIs for each one.

Harald Kubota

unread,
Sep 28, 2017, 8:05:17 AM9/28/17
to DroidScript
Confirmed to work. Works as expected when I have one application using DroidScript which can read NFCs.
However how can I have two applications created with DroidScript to manage NFCs? I assume "ds://" calls DroidScript "things": When I touch a tag with "ds://test1", I get the selection of:
  • DroidScript
  • DroidScript ApkBuilder
  • DroidScript BluetoothLE
  • DroidScript PuckJS
  • NFCTest (my application)
If I choose my application, all is good. But If I choose to always use this application, I'll not even get the chance to pick another application. And how would Android know which one to pick for another tag called "ds://something2"?

Is there a trick I miss or is this a limitation of the current implementation?


Dave Smart

unread,
Sep 28, 2017, 9:44:15 AM9/28/17
to DroidScript
It's a restriction of the current implementation.  

We would need to add the ability to modify the manifest in order to allow the use of multiple apps.. I suggest you ask for it on the 'Tell us what you want' thread.

Harald Kubota

unread,
Sep 28, 2017, 10:42:35 PM9/28/17
to DroidScript
Thanks Dave for the confirmation of my suspicion where the limitation comes from.
Reply all
Reply to author
Forward
0 new messages