2

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.

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.

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 advance Roland

Roland
  • 5,328
  • 10
  • 37
  • 55
  • What means: "I don't want my phone to know about these tags"? – Kamen Goranchev Jun 01 '12 at 07:38
  • Yeah what does that mean, there is no magic tracking of tags. – ThomasRS Jun 01 '12 at 18:51
  • I made that plugin, and it is an editor for NDEF messages - you need to determine what types of records your message is to contain to trigger this or that functionality. Check out NfcDetectorActivity in the Android boilerplate [http://code.google.com/p/nfc-eclipse-plugin/downloads/detail?name=Android%20NFC%201.2.zip&can=2&q=](boilerplate) for reading tags on the client side. – ThomasRS Jun 01 '12 at 18:58

1 Answers1

2

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.

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 guy
  • 10,151
  • 3
  • 27
  • 58