问题
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:
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).
来源:https://stackoverflow.com/questions/11406804/2-ndef-messages-records-on-one-nfc-tag-android