android: Scanning NFC tags always produces "Open Link?" confirmation pop-up (is it a bug?)
Home Assistant Android version: 2.3.0-306-full Android version: 10 Phone model: Pixel 2 Home Assistant version: 0.114.4 Last working Home Assistant release (if known): N/A Description of problem: Not sure if it’s a bug or not, but any time I scan an NFC tag, I get a confirmation dialog titled “Open Link?”. I have the option to “Cancel” or “Open link”. When I tap “Open link”, an intent appears that’s clearly part of Home Assistant app, and the event fires successfully.
My expectation (or rather, my “hope”) is that if my phone is unlocked, I should be able to scan a tag, and have the event fire without any interaction from me.
I’m guessing this is a security measure on Android that can’t be disabled, but I thought I would post the issue in the hopes that it’s something that can be changed.
Traceback (if applicable):
Screenshot of problem:
Additional information:
I’ve verified that the “Open by default” settings show that opening links is set to open in the app, and that "www.home-assistant.io is listed as a supported link (see screenshot)

About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 50 (16 by maintainers)
Commits related to this issue
- Write application record to NFC tags. Relates to #876 This fixes an issue where on certain devices a dialog was showing up when scanning the NFC tags. After this change, scanned NFC tags go directl... — committed to JayNewstrom/android by JayNewstrom 4 years ago
- Write application record to NFC tags. (#969) * Write application record to NFC tags. Relates to #876 This fixes an issue where on certain devices a dialog was showing up when scanning the NFC t... — committed to home-assistant/android by JayNewstrom 4 years ago
It’s worth noting this only happens with https urls (home assistant related or not). If I write another NFC tag with a custom scheme (
homeassistanttestapp://tag/abc-def-etc) then it goes straight to the application, without interception. I wonder if it would be worth adding a configuration to do the universal NFC links or a custom scheme.I think I have it working for both Android and IOS, no pop-ups. So on Android I downloaded an app called NFC Tag Writer and it has an option to read a tag, save it in a local data store and then write it back. I wrote the tag written by HA back to another NFC tag and then used the saved link in ‘My datasets’ to write a clone of the tag. I then added an application via the checkbox in the datastore ‘Add launch application’ to launch to the tag. This appears to have added 52 bytes of metadata which shows HA as the launch app. When I now tap that tag, it works without the popup. It also works on IOS.
I suspect we just need to see if the HA tag writer can add this additional metadata when writing the tag.
FYI: This is an NFC AAR record.
@JayNewstrom Can confirm this works for me on Android now!! Big thanks to you, @fcassirer, and @dshokouhi for your help!
Fixed by https://github.com/home-assistant/android/pull/969
Android PR is merged. I’m working on the iOS PR now.
Ha. Jinx 😃
Reading the code path, I can see that there’s a config option called “enable_nfc_url_open_dialog” that’s set to
falseby default. And indeed, if it’s false, we exit early, so something must be setting that to true. Maybe that’s Verizon?Another “out” available is this line:
Might not be located there but we can see that by default its still not enabled https://cs.android.com/android/platform/superproject/+/master:packages/apps/Nfc/res/values/config.xml;l=4
Maybe see if this search site will let you find where it is so you can submit a AOSP fix to get it fixed upstream 😃
Not much to add, but just wanted to share this also affects Pixel 3 + Android 11 on Verizon.