Published on

Invoke Apple Shortcuts Using An NFC Card

Authors
  • avatar
    Name
    Greg Smith
    LinkedIn

I am continually looking for ways to save time and effort and have been harnessing my Apple devices to automate routine tasks. I also have an intense dislike for television adverts and can't find the remote quickly enough to mute the volume when they start playing.

Given my habit for dual screening, I wondered - is it possible to use my phone to turn the sound off when adverts are playing?

The next section in this post is tangentially related.

AWS Cloud Day Auckland

I was invited by Datacom to the recent AWS Cloud Day Auckland where Amazon announced the launch of their AWS Asia Pacific (New Zealand) Region in Aotearoa to much fanfare.

AWS Cloud Day Auckland Card

At the conference, ushers scanned entry passes using a mobile device each time attendees went into and out of the conference rooms to track when they were nearing, or at capacity. Scanning our passes therefore meant they were NFC capable.

This had me thinking; could I re-purpose my entry pass from the conference for use with an iPhone to run an Apple Shortcut?

30 minutes of reading the next day showed it would be a simple exercise and that I didn't need to write a custom iOS app in Swift as I first thought.

Assign the Shortcut to a Personal Automation

Apple has a variety of pre-built shortcuts but I wanted to invoke one that I wrote to call an HTTP server running on my Marantz AV receiver 1 with an XML payload which toggles the sound on or off. The following steps apply for running any shortcut on your iPhone.

This is where you need your NFC card nearby.2

Open the Apple Shortcuts app on your iPhone.

Select the "Automation" tab and press the '+' button to create a new Personal Automation.

New Personal Automation

In the search box, type "NFC" and select the action for "When I tap an NFC tag".

Scan the card by holding it to the back of your iPhone. This will also reset the card for use.

Ready to scan

For the Automation, select "Run Immediately". This means the NFC card specified in the "When" section will run things without the need for confirmation.

Deselect "Notify When Run".

For the "Do", select the shortcut you want to run.

Personal Automation settings

Press "Done" to save everything.

Saved Personal Automation

Note: Even when your iPhone is locked, provided your display is active, NFC will work. This is different from the Apple Watch where you need to double press the side button to invoke NFC, for example, when using Apple Pay.

With the shortcut assigned, hold your iPhone over the NFC card and voilà.

That's all there is to it.

Footnotes

  1. Running the command nmap -sV showed that Marantz use Windows CE as the runtime for the AV receiver operating system. I was surprised to see they opted for this over embedded Linux.

  2. If you want to buy re-writeable NFC cards or tags in bulk, a quick search online reveals plenty of options.