2个NDEF消息/记录在一个NFC标签上-Android [英] 2 NDEF messages/records on one NFC tag - Android

查看:251
本文介绍了2个NDEF消息/记录在一个NFC标签上-Android的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人在NFC标签上保存2条NDEF记录时,是否尝试过Android默认行为,其中一条指向应用程序.apk指向URL,而第二条记录则具有应用程序专有数据?

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?

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

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.

推荐答案

Android不支持两条NDEF消息(其他平台也可能不支持).一条NDEF消息中的多个NDEF记录可以正常工作.如评论中所述,Android应用程序记录(AAR)可以完美运行.请记住不要将其作为消息的第一条记录,并添加与消息的第一条记录匹配的意图过滤器(否则,您的应用将使用普通的LAUNCHER_MAIN启动,而不使用NDEF消息,而不是使用NDEF_DISCOVERED使用NDEF消息启动.

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.

指向Play商店中应用的URL通常也可以正常工作,如果您将其与应用本身中该URL的Intent过滤器结合使用了.它也可以在Android 2.3上使用.不过请注意,Play商店应用和浏览器旁边的其他应用可能具有匹配的意图过滤器. AAR永远不会有这个问题(但自ICS以来仅支持AAR).

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

这篇关于2个NDEF消息/记录在一个NFC标签上-Android的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆