Follow

Triggering events with NFC Tags and Android Smartphones

And find the code at GitHub.

Table of Contents

 1. Scope

1.1 What does it do?

1.2 How does it work?

1.3 Definitions

2. The Recipe

2.1 Ingredients

2.2 Preparation

3. Method

3.1  Edit the app code

3.2  Implement the logic in your Conducttr project

3.3  Create the mobile registration logic in Conducttr (OPTIONAL)

 

 

1  Scope

 

This document describes how to trigger events using NFC tags. You can also find the code to easily create your own Android NFC reader app and integrate it with your Conducttr project.

 

1.1  What does it do?

The audience receives custom content based on which NFC tags they discover and touch with their phone, personalizing their experience to their location (if the NFC tag it's attached to a certain place) and behaviour.

 

1.2  How does it work?

 

The smartphone app will read NFC tags and send triggers to your Conducttr project, telling which tag the audience has read and triggering the events you have defined.

The smartphone will send API calls using the TAG Content as a matchphrase. This way you can easily identify each TAG. You can also change what happens when someone reads a NFC Tag inside Conducttr, you don't need to modify your NFC reader app.

 

1.3  Definitions

  • NFC (Near Field Communication): Wireless communication technology based on radio signals . The devices need to be really close for the communication to be effective.  It's the technology behind the contactless credit cards.
  • NFC Reader: A device, like a smartphone, with capabilities of receiveng NFC radio signals.
  • NFC Tag: A devicewith the capabilities of sending NFC radio signals. It can be really small and flat, like a sticker. 

 

2  The Recipe

This recipe has the following sections:

  • Ingredients - what you need to complete this project
  • Preparation - how to prepare
  • Method - step-by-step implementation guide

 

2.1  Ingredients

You will need:

I.    a Conducttr project

II.  The app code snippet (here)

III.   Eclipse to edit the code app.

        - Eclipse & Android SDK bundle: http://developer.android.com/sdk/index.html
        - Eclipse: http://www.eclipse.org/downloads/

IV.  A set of NFC tags.

V.   An Android smartphone with NFC capabilities and Android 2.3.3 or superior

 

2.2  Preparation

To prepare, you’ll need to:

I.   Create a Conducttr project

II.  Create a new API entry inside Conducttr's API view called “Website”

 

3   Method

Now you have all the ingredients and you’ve followed the preparation, you’re now ready to configure the project. The steps are:

  • Import and Edit the app code with Eclipse
  • Implement the logic in your Conducttr project
  • Create the app user registration logic in Conducttr (OPTIONAL)

 

3.1  Import and edit the app code

Import the NFCwithConducttr project into your workspace in Eclipse.

File -> Import -> Android -> Existing Project into Workspace

Then open  src->com.conducttr.nfc-> Constants.java

The area that you have to edit is between two comment lines. The start of the editable area says “Edit the information below” – as shown in the image.

 

You need to update the following information:

  • CONDUCTTR CONSUMER KEY  & CONSUMER  SECRET – you’ll find this in the Authentication section of the API pop-up

 

  • CONDUCTTR PROJECT ID – this is found in the top header bar

 

 

After this you just need to build and export your NFC Reader app.

 

3.2  Implement the logic in your Conducttr project

Once we have our app is ready, you need determine the interaction between the audience with the app and Conducttr creating triggers and actions.

 

- Create API triggers in Conducttr with the matchphrase we encoded inside the NFC tag (you can write texts in your NFC tags using an app like Tag Writer).

 

  - Create as many Logic/Content action as you want. You can send SMS or phone calls to the Audience members who read a certain TAG, move them to different Groups to track their behaviour, increment their attributes etc.

 

3.3  Create the mobile registration logic in Conducttr (OPTIONAL)

When an audience member logs in the app for the first time or they want to change their phone number, the App will send Conducttr an API Call with the matchphrase "registration". You can use this as a trigger to reset some values or send a welcome message. In order to do this:

- API Trigger: First we have to create a new API trigger with the matchphrase "registration". This will be called by the app when the Audience clicks the login button in the first screen.

- You can create as many Content or Logic actions as you want attached to this trigger.

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request

Comments