4

有没有人尝试过 Android 默认行为,当在 NFC 标签上保存 2 个 NDEF 记录时,一个指向带有应用程序 .apk 的 URL,而第二个具有应用程序专有数据?

用例如下:当用户尚未安装应用程序时,设备启动 Google Play 或网络浏览器,用户可以下载应用程序。一旦用户安装了应用程序,它就会处理标签内容。两者都是分开工作的,但我没有在一个 NDEF 中尝试过 2 条 NDEF 消息或 2 条记录。有 2 条 NDEF 记录的经验吗?我可以自己尝试,但我想节省时间。

4

1 回答 1

5

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).

于 2012-07-20T01:04:11.090 回答