NFC tag - why use AAR and LaunchApp rather than URL intent with Android?

750 views Asked by At

Given that you can launch an installed android app using an NFC tag with a URL on it, using, e.g.:

<category android:name="android.intent.category.DEFAULT"/>
<data android:scheme="https"
          android:host="http://myurl.com"
          android:pathPrefix="/something" />

And that you can make that shorter using a url shortening service, or your own domain, and that redirects to the play store, why would you use an AAR on a tag? (Also, I believe the AAR intent wont pass data to the app).

I'm looking to make a tag that supports multiple OS, with as few bytes as possible - if I create a website that has links to each phone's store, what advantage is there to including an AAR or LaunchApp record on the tag?

1

There are 1 answers

2
CommonsWare On BEST ANSWER

why would you use an AAR on a tag?

Because your (original, pre-edit) proposed URL would cause the tag to always go to the Play Store. An AAR is designed to only go to the Play Store if there are no apps on the device that can handle the primary NFC record. See my answer to my own question for more on this.

Your approach of using http://myurl.com/something should work fine, so long as:

  • The tag is only supposed to be valid for your app

  • Nothing else on the device advertises support for that specific host and path prefix