问题描述
我可以简单地把手机上的NFC标签开始我的申请。但是,我想借这个想法了一步。想象一下,两个NFC的标签一个简单的时间跟踪应用程序。第一个将启动(下载)申请并注册开始时间。另外也将启动(下载)应用程序,但是注册一个停止时间。
I can start my application by simply putting the phone on a NFC-tag. But I would like to take the idea one step further. Imagine a simple time-tracking application with two NFC-tags. The first will start (and download) the application and register a starttime. The other will also start (and download) the application, but register a stoptime.
我的问题,我想解决的是,我不希望我的电话了解这些标签。应用程序不应该需要具有编程标签ID的列表,并知道被连接到每个ID的操作。标签应随身携带,以用正确的参数启动手机上的行动所需要的信息。
My problem I'd like to solve is that I don't want my phone to know about these tags. The application should not need to have a list of tag-ids programmed and know what actions that is connected to each id. The tag should carry the information needed to start the action on the phone with the correct parameters.
是否有关于如何完成此方案中的任何信息?我已经安装了NFC-Eclipse的插件,但不知道如何使用它来获取我的目标,甚至更少如何让我的应用程序读取额外的数据。
Are there any information about how to accomplish this scenario? I have installed "nfc-eclipse-plugin" but doesn't understand how to use it to get my goal and even less how to get my application to read the extra data.
在此先感谢
罗兰
Thanks in advanceRoland
推荐答案
您标记应该能够存储NDEF消息。这种消息是由Android自动读出并传递给你的应用程序在意向。自动安装和/或启动您的应用程序可以通过将一个在你的标记。任何附加信息(启动或停止指示)可以存储在专有记录
Your tags should be capable of storing NDEF messages. Such messages are automatically read out by Android and passed to your app in an Intent. Automatically installing and/or starting your app can be accomplished by putting an Android Application Record in your tag. Any additional information ("start" or "stop" indication) can be stored in a proprietary record.
您可能希望把AAR为NDEF消息的最后一个记录,因为它是检测,并经自动Android的作用,但由于ICS只支持。为了与姜饼自动安装工作,你可以把一个额外的URI记录或记录SmartPoster用它作为消息的第一记录的谷歌Play商店的链接。然后,您的应用程序应该过滤()此URI ,所以它也会自动在姜饼启动。
You probably want to put the AAR as the last record of the NDEF message, as it is detected and acted upon by Android automatically, but is only supported since ICS. To make automatic installation work with Gingerbread, you can put an additional URI record or SmartPoster record with a Google Play Store link in it as the first record of the message. Your app should then filter (ACTION_NDEF_DISCOVERED) for this URI, so it will also start automatically on Gingerbread.
这篇关于从启动NFC标签具有额外数据的Android应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!