O'Reilly logo

Near Field Communication with Android Cookbook by Vitor Subtil

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Choosing the best format for our data

While developing other recipes, we have seen different ways of storing our data in an NFC tag. From a simple plain text to a raw object, it all depends on the data we need to store. In this recipe, we will learn about some other formats to store our data.

How to do it…

We will create several NdefMessages that contain a product representation in several formats by performing the following steps:

  1. Open Eclipse and create a new Android application project named NfcBookCh10Example2 and a package named nfcbook.ch10.example2.
  2. Download the google-gson library from https://code.google.com/p/google-gson/ and import the .jar file to the libs folder in the project.
  3. Set the minimum SDK version to 16 using the following code: ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required