ChapterPDF Available

Game Based Learning Through Near Field Communication

Authors:

Abstract and Figures

Near Field Communication (NFC) is a technology mainly known from the payment and ticketing sector. Due to its availability on smartphones NFC provides a far untapped potential for a variety of different applications. As part of researches regarding NFC and its usability in educational areas, the operational capability of NFC has been tested in the field of game based learning. The result was an Android-based quiz application (“NFCQuiz”) working in multiplayer mode, meaning that several players can exchange their answers through the use of NFC during the game. The application provides educators the possibility to store his/her own questions and answers on a tag. During the game one player reads the tag and can send the contained information to multiple players over Android Beam. The exchange of the given answers and the calculation of the leader board are in turn done over a NFC connection. Such an application is expected to bring different benefits. Both, question generation and data exchange are handled over NFC. As a result no internet access is needed for participating in the game. Since the used tags are re-writable there are basically no limits in term of reuse. Another benefit resulting from the usage of tags is that parents/teachers can control the used questions and answers. A NFC-based game is also supposed to give players an additional interactive effect by holding the phones for synchronization, which in turn keeps the participants interested. This research work gives an overview of the “NFCQuiz” application regarding its functionality and implementation. Moreover we discuss the advantages and disadvantages of the app with respect to similar games and the overall potential of NFC in the educational sector.
Content may be subject to copyright.
Draft originally published in: Lamija, D., Ebner, M. (2017) Game Based Learning Through Near Field
Communication. Game-Based Learning Theory, Strategies and Performance Outcomes. Youngkyun B.
(ed.). Nova publisher. pp. 295-322
GAME BASED LEARNING THROUGH NEAR FIELD
COMMUNICATION
Lamija Dzafic, Martin Ebner*
Educational Technology, Graz University of Technology
ABSTRACT
Near Field Communication (NFC) is a technology mainly known from the payment and ticketing
sector. Due to its availability on smartphones NFC provides a far untapped potential for a variety of
different applications. As part of researches regarding NFC and its usability in educational areas, the
operational capability of NFC has been tested in the field of game based learning. The result was an
Android-based quiz application (“NFCQuiz”) working in multiplayer mode, meaning that several
players can exchange their answers through the use of NFC during the game. The application provides
educators the possibility to store his/her own questions and answers on a tag. During the game one
player reads the tag and can send the contained information to multiple players over Android Beam.
The exchange of the given answers and the calculation of the leader board are in turn done over a NFC
connection.
Such an application is expected to bring different benefits. Both, question generation and data exchange
are handled over NFC. As a result no internet access is needed for participating in the game. Since the
used tags are re-writable there are basically no limits in term of reuse. Another benefit resulting from
the usage of tags is that parents/teachers can control the used questions and answers. A NFC-based
game is also supposed to give players an additional interactive effect by holding the phones for
synchronization, which in turn keeps the participants interested.
This research work gives an overview of the “NFCQuiz” application regarding its functionality and
implementation. Moreover we discuss the advantages and disadvantages of the app with respect to
similar games and the overall potential of NFC in the educational sector.
Keywords: NFC, game-based learning, Android, Host Card Emulation mode, quiz application
* Corresponding Author address
Email: martin.ebner@tugraz.at
INTRODUCTION
Near Field Communication (NFC) can be defined as a contactless technology used for data exchange
over short distances. The term NFC was first introduced in the year 2002 by Sony and NXP
Semiconductors. Nevertheless, the roots of NFC can be found in the Radio Frequency Identification
(RFID) technology1.
In general a RFID system consists of a transponder and a reader. The transponder, also known as tag is
attached to an object, that should be identified. The reader is capable of reading from (and writing to) the
transponder (Tamm & Tribowski, 2010). The communication process between reader and tag is very
simple with RFID. The reader is looking for tags in its field. A transponder gets activated when it is in
range of the reader. The transponder receives the required energy for the activation contactless through the
coupling unit. As a response the transmitter sends its content to the reader (Tamm & Tribowski, 2010)
(Finkenzeller & Müller, 2010). The difference to NFC is that RFID uses a strict separation between its
components. A device can either be a reader or a transponder, whereas in regards to NFC a device can
switch between those two roles (Langer & Roland, 2010).
The great benefit of NFC is that it is also available on smartphones. In 2006 the first NFC capable
smartphone was presented by Nokia (6131)1. Today, 10 years later, about 617 million NFC enabled
devices are shipped per year (Boden, 2016). The forecast is that in two years NFC will be available in two
of three phones (Whitney, 2014). Considering its distribution rate and the fact that NFC makes it possible
to have multiple so called Smart Cards, tags, and a reader available anytime and anywhere makes it worth
taking a deeper look into this technology. The greatest potential of NFC can probably be found in the
replacement of extant contactless technologies like QR Code, Barcode, Smart Cards, etc. Especially the
replacement of the Smart Card technology has already been started.
This paper deals with the potential of NFC in the field of education. The motivation is to test the
potential and usability of NFC in game based applications through the use of “prototyping” as solution
strategy.
In order to get a better understanding of the technology, its basic concepts, and popular field of usage
the chapter State of the Artprovides an overview of NFC. Following chapters will explain the
Motivationbehind the work and finally introduce the developed applications in the chapter NFCQuiz
Application. Finally, a summary of the outcome as well as possible enhancements is discussed in the
chapter Conclusion”.
1 http://NearFieldCommunication.org (last accessed December 2016)
STATE OF THE ART
In contrast to RFID, which can use different frequency bands, NFC only supports a working frequency
of 13.56 MHz. It only works on short-ranges (less than 4 centimetres) with a maximum communication
speed of 424 kbps. A simple touch between two NFC capable devices enables a contactless transaction
(Coskun, Ok, & Ozdenizci, 2013).
To get a better overview of NFC an understanding of its operation-, role- and communication-modes is
elementary.
One benefit of NFC is that it supports three different modes of operation (Langer & Roland, 2010):
Peer-to-Peer (P2P) mode: Used for communication between two NFC capable devices (e.g. two
smartphones) where one device acts as initiator and the other as target.
Reader/Writer (RW) mode: Used for communication with a passive NFC tag or with contactless
chips cards.
Card Emulation mode: In this mode the NFC device acts as a contactless Smart Card. It is used for
communication with RFID readers, where the NFC device is the transponder.
NFC distinguishes also between two communication modes (Macias & Wyatt, 2014):
Active Mode
o In active mode, both initiator and target have their own power supply. The initiator
generates its radio frequency (RF) field, sends a request, and turns the RF field off. The
target in reverse generates an own RF field for the response.
o Example: 2 phones in P2P mode
Passive Mode
o This mode is similar to the concept of RFID. The target has now internal power supply. It
gets powered by the electromagnetic energy, which is transmitted by a reader. After the
target gets powered, it starts transmitting its information. This mode is compatible to
RFID standards.
o Example: Phone & RFID tagged poster
Further we can distinguish between 4 main roles according to (NearFieldCommunication.org):
Reader/Writer (R/W)
o The R/W is typically a card reader or smartphone working in active mode.
o The active R/W device sends signals and receives information.
Card
o A card is a passive device (e.g. a NFC tag or a passive phone acting in Card Emulation
mode)
o The card receives requests form the R/W.
o The card answers the instructions.
Initiator: The initiator is the NFC device that is responsible for connection setup in Peer-To-Peer
mode.
Target: In P2P mode the target is the device that receives instructions by the initiator and answers
with the requested information.
The communication process through NFC is similar for all three modes of operation. The
initiator/reader sends or requests data and the target/card responds to the instructions. This principle is
illustrated in Figure 1 for all three modes.
Figure 1: Participants in NFC operation modes
The idea behind NFC is to define its architecture in the way that it uses already existing and proofed
standards, as well as to support different protocols in order to allow a developer to access the system in a
variety of ways (Coskun, Ok, & Ozdenizci, 2013). Depending on the mode that is used, also different
protocols are used. The protocol stack of NFC is depicted in Figure 2. All modes of operation are based on
the ISO/IEC 18092 NFCIP-1, JIS X6319-4 (FeliCa) and ISO/IEC 14443 standards.
Initiator
Target
The P2P mode is used for data transfer between two active NFC
capable devices.
1) The initiator creates a radio magnetic (RM) field
2) The initiator sends data/requests to the target
3) Initiator turns its RM field off
4) The target creates its RM field
5) The target sends data
6) The target turns its RM field off
Reader/Writer
The R/W mode is used for exchange between an active NFC
capable device acting as reader and a passive tag.
1) The reader creates a RM field
2) The reader sends requests to the target
3) The tag responses using load-modulation
Reader
Card
In Card Emulation mode the NFC device is emulating a card. The
reader can either be an active NFC device in R/W mode or a RFID
reader.
1) The initiator creates a RM field
2) The initiator sends data/requests to the target
3) The target responses using load-modulation
Card Emulation mode participants
Reader/Writer mode participants
Peer to Peer mode participants
Figure 2: NFC protocol specifications (Keen, 2009)
The two basic standards used in NFC are NFCIP-1 (EcmaInternational, ECMA-340, 2013) and NFCIP-
2 (EcmaInternational, ECMA-352, 2013).
NFCIP-1 is the base standard. It standardizes the communication mode for NFC using inductive
coupled devices at a frequency of 13.56 MHz and data rates of 106, 212 and 424 kbps (Rackley, 2007). The
standard also defines the two communication modes NFC is capable of: active and passive mode
(EcmaInternational, ECMA-340, 2013).
NFCIP-2 is an extension to NFCIP-1. The NFCIP-2 standard distinguishes between the three different
modes of operation a device is using. It defines the sequence of mode-switching, which defines how a
communication mode can be properly selected and/or detected. (Coskun, Ok, & Ozdenizci, 2013)
Whether a device enters the P2P mode as initiator or as target is also defined in the NFCIP-2 standard
(EcmaInternational, ECMA-352, 2013):
The data transfer between NFC capable devices or tags is clearly defined. The NFC Data Exchange
Format (NDEF) is a binary format specification introduced by the NFC Forum, which defines the format
and rules regarding the message exchange. (Langer & Roland, 2010)
All NFC capable devices are working with NDEF. The consequence is that a device always knows
what to do with a received message, especially in case of well-known record types (Igoe, Coleman, &
Jepson, 2014).
The data exchange of NDEF messages between two endpoints in P2P mode is based on the Logical-
Link-Control Protocol (LLCP) and the Simple NDEF Exchange Protocol (SNEP) (Langer & Roland,
2010). The two protocols do not define how the exchange should be handled or how the GUI needs to look
like for the user. Each application has to implement this on its own. An example for a very popular
implementation for P2P is Android Beam (Igoe, Coleman, & Jepson, 2014).
Every NDEF message consists of one or multiple NDEF records. A NDEF record itself can be divided
into a header and its payload. The header gives information regarding the type of the record, its unique ID,
and the length of the message. The payload length of a NDEF records is limited to 2^32-1 Byte. However,
Card Emulation Mode
Peer-To-Peer Mode
Reader/Writer Mode
Applications
Card Emulation
SNEP
RTD & NDEF
LLCP
Tag Type 1-4
NFCIP-2 (Mode Switch)
NFCIP-1 / ISO 14443 (NFC-A, NFC-B) + FeliCa (NFC-F)
the messages can be chained together that’s why a NDEF message in theory has a variable length (Coskun,
Ok, & Ozdenizci, 2013).
Nevertheless, the messages tend to be shorter than longer since NFC is designed on the principle “tag
and go”. The structure of an NDEF record is described in Figure 3.
Figure 3: NDEF message structure (Coskun, Ok, & Ozdenizci, 2013)
The first five bits contained in the record header are flags each consisting of 1-bit information. Further
information in the header is defined through the Type Name Format (TNF), its payload, and its length.
The NDEF specification is used to define the data format and structure of a message. However NDEF
does not define any detailed guidelines regarding the handling of the record types. For this purpose the
Record Type Definition (RTD) is introduced by the NFC Forum (NFCForum, NFC Record Type Definition
(RTD) Technical Specification, 2006).
The RTD specification defines guidelines regarding the handling of record types to ensure that a
message can be exchanged appropriately between NFC devices or a NFC reader and a tag (Langer &
Roland, 2010). Beside the data structure and the handling of well-known record types the specification also
gives guidelines regarding the creation of external types (Igoe, Coleman, & Jepson, 2014).
A NDEF message with the defined TNF 0x01 (well-known record) or 0x04 (external record) needs to
follow the guidelines of the RTD.
A basic concept of NFC is the work with external tags. Tags are passive storage elements. NDEF
records can be read from and written to tags. To ensure compatibility, NFC tags are based on RFID tags
(Langer & Roland, 2010).
The NFC Forum distinguishes between four tag types from 1 to 4 (described in Table 1). Depending on
the use case, the needed memory, data rate, cost and other criteria each type has its pro and cons (Coskun,
Ok, & Ozdenizci, 2013).
NDEF%Record%
Record%Header%
%(variable)%
Message%Flags%%
(5%Bit)%
M
B%ME%CF%SR%I
L%
TNF%
(3%Bit)%
Type%
Length%
(1%Byte)%
Pay-load%
Length%%
(1-4%Byte)%
ID%
Length%
(1%Byte)%
Pay-load%
Type%(var.)%
Pay-
load%ID%
(var.)%
Payload%
(var.)%
Table 1: NFC tag types (Langer & Roland, 2010) (Coskun, Ok, & Ozdenizci, 2013)
Type 1
This tag type is based on the ISO/IEC 14443 Type A standard
Readable/writable
Memory up to 1 kB (can be expanded to 2 kB)
Data rate up to 106 kbps
The costs for this type of tag are very low. This makes it usable for a lot applications
requiring small memory (e.g. URL storage)
The disadvantage is that the tag only offers a collision detection at initialization but no
anti-collision. Because of this multiple tag types can’t be initialized at once
Example: Topaz%
Type 2
Based on ISO/IEC 14443 Type A standard
Readable/writable
Memory up to 2kB
Data rate up to 106 kbps
Tag costs are low
This tag type is capable of anti-collision detection multiple tags can be detected by a
reader if they are in its read range
Example: NXP Mifare%
Type 3
Based on ISO 18092 standard
Readable/writable
Memory up to 1 MB
Communication speed up to 212 kbps or 424 kbps
High tag costs
Capable of anti-collision detection
Example: Sony FeliCa%
Type 4
Based on ISO/IEC 14443 Type A and Type B standard
Readable/writable
Memory up to 64 KB
Communication speed between 106, 212 and 424 kbps
Tag costs in medium to high level
Capable of anti-collision detection
Example: NXP DESFire%
One of the most popular NFC devices is a smartphone. To make it capable of NFC it has to have some
specific components. Which components and how they work together is shown in Figure 4.
Figure 4: Principle of P2P communication (Coskun, Ok, & Ozdenizci, 2013)
According to (Coskun, Ok, & Ozdenizci, 2013) the main NFC participants in a mobile phone are:
The NFC interface consisting of
o NFC Antenna
§ An antenna is the basic module in NFC to enable the receiving and the
transmitting of a signal
o NFC Controller
§ Also called “Contactless Front-End (CLF)”
§ Modulates and demodulates the incoming and outgoing signal
§ Is capable of NFCIP-1 and other standards which enable the communication in all
3 operation modes.
Secure Element (SE) described in (Langer & Roland, 2010) as:
o The SE is the element allowing applets to run in a secure environment. This component is
also used in smart cards.
o In a smartphone you can find a SE at least one time.
o The SE is connected to the NFC Controller.
o Especially in case of mobile payment and critical data the SE is the most important
component in performing transactions.
Host Controller
o The “heart” of the mobile phone
o Application Execution Environment (AEE)
o Is linked to the NFC Controller over an interface
Depending on the operation mode, NFC can be used for different use cases. A typical use case for two
NFC devices acting in P2P mode would be the exchange of data. Suppose two persons (A and B) would
like to exchange their contact information. They do not need to type in name and number. By doing it in the
“NFC-way” A would open his/her contacts and select the contact he/she wants to share. Now A and B put
their phones together (typically back to back). The application determines on its own what should be sent.
After a confirmation by A (typically a touch) the content gets transferred to the phone of B (Coskun, Ok, &
Ozdenizci, 2013).
Host Controller
Secure
Element
NFC Controller
Antenna
Host Controller
Secure
Element
NFC Controller
Antenna
Electromagnetic
Field
<= 4cm
Active NFC initiator
Passive NFC target
NDEF & RTD
Sending big amounts of data is also possible with NFC. Nevertheless, considering the fact that the
participants would need to hold their phones together till the exchange is finished, it is used mostly for
exchanging smaller data. An alternative for sending bigger data over NFC would be the combination with
Bluetooth or WLAN, which is known under the term “NFC pairing” (Coskun, Ok, & Ozdenizci, 2013).
In case of R/W mode, smart posters are very popular examples. NFC tags on a poster contain
information that is presented to a user by a simple touch with a NFC capable device.
Tags can also be used to trigger processes like making a call, sending a SMS, a mail, or a geolocation
for example. Even shopping via NFC tags is a possibility. A NFC tag placed on a product could be read by
an application that allows a customer to make a purchase (Coskun, Ok, & Ozdenizci, 2013).
The most popular use case regarding the Card Emulation mode is cashless payment, also known as
Proximity Payment. The standard procedure for mobile payment would be to touch a card reader with a
NFC capable smart phone and to enter a passcode in order to complete the transaction. However, the
passcode is not really needed for the transaction itself.
The possibilities are almost unlimited when it comes to money transfer. Not only the process of paying,
also the debit from ATMs is possible with NFC. Only a NFC reader is needed to be attached to the ATM.
Even money transfer over a simple touch is can be achieved in P2P mode between two persons (Coskun,
Ok, & Ozdenizci, 2013).
Mobile ticketing is another important representative of the Card Emulation mode. Instead of buying the
ticket at the counter it can be bought online and saved to the phone. Touching a card reader with a smart
phone can give access to a concert, bus, train, subway-station, etc.
MOTIVATION
Even though NFC is a technology that is known mainly from the payment and ticketing sector there
exist some studies regarding the potential of NFC for completely different use cases.
In the field of learning, NFC can for example be used as a supporting tool for distributing or sharing
documents and info-material in a course. Another use case could be the proof of identity in exams
(Maierhuber, 2013).
Due to the Card Emulation and Reader/Writer mode in mobile phones even a scenario where a student
writes an exam on his/her phone (multiple-choice questions), submits it and automatically gets his/her mark
over NFC would be possible.
This research work is dedicated to the usage of Near Field Communication in the field of game based
learning. The motivation is to test the potential and the usability of NFC in the educational area through the
use of “prototyping” as research design. The outcome of the research was an Android-based quiz
application (“NFCQuiz”) using different NFC approaches for data exchange.
The application is supposed to address following benefits:
No Internet access is needed for participation. The whole game works offline.
o No need to store the questions on a web server,
o to exchange the URL with the contributing players, or
o to download a question-set .
By using re-writable tags there are basically no limits in terms of reuse
The player gets an additional interactive effect by holding the phones together for synchronization,
which in turn keeps the participants interested (Ebner & Kienleitner, 2015). The feeling you get
when playing with cards or tokens can be partially emulated.
Control over the questions and answers
o The game can be used to repeat learning content effortlessly as part of playing.
o Even multiple-choice tests could be conducted this way and their result could be available
immediately.
Different NFC capable operating systems are available on the market nowadays, according to
(NFCWorld, 2016):
Android (since Version 2.3)
Windows Mobile (since Version 6), Windows Phone (since Version 7.5)
BlackBerry OS (since BBOS 7.0)
Symbian (since Anna)
IOS (since iPhone 6 but with restrictions): iPhone 6, iPhone 6 Plus, iWatch
Android is used as operating system for the implemented prototype because of the widespread of
Android phones and the fact that the most NFC enabled smartphones nowadays are based on Android OS.
Since an overview of NFC programming in Android would go beyond the scope of this topic, the
following Chapter will only give an introduction in the sequence of the developed prototype with respect to
the main NFC components. For a detailed insight into Android programming and NFC Basics please refer
to (AndroidDevelopers, NFC Basics) and (Coskun, Ok, & Ozdenizci, 2013).
NFCQUIZ APPLICATION
The final game consists of two separate applications:
NFCQuiz the game itself
NFCQuiz-Writer an application that is used for writing the question-answer pairs to a tag
NFCQuiz is a multi-user quiz game, which distinguishes between the two roles Reader and Card. The
Reader defines the game settings like the amount of players and the amount of questions before
synchronization. In terms of NFC the Reader takes the part of an initiator by reading the question set from a
tag and sending it to the contributing players. The Card takes the part of the target. It receives the question
set from the Reader over Android Beam and responses to requests by returning the game results to the
Reader in Card Emulation mode. If the Reader is a contributing player as well we are talking of an active
Reader.
The user who is taking the part of the Reader defines the game settings. The Reader imports a NDEF
message consisting of one or more NDEF records from a NFC tag. Each record is representing one
question with 3 possible answers and an identifier marking the correct answer. After the successful import
the Reader sends the NDEF message with additional settings to every contributing player over Android
Beam. In order to get a game score and to be able to calculate the winner of the game a synchronization
between the players has to be done. Before the Reader starts the game it must be defined how often this
synchronization needs to happen. Setting the synchronization number to 3 for example means: the
contributing players (Cards) have to put their phones one after another to the Readers phone after every
third question. Since synchronization between all contributing players would increase dramatically the
more players are involved, the synchronization is done just with the Reader. Consequently, the game
statistics is only shown on the Readers phone if more than two players are involved in the game.
In the following chapters, the implementation of the two applications is described. The game structure,
operation, and the data exchange are explained in order to get a better understanding of the game.
NFCQuiz
The class diagram in Figure 5 is an overview of the used classes in NFCQuiz. The game is separated
into three Activities:
MainActivity
o The MainActivity is the main entry point of the application.
o The Config class is used to save the user defined game settings.
o The creation of NDEF records and messages as well as the reading from a tag is
implemented in the NDEFController class.
GameReaderActivity
o This Activity is called if the player is the Reader.
o This Activity uses the method enableReaderMode in order to disable all other modes
except the Reader/Writer mode.
o When using enableReaderMode a ReaderCallback needs to be defined in order to handle a
discovered tag (AndroidDevelopers, enableReaderMode). This ReaderCallback is
implemented in the class CardReaderCallback.
o CardReaderCallback
§ This class requests the game results of a Card by sending Application Protocol
Data Unit (APDU) commands.
§ If the game is played in two-player mode (1 Card and 1 active Reader) the class
sends the Readers game results to the Card as well.
GameEmulatorActivity
o This Activity is called if the player is a Card
o The Activity starts and stops the CardEmulatorService before and after the
synchronization with the Reader.
o CardEmulatorService
§ This class implements the Host Card Emulation (HCE) mode
§ It receives commands containing messages from the ReaderService and returns
the game results of the Card.
§ When the CardEmulatorService receives a message it is forwarded to the
GameEmulatorActivity for further processing.
Figure 5: Class diagram of NFCQuiz application
MainActivity Layout and Flow
The MainActivity consists of three layouts
Main-layout
o This layout is the starting point of the game.
o As depicted in Figure 6 the layout consists of a name text field and three
image buttons: Play, Cancel, and Settings
Settings-layout
o This layout is shown after the user presses the Settings button
o An example of this layout is presented in Figure 7.
o The layout is used by the Reader to define game-specific properties.
Changes made by a Card will not be considered by the game.
Progressbar-layout
o This layout consists of a progress-bar and a text that prompts the user to
initiate a NFC event (e.g. hold phone to a tag in order to read the information
on it).
o Examples of the Progress-layout are depicted in Figure 8 and Figure 9.
Game Based learning through Near Field Communication
15
Figure 6: Start layout (part of the
MainActivity) showing the name text field, start
button, cancel button, and settings button
Figure 7: Settings layout (part of the
MainActivity). The settings defined by the
Reader are used for the game.
Figure 8: TagReading layout (part of the
MainActivity) requesting the Reader to hold
his/her phone to the question tag and the Card to
hold his/her phone to the Reader.
Figure 9: TagReading layout requesting the
Reader to hold his/her phone to the first Card
Lamija Dzafic, Martin Ebner
16
At the beginning of the game the Reader defines the following properties in the settings
layout (Figure 7):
the amount of contributing players,
if he/she is one of the players,
and if the synchronization with the players should happen after the last question or
after a self-defined number of questions.
Now the Reader goes back to the main menu and presses the Play button. The layout
depicted in Figure 8 appears, telling the Reader to put his/her phone near the tag containing
the question-answer pairs for the game.
Once the reading is finished the layout shown in Figure 9 appears, requesting the Reader
to put his/her phone to one of the Cards in order to transfer the questions set. This request is
repeated for every contributing Card.
The NDEF message that is sent to the Cards is an extension of the message read from the
tag. Every question-answer pair is saved in a NDEF record. The Reader extends the message
with one additional record before beaming it to the Cards. The additional record contains the
defined game settings and a consecutive Card ID. Every future message sent from a Card to
the Reader contains this ID in order to be able to distinct the Cards from each other. As a
result every Card gets a “personalized” message with the following content:
the Card ID,
if the Reader is a contributing player or not,
the amount of questions before a comparison needs to be done with the Reader,
the questions set
When a Card receives a NDEF message over Android Beam the onNewIntent method of
the Activity is called. The extraction of a NDEF message to string records is done in this
method. This resulting string records are saved into an ArrayList and sent to the Cards
GameEmulatorActivity. After all Cards have received the questions over Android Beam the
GameReaderActivity is started for the Reader.
This process is depicted in Figure 10 for the Reader and in Figure 11 for the Card.
Game Based learning through Near Field Communication
17
Figure 10: MainActivity sequence for the Reader
Lamija Dzafic, Martin Ebner
18
Figure 11: MainActivity sequence for the Card
Game Based learning through Near Field Communication
19
GameReaderActivity and GameEmulatorActivity
Even though the game layout is the same for both roles the handling in the background is
different for the two roles. While the Reader operates in R/W mode the Cards are working in
Card Emulation mode.
The extraction of the records to question objects is done in the GameController class. A
detailed overview regarding the question-format is given in the Chapter Question-Format.
After all records have been properly extracted the game starts. Figure 12 shows the game-
layout. Each question is presented with 3 possible answers. By pressing the Next button a
player confirms his/her answer. Depending on the amounts of questions the Reader has
defined to be shown before synchronization, either the next question appears or a request
telling the player to start the synchronization (shown in Figure 13). After each adjustment a
score-board as depicted in Figure 14 is shown. A message can only be sent from one device to
another. In order to get the game results of N players to all involved phones an exchange over
NFC would need to be done N
2 times. This would result in 10 exchanges for 5 players.
Since the synchronization rate would raise dramatically with every additional player the
overview-statistics are only calculated on the Readers phone if more than 2 players are
involved.
Lamija Dzafic, Martin Ebner
20
Figure 12: Questions layout showing one
question with 3 possible answers and the Next
button
Figure 13: request telling the Reader to start
synchronization with the first Card. If the
prompt is addressed to a Card, the text will
request him/her to put his/her phone back-to-
back to the Readers phone.
Figure 14: Overview showing a summary
regarding the answered questions for every
contributing player
Figure 15: Overview layout showing the
final summary for all questions and the game
winner.
Game Based learning through Near Field Communication
21
Synchronization over NFC
For the synchronization process 3 different approaches have been tested. In order to be
able to exchange the questions statistics between two or more players, a bi-directional
connection is needed.
NFC is supported in Android since API level 9 by providing the android.nfc package.
However, since the most functionality has been introduced in API level 10 this is also the API
level that should at least be used when it comes to NFC programming for Android. (Coskun,
Ok, & Ozdenizci, 2013)
The version of the used Android device is the criterion, which defines which solution
strategy can be used for synchronization:
API level 10.0 - 14.0
o In order to exchange messages between two devices only the Android beam
functionality can be used. The exchange is done in P2P mode. Just one
NDEF message can be send during a beam. In case of NFCQuiz two players
A and B would need to hold their phones together for synchronization. The
Android Beam screen appears on both devices. A confirms the beam with a
touch in order to send his/her questions statistics to B. If B wants to replay a
message to A they need to put their devices again together, now B starts the
beam with a touch.
o The disadvantage is obvious: To be able to exchange messages between two
devices the participating users need to trigger the exchange in alternate
order.
o Used NFC methods: enableForegroundNdefPush (AndroidDevelopers,
enableForegroundNdefPush) and enableForegroundDispatch
(AndroidDevelopers, enableForegroundDispatch)
API level 14.0 19.0
o Since API level 14 two devices can exchange a NDEF message at the same
time. The exchange is still done in P2P mode. However, a user interaction is
still needed.
o The problem is that A and B need to put their phones together and to
confirm the data exchange at the same time with a touch. Since an incoming
message interrupts the outgoing beam only the message of the device where
the exchange was triggered first sends the NDEF message otherwise.
o Used NFC methods: setNdefPushMessage (AndroidDevelopers,
setNdefPushMessage) and enableForegroundDispatch (AndroidDevelopers,
enableForegroundDispatch)
API level > 19.0
o Since version 4.4 Android devices can emulate cards based on NFC-Forum
ISO-DEP specification without involving a secure element through Host
Card Emulation (HCE). The ability to do so brings many new use cases.!Any
Android device can now be used instead of a Smart Card.
(AndroidDevelopers, Host-based Card Emulation)
Lamija Dzafic, Martin Ebner
22
o Another resulting advantage is that a NFC capable device in reader mode
can act as Reader for HCE cards. (AndroidDevelopers, Android KitKat -
New NFC capabilities through Host Card Emulation)
o A bi-directional communication can be established by one device acting in
Reader mode and one device acting in Card Emulation mode.
o The communication unit between a reader and a card is called Application
Protocol Data Unit (APDU). The specification for APDUs is defined in
ISO/IEC 7816-4 (ISO/IEC, 2005).
o A command-APDU is sent by the reader. It consists of a mandatory head of
4 byte and an optional body of variable length. The card answers with a
response-APDU consisting of an optional body and 2 mandatory status bytes
at the end. (CardWerk).
For NFCQuiz all three approaches have been tested. The final game is using a HCE
service in order to achieve a real bi-directional communication between Reader and Card.
The GameReaderActivity process is depicted in Figure 16 for the Reader and the
GameEmulatorActivity in Figure 17 for the Card. Because of simplification only the main
actors are shown in the sequence diagrams.
Game Based learning through Near Field Communication
23
Figure 16: GameActivity sequence for a Reader
Lamija Dzafic, Martin Ebner
24
Figure 17: GameActivity sequence for a Card
Game Based learning through Near Field Communication
25
NFCQuiz-Writer
This application has been created as it was not possible to find a free application that is
able to write multiple NDEF text records to one tag. An alternative would have been to write
one big message and to separate the question-answer-pairs by a special character.
Nevertheless a solution with a user-specific layout seemed to be the best solution.
The NFCQuiz-Writer was separated from the NFCQuiz game because
its functionalities are not exclusively bound to the game and
a separate app made more sense since the idea was that the questions are written to a
tag by a teacher/parent
Question-Format
The biggest problem about saving the questions to a tag is the available memory. For the
application, four different tag types with memory from 144 byte to 4096 byte have been
tested. Since one record (question and answer) takes per average about 80-byte storage space,
memory consumption was an issue. To use as less memory as possible plain/text record types
have been used with the CSV format shown in Table 2.
Table 2: NFCQuiz question format
1 record:
Question;answerA;answerB;answerC;correctAnswerId
2 record:
Question;answerA;answerB;answerC;correctAnswerId
A corresponding example to this format is shown in Figure 18.
Figure 18: example of 2 question records in NFCQuiz
NFCQuiz-Writer supports 2 ways of writing a NDEF message to a tag:
Upload over a CSV file.
Defining the question-records in the user interface one by one.
Every question-answer-pair is encapsulated into a NDEF record. The records are in turn
part of a NDEF message.
The main screen of NFCQuiz-Writer is depicted in Figure 19. The tag writing can be
done either by importing the questions set from an existing CSV file or by defining the
questions one by one in the application.
What%is%the%biggest%planet%in%our%solar%
system;Mars;Earth;Jupiter;3
What%is%the%chemical%symbol%for%the%element%oxygen;H;O;Ag;2
Lamija Dzafic, Martin Ebner
26
CSV file:
In order to use this option the questions set needs to be defined in the format as
described in Table 2. Otherwise NFCQuiz won’t be able to separate the questions
correctly. After pressing the CSV button in the main form a file chooser dialog
(Figure 20) appears where the user can select the CSV file containing the questions
set.
Defining questions in the application:
The question-answer pairs can be defined one by one in NFCQuiz-Writer as well.
The layout (Figure 21) is similar to the one used in NFCQuiz. The user defines a
question and three possible answers, whereas the correct answer is identified through
the radio button. An example of a defined question is depicted in Figure 22. The plus
button causes the creation of further questions. The save button starts the writing
process.
After choosing a CSV file or pressing the save button the questions set is encapsulated
into a NDEF message. The layout depicted in Figure 23 appears requesting the user to put
his/her phone near a tag in order to write the data. The writing process starts after a tag is
discovered in read range of the phone.
Game Based learning through Near Field Communication
27
Figure 19: NFCQuiz-Writer main layout
showing 2 buttons: Writing from CSV file and
creating records in the app
Figure 20: File chooser dialog of NFCQuiz-
Writer. Shown after click on CSV button in the
main screen.
Figure 21: Create question layout in
NFCQuiz-Writer
Figure 22: Create question layout in
NFCQuiz-Writer with an example
Lamija Dzafic, Martin Ebner
28
Figure 23: NFCQuiz-Writer the progress
bar layout appears if the application is waiting
for an incoming NFC event
Application examples
NFCQuiz is designed in a way that one Reader and one or more Cards need to contribute.
Since a teacher/parent should have the opportunity to control the game and to adjust the
questions/answers between all players without participating in answering of the questions the
Reader doesn’t need to be one of the contributing players.
The standard configuration of NFCQuiz is set up for 2 players where the Reader is an
active player. Further the standard synchronization setting is done after each question.
Example 1: Standard configuration with a predefined tag
Suppose two kids playing NFCQuiz. The game starts equally for both players. The main
screen is shown as depicted in Figure 6. Each player enters his/her name and presses the play
button.
In the next step the screen shown in Figure 8 appears telling each player to put his/her
phone with its back either to the tag containing the questions or to the Readers phone. Since
only two gamers are playing it does not matter who will read from the tag. One of the players,
let’s say player A, puts his/her phone to the tag in order to read all questions from it. Once the
reading process is done player A is requested to hold his/her phone to the phone of player B
in order to send the questions to him/her as well (Figure 9). After the transfer/receipt the
game starts with the first question for both players equally (Figure 12).
Since the standard configuration is defined to make the synchronization after each
question the form shown in Figure 13 appears each time a player presses the next button.
Players are not forced to answer questions within a special amount of time, so no time limit is
Game Based learning through Near Field Communication
29
imposed. An exchange can only be done if both players have answered their question and
confirmed their answer with the Next button.
If the phones are close enough together the exchange of the game state is done in Card
Emulation mode where one of the phones emulates a card and the other one a card reader.
Once the exchange has finished, the actual game summary is presented to each player
(example shown in Figure 14). The game continues after pressing the next button in the
overview form.
This process is repeated till all questions are answered. The final screen shows the game
summary with the calculated winner below as depicted in Figure 15.
Example 2: 2 Players and 1 passive Reader
Suppose a parent with two children who wants them to repeat learned lessons with the
help of NFCQuiz. In order to do so, the parent (=Reader) opens the NFCQuiz-Writer
application, defines the questions-set, and writes it to a tag.
Now the Reader starts NFCQuiz game and opens the settings form. The configuration for
this scenario would be:
Amount Player: 2
Comparison at the end
TagReader is a player: unchecked
The Reader defines these settings and saves them by pressing the next button in order to
return to the main-screen. A click on the Start button triggers the form shown in Figure 8.
Like in the first example the Reader needs to hold his/her phone to the tag in order to get all
questions. After successful reading he/she will be requested to beam the questions-set in
sequence to the contributing players (Figure 9).
Both children (A and B) start the game by entering their names and pressing the start
button. Now each of them needs to put his/her phone to the Readers phone in order to get the
questions.
The game starts for A and B after correct receipt. Since the synchronization was defined
to be done at the end, both players need to answer all questions till the request appears asking
each of them to put his/her phone to the Readers phone. Suppose B has finished prior to A. B
puts his/her smartphone to the Reader and transfers the game results. The Reader waits now
till A finishes as well before creating a final game summary. The player order is irrelevant for
synchronization. The overview screen containing an overall summary with the game winner
is only presented on the Readers phone since only he/she has all player results.
Example 3: N Players and 1 active Reader
A possible scenario could be:
A teacher defines the questions and answers prior by using NDEFQuiz-Writer
He/she gives the resulting tag to a group of students
One of the students takes the part of the Reader while he/she is a contributing player
as well
Lamija Dzafic, Martin Ebner
30
Settings:
Amount player: N
Comparison after how many questions: N
TagReader is a player: checked
The game scenario is the same as in example 2 with the following differences:
the Reader needs to answer the questions as well
The synchronization can only start after the Reader has answered the defined number
of questions.
CONCLUSION
This paper dealt with the usage of NFC in the field of game-based learning environments.
In order to get an understanding of the technology, NFC was introduced in Chapter State
of the Art. A brief overview of NFC was given, explaining the different modes of operation in
NFC, and giving examples regarding their usage.
An analysis concerning the potential of NFC was made by developing a prototype
application called NFCQuiz. The application components, its implementation and possible
use cases have been presented in Chapter NFCQuiz Application.
The presented version of the game needs a tag with enough memory in order to store the
questions. Considering the fact that NFC tags do not come with a great amount of memory
this could be handled by splitting records into multiple messages distributed over more tags.
Nevertheless, a similar game could even work without a tag. A computer with a NFC
reader/writer attached to it could take the role of the Reader and additionally create the
questions without an external tag. Game instructions and an overview of the current game
state could be displayed on the computer monitor.
In this way basically every board game could be reproduced by an application using
NFC. The expected advantages would be:
No need of internet access. An exception could be the download of new issues or
game scenarios.
An interactive effect is given to the participants by holding the phones together for
synchronization. Participants do not have to “only” press buttons on their phone.
Existing traditional games could be reproduced cheaper and without the use of resources
like paper or plastic.
Quiz applications offering the possibility to create self-defined questions exist already.
Nevertheless these applications either do not support multi player usage or if they do, they
offer a complicated way of questions up- and downloading in order to make the questions set
available to all contributing players.
Game Based learning through Near Field Communication
31
REFERENCES
AndroidDevelopers. (n.d.). Retrieved August 31, 2016, from
https://developer.android.com/reference/android/nfc/NfcAdapter.html#enableForegro
undDispatch(android.app.Activity, android.app.PendingIntent,
android.content.IntentFilter[], java.lang.String[][])
AndroidDevelopers. (n.d.). Retrieved August 31, 2016, from
https://developer.android.com/reference/android/nfc/NfcAdapter.html#enableForegro
undNdefPush(android.app.Activity, android.nfc.NdefMessage)
AndroidDevelopers. (n.d.). Retrieved August 31, 2016, from
https://developer.android.com/reference/android/nfc/NfcAdapter.html#setNdefPush
Message(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...)
AndroidDevelopers. (n.d.). Retrieved August 31, 2016, from
https://developer.android.com/about/versions/kitkat.html
AndroidDevelopers. (n.d.). Android Developers. Retrieved July 29, 2016, from
https://developer.android.com/guide/topics/connectivity/nfc/hce.html
AndroidDevelopers. (n.d.). Android Developers. Retrieved July 29, 2016, from
https://developer.android.com/guide/topics/connectivity/nfc/nfc.html
AndroidDevelopers. (n.d.). Android Developers. Retrieved July 29, 2016, from
https://developer.android.com/reference/android/nfc/NfcAdapter.html#enableReader
Mode(android.app.Activity, android.nfc.NfcAdapter.ReaderCallback, int,
android.os.Bundle)
CardWerk. (n.d.). CardWerk. Retrieved August 25, 2016, from
http://www.cardwerk.com/smartcards/smartcard_standard_ISO7816-
4_5_basic_organizations.aspx
Coskun, V., Ok, K., & Ozdenizci, B. (2013). Professional NFC Application Development for
Android. John Wiley & Sons.
EcmaInternational. (2013, June). Near Field Communication - Interface and Protocol
(NFCIP-1). Retrieved January 18, 2016, from http://www.ecma-
international.org/publications/files/ECMA-ST/Ecma-340.pdf
EcmaInternational. (2013, June). Near Field Communication Interface and Protocol - 2
(NFCIP-2). Retrieved Janauary 18, 2016, from http://www.ecma-
international.org/publications/files/ECMA-ST/ECMA-352.pdf
Finkenzeller, K., & Müller, D. (2010). RFID Handbook: Fundamentals and Applications in
Contactless Smart Cards, Radio Frequency Identification and Near Field-
Communication. John Wiley & Sons.
Igoe, T., Coleman, D., & Jepson, B. (2014). Beginning NFC. O'Reilly Media.
ISO/IEC. (2005). ISO/IEC 7816-4. Retrieved August 25, 2016, from
http://www.embedx.com/pdfs/ISO_STD_7816/info_isoiec7816-
4%7Bed2.0%7Den.pdf
Keen, I. (April 2009). NFC Technology Overview. Abgerufen am 31. August 2016 von
https://outlook.live.com/owa/?path=/attachmentlightbox
Langer, J., & Roland, M. (2010). Anwendung und Technik von Near Field Communication
(NFC). Berling Heidelberg: Springer.
Lamija Dzafic, Martin Ebner
32
Macias, E., & Wyatt, J. (2014, April). ti.com. Retrieved August 20, 2016, from
http://www.ti.com/lit/an/sloa192/sloa192.pdf
Maierhuber, M. (2013). Potentiale von NFC für Lehr- und Lernunterlagen. Graz: Institut für
Informationssysteme und Computer Medien, Technische Universität Graz.
NearFieldCommunication.org. (n.d.). nearfieldcommunication.org (Tag Types & Modes of
Operation). Retrieved January 18, 2016, from
http://www.nearfieldcommunication.org/tag-types.html
NFCForum. (2006, July 24). NFC Record Type Definition (RTD) Technical Specification.
Retrieved August 24, 2016, from
http://www.cardsys.dk/download/NFC_Docs/NFC%20Record%20Type%20Definiti
on%20(RTD)%20Technical%20Specification.pdf
NFCForum. (n.d.). NFC Forum. Retrieved January 18, 2016, from http://nfc-forum.org/what-
is-nfc/what-it-does/
NFCWorld. (2016, July 26). NFCWorld. Retrieved July 29, 2016, from
http://www.nfcworld.com/nfc-phones-list/
Rackley, S. (2007). Wireless Networking Technology: From Principles to Successful
Implementation. Newnes.
Tamm, G., & Tribowski, C. (2010). RFID: Informatik im Fokus. Berling Heidelberg:
Springer.
... Other than the association with linguistic information found in game-based learning applications, there are also associations with non-linguistic information, such as audiovisual cues, dynamic images as in video [7], and also physical movements such as gestures [8]. Another different point of view about game-based learning also came from Dzafic and Ebner [9]. The use of NFC in game-based learning, create new innovation and experience. ...
... Many terms are difficult to recall and remember. In addition, many researcher combine another device such as gesture recognizer [8] and NFC device [9] to create game-based learning but less combination with speech recognizer. This inspires us to create a game-based learning that combine with other device such as Microsoft Kinect to recognize the voice. ...
... C# also combines the high productivity of Rapid Application Development and the "raw power" of C++. The C# is usually included in Microsoft's Visual Studio line of products (as Visual C#), usually used by developers and programmers to develop a graphical-based program, combined with .NET Framework and LINQ as their main platforms [9]. ...
... NFC, since its rise as a communication technology, has been utilized as a key component in many fields of mobile computing with recent research focusing on NFC-based solutions for mobile tourism applications [12], wireless power transfer systems [13], airport baggage claim systems [14], and game-based learning applications [15] in addition to well-known mobile payment applications. ...
Article
Full-text available
The use of Near Field Communication (NFC) technology for contactless mobile transactions has become popular in the past decade with the availability of this technology in mobile devices. Today, there are millions of NFC-enabled mobile handsets in the market, with mobile handset manufacturers and mobile network operators enabling m-wallet solutions using the Secure Elements (SE) that they own, thus can remotely control, on the devices. While this approach gives full control to the SE owner to activate any mobile transaction system on a device, having a more flexible approach would increase the benefits that end users could obtain from this technology in a variety of use cases. In this paper, we introduce a novel protocol for the NFC-based mobile transaction procedure, which uses tamper-resistant SEs that are already installed at the transaction terminals, and is mobile handset manufacturer and mobile network operator independent. We evaluate and show the feasibility of the use of our proposed model with common mobile electronic payment scenarios. The evaluation results demonstrate that the proposed solution is promising for adoption as a secure NFC transaction model, which will have applications in various security-sensitive IoT scenarios, including but not limited to, mobile identification, healthcare, payment and access control.
Book
Full-text available
There has been little practical guidance available on NFC programming, until now. If you're a programmer or developer, get this unique and detailed book and start creating apps for this exciting technology. NFC enables contactless mobile communication between two NFC-compatible devices. It's what allows customers to pay for purchases by swiping their smartphones with Google Wallet, for example. This book shows you how to develop NFC applications for Android, for all NFC operating modes: reader/writer, peer-to-peer, and card emulation. The book starts with the basics of NFC technology, an overview of the Android OS, and what you need to know about the SDK tools. It then walks you through all aspects of NFC app development, including SE programming. You'll find all you need to create an app, including functioning, downloadable code and a companion website with additional content. Valuable case studies help you understand each operating mode in clear, practical detail. Shows programmers and developers how to develop Near Field Communication (NFC) applications for Android, including Secure Element (SE) programming Expert authors are NFC researchers who have a deep knowledge of the subject Covers app development in all NFC operating modes: reader/writer, peer-to-peer, and card emulation Includes valuable case studies that showcase several system design and analysis methods, such as activity diagram, class diagram, UML, and others.
Article
Animal IdentificationContactless Smart CardsISO 69873 – Data Carriers for Tools and Clamping DevicesISO 10374 – Container IdentificationVDI 4470 – Anti-theft Systems for GoodsItem Management
Activity, android.nfc.NdefMessage) AndroidDevelopers. (n.d.)
  • Androiddevelopers
AndroidDevelopers. (n.d.). Retrieved August 31, 2016, from https://developer.android.com/reference/android/nfc/NfcAdapter.html#enableForegro undNdefPush(android.app.Activity, android.nfc.NdefMessage) AndroidDevelopers. (n.d.). Retrieved August 31, 2016, from https://developer.android.com/reference/android/nfc/NfcAdapter.html#setNdefPush Message(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...) AndroidDevelopers. (n.d.). Retrieved August 31, 2016, from https://developer.android.com/about/versions/kitkat.html AndroidDevelopers. (n.d.). Android Developers. Retrieved July 29, 2016, from https://developer.android.com/guide/topics/connectivity/nfc/hce.html
Near Field Communication Interface and Protocol -2 (NFCIP-2). Retrieved Janauary 18
  • Ecmainternational
EcmaInternational. (2013, June). Near Field Communication -Interface and Protocol (NFCIP-1). Retrieved January 18, 2016, from http://www.ecmainternational.org/publications/files/ECMA-ST/Ecma-340.pdf EcmaInternational. (2013, June). Near Field Communication Interface and Protocol -2 (NFCIP-2). Retrieved Janauary 18, 2016, from http://www.ecmainternational.org/publications/files/ECMA-ST/ECMA-352.pdf
NFC Technology Overview. Abgerufen am 31
  • I Keen
Keen, I. (April 2009). NFC Technology Overview. Abgerufen am 31. August 2016 von https://outlook.live.com/owa/?path=/attachmentlightbox
  • E Macias
  • J Wyatt
Macias, E., & Wyatt, J. (2014, April). ti.com. Retrieved August 20, 2016, from http://www.ti.com/lit/an/sloa192/sloa192.pdf
Potentiale von NFC für Lehr-und Lernunterlagen
  • M Maierhuber
Maierhuber, M. (2013). Potentiale von NFC für Lehr-und Lernunterlagen. Graz: Institut für Informationssysteme und Computer Medien, Technische Universität Graz.
NFC Record Type Definition (RTD) Technical Specification
  • Nfcforum
NFCForum. (2006, July 24). NFC Record Type Definition (RTD) Technical Specification. Retrieved August 24, 2016, from http://www.cardsys.dk/download/NFC_Docs/NFC%20Record%20Type%20Definiti on%20(RTD)%20Technical%20Specification.pdf
Wireless Networking Technology: From Principles to Successful Implementation
  • S Rackley
Rackley, S. (2007). Wireless Networking Technology: From Principles to Successful Implementation. Newnes.