4
votes

Does anybody tried how the Android default behavior, when on the NFC tag are saved 2 NDEF records, one is pointing to the URL with application .apk, while the 2nd has application proprietary data?

The use case is following: When user has not an application installed yet the device starts either Google Play or the web browser and user can download the application. Once user installs the application it process the tag content. Both are working separately, but I have not tried 2 NDEF messages or 2 records in one NDEF. Any experiences with 2 NDEF records? I can try on my own, but I would like to save a time.

1
I would love to find an answer to this as well. I just started playing around with NFC and am having a lot of fun with it.Jeff Thomas
As soon as we will finalize the current development, we will check it on all platforms and I will update the thread.STeN
I actually got this working perfectly yesterday with NdefRecord.createApplicationRecord() and it works great. Created one record with a mime and a payload that can be read with the app and then the createApplicationRecord which opens the app store if the app is not installed.Jeff Thomas

1 Answers

5
votes

Two NDEF messages is not supported by Android (and probably also not by other platforms). Multiple NDEF records in one NDEF message works fine. As noted in the comments, an Android Application Record (AAR) works perfectly. Just keep in mind not to put it as the first record of the message and add an intent filter that matches the first record of the message (otherwise your app will be launched with normal LAUNCHER_MAIN, without NDEF message, instead of NDEF_DISCOVERED with NDEF message.

A URL pointing to the app in the Play Store works usually fine, too, if your combine it with an Intent filter for that URL in the app itself. It works also on Android 2.3. Keep in mind, though, that other apps beside the Play Store app and the browser may have a matching intent filter. You never have that problem with an AAR (but AAR is only supported since ICS).