SlideShare une entreprise Scribd logo
1  sur  32
How to Build an
     NFC
  Application
                                   Richard Grundy
                                     @grundyoso
                                  http://flomio.com

How to Build an NFC Application                       1
Agenda

• Anatomy of an NFC App
• NFC Interface
   o Technologies
       • Learn the specs
   o Tags (Demo 1)
       • Learn the types
   o NDEC (Demo 2 and 3)
       • Learn to format/read/write
   o Infrastructure
       • There’s a stack for that
   o Application
       • Give it logic




How to Build an NFC Application       2
Anatomy
                       Web Service                 Web Service              Web Service



                                                   Middleware



                   Reader             Reader         Reader        Reader            Reader
NFC App

                    Tag         Tag        Tag        Tag        Tag        Tag            Tag

                    Tag         Tag        Tag        Tag        Tag        Tag            Tag



                                         Passive                                  Active




  How to Build an NFC Application                                                                3
Anatomy




   Middleware


    NFC Interface




How to Build an NFC Application   4
Interface




 How to Build an NFC Application   5
Interface




  13.56Mhz
   1 wavelength = 7.37e-8secs of
     22.1m
   Theoretical range = 3.5m



 How to Build an NFC Application    6
Interface
  • NFC International Specifications*


NDEF

TAGS

TECH


                                     *http://www.flomio.com/docs/ > NFC International Standards




   How to Build an NFC Application                                                                7
Technology
•     ISO 14443-3A: NFC-A
•     ISO 14443-3B: NFC-B
•     JIS 6319-4: NFC-F
•     ISO 15693: NFC-V
•     Terms
       o   ASK
       o   PCD
       o   PICC
       o   PDU
       o   REQ
       o   ATQ
       o   UID/UUID
       o   RFU
•     APDU
       o   CLA, INS, P1, P2, L(c), L(e)
       o   SW1, SW2, L(e)
•     ATR = Answer to Reset
       o   MFR
•     PTS = Protocol Type
      Selection
       o   T=0 Byte level tx
       o   T=1 Block level tx



    How to Build an NFC Application       8
Tags

• NFC Forum: Types 1
    o Jewel Topaz
• NFC Forum: Types 2
    o Mifare Ultralight S,C
• NFC Forum: Types 3
    o Felicia
• NFC Forum: Types 4
    o Mifare DESfire S, EV1
    o Mifare Classic 1k, 4k
    o Mifare Plus 1k, 4k
                                   Options:
• ISO 15693                          Media
    o I-Code SLI                     Ferrite/Metal Mount
    o Tag IT
• Proprietary: Many more

 How to Build an NFC Application                           9
Demo

1. Requirement
    1.    Android 4.0 NFC-enabled handset

2. Download from Google Play:
    1.    NFC TagInfo by Michael Roland

3. Enable NFC (phone boots with NFC off):
    1.    Menu  System Settings  Wireless & Networks  More
    2.    Check NFC box

4. Scan some tags and study ―Tag Information …‖
    1.    UID(x)
    2.    RF Technology
    3.    Tag Type
    4.    Manufacturer
    5.    Target technology classes (Android)

 How to Build an NFC Application                                10
NDEF
• Mifare Memory Structure
   o   Sectors
   o   Blocks
   o   Keys
   o   Access Bits




How to Build an NFC Application          11
NDEF
                                  • Get ATR – Is MiFare 1k
                                  • Set Reader Read Key (FF FF FF
                                    FF FF)
                                  • Authenticate Reader to Tag
                                    Sector 0
                                       o Is NFC Initialized? How do you
                                         know?
                                  •   Set write key (FF FF FF FF FF)
                                  •   Write MAD
                                  •   Write Keys and Access Bits
                                  •   Write first empty record

How to Build an NFC Application                                           12
NFC Forum Defined                  Not NFC Forum Defined
• Text                             • Payment • Mime Types
    o urn:nfc:wkt:T
• URI                              • Coupon           Vendor
    o urn:nfc:wkt:U                • Start a Car
                                     Application
• Smart Poster                     • Etc.             Etc.
    o urn:nfc:wkt:Sp
• Signature
    o urn:nfc:wkt:Sig
                                   • Mime Types
• Handover                            o Vendor
    o urn:nfc:wkt:HO                  o Application
• …                                   o Etc.



 How to Build an NFC Application                               13
Demo

1. Requirement
    1.    Android 4.0 NFC-enabled handset
2. Download from Google Play:
    1.    NXP TagWriter Lite Edition
3. Enable NFC (phone boots with NFC off):
    1.    Menu  System Settings  Wireless & Networks  More
    2.    Check NFC box
4. Create and Write some tags with NDEF Records
    1.    Contact — Add a vcard: Richard @ 305-982-7424
    2.    URL — Enter a web address: http://www.flomio.com
    3.    Plain Text — Add this text ―Hello World!‖
    4.    SMS — Prepare message: 305-982-7424 — ―Sup Flomio!‖
5. Now TAP-TO-X!

 How to Build an NFC Application                                14
Infrastructure




 How to Build an NFC Application   15
General Credit Card (CC) Approval/Payment Process using NFC




 How to Build an NFC Application                              16
Application
• Android offers comprehensive NFC support:
   o 2.3.2 API 10 Gingerbread
   o 2.3.3
   o 2.3.4
   o 4.0         Ice Cream Sandwitch
       • Beam
   o Available
       • Tag Read/Write
       • Tag Emulate
       • P2P with another Android
   o Not Available
       • Smart Card Emulation
       • P2P Generalized




How to Build an NFC Application               17
Android




http://developer.android.com/guide/topics/nfc/nfc.html#ndef




How to Build an NFC Application                               18
Death by Dialog




 How to Build an NFC Application   19
Android Setup

• Register a detailed intent filter in the app’s
  AndroidManifest.xml
• Get Adapter Handle and Set Listen Filters

    mAdapter = NfcAdapter.getDefaultAdapter(this);

    mOutPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this,
                 getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

    IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED);
    // ndef.addAction(NfcAdapter.ACTION_TAG_DISCOVERED);

    mFilters = new IntentFilter[] { ndef, };

    mTechLists = new String[][] {new String[] { android.nfc.tech.NfcV.class.getName() },
                                  new String[] { android.nfc.tech.IsoDep.class.getName()
    }, new String[] { NfcF.class.getName() } };


 How to Build an NFC Application                                                       20
Android Intents
public void onResume() {
super.onResume();

       if (isSending) {
               if (mAdapter != null)                                   Send P2P NDEF Message
               mAdapter.enableForegroundNdefPush(this, mMessage);
       } else {
               mAdapter.enableForegroundDispatch(this,
               mOutPendingIntent,
               mFilters, mTechLists);

            if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent()
            .getAction())) {
                                                                       NDEF Received
                      processIntent(getIntent());
            } else if
            (NfcAdapter.ACTION_TAG_DISCOVERED.equals(getIntent()
            .getAction())); {
                      processTagIntent(getIntent());
            }                                                          Tag no NDEF
       }


}




    How to Build an NFC Application                                                     21
Android Process Info
    /** * Parses the NDEF Message from the intent and prints to the TextView */
    void processIntent(Intent intent) {
           mText = (TextView) findViewById(R.id.textInfo);
           // get the data
           Parcelable[] rawMsgs = intent
           .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
           // only one message sent during the beam
           NdefMessage msg = (NdefMessage) rawMsgs[0];
           // record 0 contains the MIME type, record 1 is the AAR, if present
           mText.setText(new String(msg.getRecords()[0].getPayload()));
    }

    /** Show tag found **/
    void processTagIntent(Intent intent) {
           mText = (TextView) findViewById(R.id.textInfo);
           // get the tag handle and data
           Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);

          if (tag != null) {
                   // tell me about the tag found
                   mText.setText(new String("Tag discovered:" + tag.toString()));

          } else {
          // lost tag or not finished
          Log.i(APPTAG, "Tag not ready or no longer there");
          };
    }




 How to Build an NFC Application                                                    22
Android Make NDEF

public static NdefRecord newTextRecord(String text, Locale
locale,boolean encodeInUtf8) {
       byte[] langBytes = locale.getLanguage().getBytes(Charset.forName("US-ASCII"));
       Charset utfEncoding = encodeInUtf8 ? Charset.forName("UTF-8") : Charset.forName("UTF-16");
       byte[] textBytes = text.getBytes(utfEncoding);
       int utfBit = encodeInUtf8 ? 0 : (1 << 7);
       char status = (char) (utfBit + langBytes.length);
       byte[] data = new byte[1 + langBytes.length + textBytes.length];
       data[0] = (byte) status;
       System.arraycopy(langBytes, 0, data, 1, langBytes.length);
       System.arraycopy(textBytes, 0, data, 1 + langBytes.length,textBytes.length);
       return new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_TEXT, new byte[0], data);
}

String mTextPayload = "JOHN A. DOE,YBC99999999" + mSequence;
mMessage = new NdefMessage(new NdefRecord[] {
newTextRecord(mTextPayload, Locale.ENGLISH, true) });




    How to Build an NFC Application                                                                 23
How to Build an NFC Application   24
How to – Construct NDEF

     Header                          Location
                                                      7
                                                       Abbrev
                                                       MB
                                                                        Name
                                                                        Message Begin
                                                                                                            FALSE
                                                                                                                         0
                                                                                                                                   TRUE
                                                                                                                                              1
                                                      6ME               Message End                                      0                    1
                                                      5CF               Chunk Flag                                       0                    1
                                                      4SR               Short Record                                     0                    1
                                                      3IL               ID Length                                        0                    1
                                                      2                                                                  0                    1
                                                      1 TNF             Type Name Format                                 0                    1
                                                      0                                                                  0                    1

d1        1        1        0          1          0      0          0    1 c9        1        1        0          0            1    0         0        1
          7        6        5          4          3      2          1    0           7        6        5          4            3    2         1        0
     MB       ME       CF       SR       IL                   TNF               MB       ME       CF       SR        IL                 TNF
                                  Type Length                                                                 Type Length
                                 Payload Length                                                             Payload Length 3
                                                                                                            Payload Length 2
                                      Type
                                                                                                            Payload Length 1
                                       ID
                                                                                                            Payload Length 0
                                    Payload
                                                                                                               ID Length
                                                                                                                 Type
                                                                                                                   ID
      How to Build an NFC Application                                                                           Payload                           25
Type Name Format TNF
                                                             Well Known Record Types
                                          urn:nfc:wkt:T      T               0x54
 Type Name Format (TNF)                   urn:nfc:wkt:U      U               0x55
 Empty           0x00
 Well Known Type 0x01
                                          urn:nfc:wkt:Sp     Sp              0x53 0x70
 Media           0x02                     urn:nfc:wkt:Sig    Sig             0x53 0x69      0x67
 Absolute URI    0x03
 External        0x04
 Unk             0x05                                                                                 Language
 Unchanged       0x06                                                                        en           0x65   0x6E
 Reserved        0x07                           Urn:nfc:mime/vnd.m360.id                     fr           0x66   0x72
                                                                                             sp           0x73   0x70
                                                                                             de           0x64   0x65




                          urn:nfc:ext:M360:id
                                                                               Uri Identifier Codes
                                                                             None              0x00
                                                                             http://www.       0x01
                                                                             https://www.      0x02
                                                                             http://           0x03
                                                                             https://          0x04
                                                                             tel:              0x05
                                                                             mailto:           0x06



How to Build an NFC Application                                                                                         26
Smart Poster NDEF Message

      0 &HD1   209 0xD1   record header   12   17 &H77   119 0x77   w               29   34 &H54    84 0x54   T
      1 &H2      2 0x02   type length     13   18 &H77   119 0x77   w               30   35 &H2      2 0x02   language lnght
      2 &H28    40 0x28   length          14   19 &H77   119 0x77   w               31   36 &H65   101 0x65   e
      3 &H53    83 0x53   S               15   20 &H2E    46 0x2E   .               32   37 &H6E   110 0x6E   n
      4 &H70   112 0x70   p               16   21 &H6D   109 0x6D   m               33   38 &H4D    77 0x4D   M
 0    5 &HD1   209 0xD1   record header   17   22 &H6F   111 0x6F   o               34   39 &H6F   111 0x6F   o
 1    6 &H1      1 0x01   type length     18   23 &H62    98 0x62   b               35   40 &H62    98 0x62   b
 2    7 &H16    22 0x16   length          19   24 &H69   105 0x69   i               36   41 &H69   105 0x69   i
 3    8 &H55    85 0x55   U               20   25 &H74   116 0x74   t               37   42 &H74   116 0x74   t
 4    9 &H0      0 0x00   prefix          21   26 &H61    97 0x61   a               38   43 &H61    97 0x61   a
 5   10 &H68   104 0x68   h               22   27 &H6F   111 0x70   p               39   44 &H70   112 0x70   p
 6   11 &H74   116 0x74   t               23   28 &H2E    46 0x2E   .               40   45 &HFE   254 0xFE   end
 7   12 &H74   116 0x74   t               24   29 &H6D   109 0x6D   m
 8   13 &H70   112 0x70   p               25   30 &H65   101 0x65   e
 9   14 &H3A    58 0x3A   :               26   31 &HD1   209 0xD1   record header
10   15 &H2F    47 0x2F   /               27   32 &H1      1 0x01   type length
11   16 &H2F    47 0x2F   /               28   33 &HA     10 0x0A   length




     How to Build an NFC Application                                                                                 27
Smart Poster




 How to Build an NFC Application   28
Smart Poster Complex




 How to Build an NFC Application   29
Signed Smart Poster




 How to Build an NFC Application   30
Handling Records




 How to Build an NFC Application   31
Thank you




      Touch the web.

      Richard Grundy
      Twitter: @flomio
      Web: www.flomio.com




How to Build an NFC Application   32

Contenu connexe

Tendances

Near Field Communication by Mohammed Mudassir
Near Field Communication by Mohammed MudassirNear Field Communication by Mohammed Mudassir
Near Field Communication by Mohammed MudassirMohammed Mudassir
 
Introduction to nfc
Introduction to nfcIntroduction to nfc
Introduction to nfcRay Cheng
 
NFC Forum Tap Into NFC Developer Event
NFC Forum Tap Into NFC Developer EventNFC Forum Tap Into NFC Developer Event
NFC Forum Tap Into NFC Developer EventNFC Forum
 
NFC (Windows 8/ Windows Phone 8 )
NFC (Windows 8/ Windows Phone 8 )NFC (Windows 8/ Windows Phone 8 )
NFC (Windows 8/ Windows Phone 8 )Bill Chung
 
Android Basic Presentation (Introduction)
Android Basic Presentation (Introduction)Android Basic Presentation (Introduction)
Android Basic Presentation (Introduction)RAHUL TRIPATHI
 
Ultrabook Development Using Sensors - Intel AppLab Berlin
Ultrabook Development Using Sensors - Intel AppLab BerlinUltrabook Development Using Sensors - Intel AppLab Berlin
Ultrabook Development Using Sensors - Intel AppLab BerlinIntel Developer Zone Community
 
Near field communication
Near field communicationNear field communication
Near field communicationNagesh Mishra
 
Rfid and the Mobile phone quiz
Rfid and the Mobile phone quizRfid and the Mobile phone quiz
Rfid and the Mobile phone quizTheodor Tolstoy
 
NEAR FIELD COMMUNICATION
NEAR FIELD COMMUNICATIONNEAR FIELD COMMUNICATION
NEAR FIELD COMMUNICATIONHarisankar U K
 
Ask Contactless Terminals
Ask Contactless TerminalsAsk Contactless Terminals
Ask Contactless Terminalsclaren65
 
NFC in direct mail: The pros and cons
NFC in direct mail: The pros and consNFC in direct mail: The pros and cons
NFC in direct mail: The pros and consCPS Cards
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Andreas Jakl
 
NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016Laurent Dardé
 
RFID and NFC Providing the last yards for IoT
RFID and NFC Providing the last yards for IoTRFID and NFC Providing the last yards for IoT
RFID and NFC Providing the last yards for IoTCPqD
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartAndreas Jakl
 
NFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesignNFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesignHamed M. Sanogo
 
"Combinando NFC y Datos en la Etiqueta RFID para Apoyar AAL" presentada por D...
"Combinando NFC y Datos en la Etiqueta RFID para Apoyar AAL" presentada por D..."Combinando NFC y Datos en la Etiqueta RFID para Apoyar AAL" presentada por D...
"Combinando NFC y Datos en la Etiqueta RFID para Apoyar AAL" presentada por D...3JornadasRFID
 

Tendances (20)

Near Field Communication by Mohammed Mudassir
Near Field Communication by Mohammed MudassirNear Field Communication by Mohammed Mudassir
Near Field Communication by Mohammed Mudassir
 
Introduction to nfc
Introduction to nfcIntroduction to nfc
Introduction to nfc
 
NFC Forum Tap Into NFC Developer Event
NFC Forum Tap Into NFC Developer EventNFC Forum Tap Into NFC Developer Event
NFC Forum Tap Into NFC Developer Event
 
NFC (Windows 8/ Windows Phone 8 )
NFC (Windows 8/ Windows Phone 8 )NFC (Windows 8/ Windows Phone 8 )
NFC (Windows 8/ Windows Phone 8 )
 
Android Basic Presentation (Introduction)
Android Basic Presentation (Introduction)Android Basic Presentation (Introduction)
Android Basic Presentation (Introduction)
 
Ultrabook Development Using Sensors - Intel AppLab Berlin
Ultrabook Development Using Sensors - Intel AppLab BerlinUltrabook Development Using Sensors - Intel AppLab Berlin
Ultrabook Development Using Sensors - Intel AppLab Berlin
 
Near field communication
Near field communicationNear field communication
Near field communication
 
Rfid and the Mobile phone quiz
Rfid and the Mobile phone quizRfid and the Mobile phone quiz
Rfid and the Mobile phone quiz
 
NEAR FIELD COMMUNICATION
NEAR FIELD COMMUNICATIONNEAR FIELD COMMUNICATION
NEAR FIELD COMMUNICATION
 
Ask Contactless Terminals
Ask Contactless TerminalsAsk Contactless Terminals
Ask Contactless Terminals
 
RFID/NFC for the Masses
RFID/NFC for the MassesRFID/NFC for the Masses
RFID/NFC for the Masses
 
NFC in direct mail: The pros and cons
NFC in direct mail: The pros and consNFC in direct mail: The pros and cons
NFC in direct mail: The pros and cons
 
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
Which new scenarios are enabled by Windows 10 for NFC, Bluetooth LE & Beacons?
 
NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016
 
NFC Security Guard Systems
NFC Security Guard SystemsNFC Security Guard Systems
NFC Security Guard Systems
 
RFID and NFC Providing the last yards for IoT
RFID and NFC Providing the last yards for IoTRFID and NFC Providing the last yards for IoT
RFID and NFC Providing the last yards for IoT
 
Windows Phone 8 NFC Quickstart
Windows Phone 8 NFC QuickstartWindows Phone 8 NFC Quickstart
Windows Phone 8 NFC Quickstart
 
NFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesignNFCRFID Ripe for Application Expansion_ElectronicDesign
NFCRFID Ripe for Application Expansion_ElectronicDesign
 
"Combinando NFC y Datos en la Etiqueta RFID para Apoyar AAL" presentada por D...
"Combinando NFC y Datos en la Etiqueta RFID para Apoyar AAL" presentada por D..."Combinando NFC y Datos en la Etiqueta RFID para Apoyar AAL" presentada por D...
"Combinando NFC y Datos en la Etiqueta RFID para Apoyar AAL" presentada por D...
 
Electronic Access Control Security
Electronic Access Control SecurityElectronic Access Control Security
Electronic Access Control Security
 

En vedette

Nokia NFC Presentation
Nokia NFC PresentationNokia NFC Presentation
Nokia NFC Presentationmomobeijing
 
Embedded Systems Security News Feb 2011
Embedded Systems Security News Feb 2011Embedded Systems Security News Feb 2011
Embedded Systems Security News Feb 2011AurMiana
 
EE Reports Metering 101 Guide: Benefits and Applications of Submetering
EE Reports Metering 101 Guide: Benefits and Applications of SubmeteringEE Reports Metering 101 Guide: Benefits and Applications of Submetering
EE Reports Metering 101 Guide: Benefits and Applications of SubmeteringEEReports.com
 
Contextually Relevant Retail APIs for Dynamic Insights & Experiences
Contextually Relevant Retail APIs for Dynamic Insights & ExperiencesContextually Relevant Retail APIs for Dynamic Insights & Experiences
Contextually Relevant Retail APIs for Dynamic Insights & ExperiencesJason Lobel
 
Is there such a thing as smart retail
Is there such a thing as smart retailIs there such a thing as smart retail
Is there such a thing as smart retailPierre Metivier
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentAndreas Jakl
 
NFC for the Internet of Things
NFC for the Internet of ThingsNFC for the Internet of Things
NFC for the Internet of ThingsNFC Forum
 
Global tag portfolio_2015
Global tag portfolio_2015Global tag portfolio_2015
Global tag portfolio_2015Global Tag Srl
 
System Label Company Overview
System Label Company Overview System Label Company Overview
System Label Company Overview System Label
 
Product catalogue europe en_2016
Product catalogue europe en_2016Product catalogue europe en_2016
Product catalogue europe en_2016Ignacio Gonzalez
 
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Ajin Abraham
 
NFC and consumers - Success factors and limitations in retail business - Flor...
NFC and consumers - Success factors and limitations in retail business - Flor...NFC and consumers - Success factors and limitations in retail business - Flor...
NFC and consumers - Success factors and limitations in retail business - Flor...Florian Resatsch
 
NEAR FIELD COMMUNICATION (NFC)
NEAR FIELD COMMUNICATION (NFC) NEAR FIELD COMMUNICATION (NFC)
NEAR FIELD COMMUNICATION (NFC) ADITYA GUPTA
 
Recruter, Fidéliser dans vos magasins avec les technologies disruptives, iBea...
Recruter, Fidéliser dans vos magasins avec les technologies disruptives, iBea...Recruter, Fidéliser dans vos magasins avec les technologies disruptives, iBea...
Recruter, Fidéliser dans vos magasins avec les technologies disruptives, iBea...servicesmobiles.fr
 
Track 1 session 6 - st dev con 2016 - smart badge
Track 1   session 6 - st dev con 2016 - smart badgeTrack 1   session 6 - st dev con 2016 - smart badge
Track 1 session 6 - st dev con 2016 - smart badgeST_World
 
CONNECTED OBJECTS - how NFC technology enables a more environmentally-friendl...
CONNECTED OBJECTS - how NFC technology enables a more environmentally-friendl...CONNECTED OBJECTS - how NFC technology enables a more environmentally-friendl...
CONNECTED OBJECTS - how NFC technology enables a more environmentally-friendl...Pierre Metivier
 
A Librarian's Field Guide to Near Field Communication
A Librarian's Field Guide to Near Field CommunicationA Librarian's Field Guide to Near Field Communication
A Librarian's Field Guide to Near Field CommunicationKristen Yarmey
 
Contactless NFC Tags For Mobile Loyalty
Contactless NFC Tags For Mobile LoyaltyContactless NFC Tags For Mobile Loyalty
Contactless NFC Tags For Mobile LoyaltyMerchant360, Inc.
 

En vedette (20)

Nokia NFC Presentation
Nokia NFC PresentationNokia NFC Presentation
Nokia NFC Presentation
 
Embedded Systems Security News Feb 2011
Embedded Systems Security News Feb 2011Embedded Systems Security News Feb 2011
Embedded Systems Security News Feb 2011
 
Thinaire deck redux
Thinaire deck reduxThinaire deck redux
Thinaire deck redux
 
Making Waves with NFC 2011
Making Waves with NFC 2011Making Waves with NFC 2011
Making Waves with NFC 2011
 
EE Reports Metering 101 Guide: Benefits and Applications of Submetering
EE Reports Metering 101 Guide: Benefits and Applications of SubmeteringEE Reports Metering 101 Guide: Benefits and Applications of Submetering
EE Reports Metering 101 Guide: Benefits and Applications of Submetering
 
Contextually Relevant Retail APIs for Dynamic Insights & Experiences
Contextually Relevant Retail APIs for Dynamic Insights & ExperiencesContextually Relevant Retail APIs for Dynamic Insights & Experiences
Contextually Relevant Retail APIs for Dynamic Insights & Experiences
 
Is there such a thing as smart retail
Is there such a thing as smart retailIs there such a thing as smart retail
Is there such a thing as smart retail
 
Windows 8 Platform NFC Development
Windows 8 Platform NFC DevelopmentWindows 8 Platform NFC Development
Windows 8 Platform NFC Development
 
NFC for the Internet of Things
NFC for the Internet of ThingsNFC for the Internet of Things
NFC for the Internet of Things
 
Global tag portfolio_2015
Global tag portfolio_2015Global tag portfolio_2015
Global tag portfolio_2015
 
System Label Company Overview
System Label Company Overview System Label Company Overview
System Label Company Overview
 
Product catalogue europe en_2016
Product catalogue europe en_2016Product catalogue europe en_2016
Product catalogue europe en_2016
 
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015Hacking Tizen : The OS of Everything - Nullcon Goa 2015
Hacking Tizen : The OS of Everything - Nullcon Goa 2015
 
NFC and consumers - Success factors and limitations in retail business - Flor...
NFC and consumers - Success factors and limitations in retail business - Flor...NFC and consumers - Success factors and limitations in retail business - Flor...
NFC and consumers - Success factors and limitations in retail business - Flor...
 
NEAR FIELD COMMUNICATION (NFC)
NEAR FIELD COMMUNICATION (NFC) NEAR FIELD COMMUNICATION (NFC)
NEAR FIELD COMMUNICATION (NFC)
 
Recruter, Fidéliser dans vos magasins avec les technologies disruptives, iBea...
Recruter, Fidéliser dans vos magasins avec les technologies disruptives, iBea...Recruter, Fidéliser dans vos magasins avec les technologies disruptives, iBea...
Recruter, Fidéliser dans vos magasins avec les technologies disruptives, iBea...
 
Track 1 session 6 - st dev con 2016 - smart badge
Track 1   session 6 - st dev con 2016 - smart badgeTrack 1   session 6 - st dev con 2016 - smart badge
Track 1 session 6 - st dev con 2016 - smart badge
 
CONNECTED OBJECTS - how NFC technology enables a more environmentally-friendl...
CONNECTED OBJECTS - how NFC technology enables a more environmentally-friendl...CONNECTED OBJECTS - how NFC technology enables a more environmentally-friendl...
CONNECTED OBJECTS - how NFC technology enables a more environmentally-friendl...
 
A Librarian's Field Guide to Near Field Communication
A Librarian's Field Guide to Near Field CommunicationA Librarian's Field Guide to Near Field Communication
A Librarian's Field Guide to Near Field Communication
 
Contactless NFC Tags For Mobile Loyalty
Contactless NFC Tags For Mobile LoyaltyContactless NFC Tags For Mobile Loyalty
Contactless NFC Tags For Mobile Loyalty
 

Similaire à NFC Bootcamp Seattle Day 2

ABC2011Winter デ部 NFC
ABC2011Winter デ部 NFCABC2011Winter デ部 NFC
ABC2011Winter デ部 NFCMasahiro Wakame
 
NFC & RFID on Android
NFC & RFID on AndroidNFC & RFID on Android
NFC & RFID on Androidtodbotdotcom
 
NFC Bootcamp Seattle Day 1
NFC Bootcamp Seattle Day 1NFC Bootcamp Seattle Day 1
NFC Bootcamp Seattle Day 1traceebeebe
 
DefCon 2012 - Near-Field Communication / RFID Hacking - Miller
DefCon 2012 - Near-Field Communication / RFID Hacking - MillerDefCon 2012 - Near-Field Communication / RFID Hacking - Miller
DefCon 2012 - Near-Field Communication / RFID Hacking - MillerMichael Smith
 
NFC on Android - Near Field Communication
NFC on Android - Near Field CommunicationNFC on Android - Near Field Communication
NFC on Android - Near Field CommunicationSven Haiges
 
Near field communication
Near field communication Near field communication
Near field communication Siddharth Dc
 
Nfc forum 14_feb07_press_and_analyst_briefing_slides
Nfc forum 14_feb07_press_and_analyst_briefing_slidesNfc forum 14_feb07_press_and_analyst_briefing_slides
Nfc forum 14_feb07_press_and_analyst_briefing_slidesBabu Kumar
 
NFC Forum Tap Into NFC Developer Event Intro
NFC Forum Tap Into NFC Developer Event IntroNFC Forum Tap Into NFC Developer Event Intro
NFC Forum Tap Into NFC Developer Event IntroNFC Forum
 
On Relaying NFC Payment Transactions using Android devices
On Relaying NFC Payment Transactions using Android devicesOn Relaying NFC Payment Transactions using Android devices
On Relaying NFC Payment Transactions using Android devicescgvwzq
 
Near field communication
Near field communicationNear field communication
Near field communicationParamvir Singh
 
Introduction to NFC
Introduction to NFCIntroduction to NFC
Introduction to NFCWei-Tsung Su
 
Near field communication (NFC) in android
Near field communication (NFC) in androidNear field communication (NFC) in android
Near field communication (NFC) in androidMindfire Solutions
 
NFiD: An NFC based system for Digital Business Cards
NFiD: An NFC based system for Digital Business CardsNFiD: An NFC based system for Digital Business Cards
NFiD: An NFC based system for Digital Business CardsIRJET Journal
 
NFC architecture and standards involved -C&T RF Antennas Inc
NFC architecture and standards involved -C&T RF Antennas IncNFC architecture and standards involved -C&T RF Antennas Inc
NFC architecture and standards involved -C&T RF Antennas IncAntenna Manufacturer Coco
 
TERTIUM NFC Boost platform
TERTIUM NFC Boost platformTERTIUM NFC Boost platform
TERTIUM NFC Boost platformMarcoConsani2
 
LUMIA APP LABS: DEVELOPING NFC APPS IN WINDOWS PHONE 8
LUMIA APP LABS: DEVELOPING NFC APPS IN WINDOWS PHONE 8LUMIA APP LABS: DEVELOPING NFC APPS IN WINDOWS PHONE 8
LUMIA APP LABS: DEVELOPING NFC APPS IN WINDOWS PHONE 8Microsoft Mobile Developer
 

Similaire à NFC Bootcamp Seattle Day 2 (20)

ABC2011Winter デ部 NFC
ABC2011Winter デ部 NFCABC2011Winter デ部 NFC
ABC2011Winter デ部 NFC
 
Nfc on Android
Nfc on AndroidNfc on Android
Nfc on Android
 
NFC & RFID on Android
NFC & RFID on AndroidNFC & RFID on Android
NFC & RFID on Android
 
NFC Bootcamp Seattle Day 1
NFC Bootcamp Seattle Day 1NFC Bootcamp Seattle Day 1
NFC Bootcamp Seattle Day 1
 
DefCon 2012 - Near-Field Communication / RFID Hacking - Miller
DefCon 2012 - Near-Field Communication / RFID Hacking - MillerDefCon 2012 - Near-Field Communication / RFID Hacking - Miller
DefCon 2012 - Near-Field Communication / RFID Hacking - Miller
 
Android NFC
Android NFCAndroid NFC
Android NFC
 
NFC on Android - Near Field Communication
NFC on Android - Near Field CommunicationNFC on Android - Near Field Communication
NFC on Android - Near Field Communication
 
Near field communication
Near field communication Near field communication
Near field communication
 
Nfc forum 14_feb07_press_and_analyst_briefing_slides
Nfc forum 14_feb07_press_and_analyst_briefing_slidesNfc forum 14_feb07_press_and_analyst_briefing_slides
Nfc forum 14_feb07_press_and_analyst_briefing_slides
 
NFC Forum Tap Into NFC Developer Event Intro
NFC Forum Tap Into NFC Developer Event IntroNFC Forum Tap Into NFC Developer Event Intro
NFC Forum Tap Into NFC Developer Event Intro
 
On Relaying NFC Payment Transactions using Android devices
On Relaying NFC Payment Transactions using Android devicesOn Relaying NFC Payment Transactions using Android devices
On Relaying NFC Payment Transactions using Android devices
 
Near field communication
Near field communicationNear field communication
Near field communication
 
Introduction to NFC
Introduction to NFCIntroduction to NFC
Introduction to NFC
 
Near field communication (NFC) in android
Near field communication (NFC) in androidNear field communication (NFC) in android
Near field communication (NFC) in android
 
NFiD: An NFC based system for Digital Business Cards
NFiD: An NFC based system for Digital Business CardsNFiD: An NFC based system for Digital Business Cards
NFiD: An NFC based system for Digital Business Cards
 
Cours NFC 2019
Cours NFC 2019Cours NFC 2019
Cours NFC 2019
 
NFC architecture and standards involved -C&T RF Antennas Inc
NFC architecture and standards involved -C&T RF Antennas IncNFC architecture and standards involved -C&T RF Antennas Inc
NFC architecture and standards involved -C&T RF Antennas Inc
 
TERTIUM NFC Boost platform
TERTIUM NFC Boost platformTERTIUM NFC Boost platform
TERTIUM NFC Boost platform
 
LUMIA APP LABS: DEVELOPING NFC APPS IN WINDOWS PHONE 8
LUMIA APP LABS: DEVELOPING NFC APPS IN WINDOWS PHONE 8LUMIA APP LABS: DEVELOPING NFC APPS IN WINDOWS PHONE 8
LUMIA APP LABS: DEVELOPING NFC APPS IN WINDOWS PHONE 8
 
Nfc technology
Nfc technologyNfc technology
Nfc technology
 

Dernier

Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brandgvaughan
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 

Dernier (20)

DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
WordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your BrandWordPress Websites for Engineers: Elevate Your Brand
WordPress Websites for Engineers: Elevate Your Brand
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 

NFC Bootcamp Seattle Day 2

  • 1. How to Build an NFC Application Richard Grundy @grundyoso http://flomio.com How to Build an NFC Application 1
  • 2. Agenda • Anatomy of an NFC App • NFC Interface o Technologies • Learn the specs o Tags (Demo 1) • Learn the types o NDEC (Demo 2 and 3) • Learn to format/read/write o Infrastructure • There’s a stack for that o Application • Give it logic How to Build an NFC Application 2
  • 3. Anatomy Web Service Web Service Web Service Middleware Reader Reader Reader Reader Reader NFC App Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Tag Passive Active How to Build an NFC Application 3
  • 4. Anatomy Middleware NFC Interface How to Build an NFC Application 4
  • 5. Interface How to Build an NFC Application 5
  • 6. Interface 13.56Mhz  1 wavelength = 7.37e-8secs of 22.1m  Theoretical range = 3.5m How to Build an NFC Application 6
  • 7. Interface • NFC International Specifications* NDEF TAGS TECH *http://www.flomio.com/docs/ > NFC International Standards How to Build an NFC Application 7
  • 8. Technology • ISO 14443-3A: NFC-A • ISO 14443-3B: NFC-B • JIS 6319-4: NFC-F • ISO 15693: NFC-V • Terms o ASK o PCD o PICC o PDU o REQ o ATQ o UID/UUID o RFU • APDU o CLA, INS, P1, P2, L(c), L(e) o SW1, SW2, L(e) • ATR = Answer to Reset o MFR • PTS = Protocol Type Selection o T=0 Byte level tx o T=1 Block level tx How to Build an NFC Application 8
  • 9. Tags • NFC Forum: Types 1 o Jewel Topaz • NFC Forum: Types 2 o Mifare Ultralight S,C • NFC Forum: Types 3 o Felicia • NFC Forum: Types 4 o Mifare DESfire S, EV1 o Mifare Classic 1k, 4k o Mifare Plus 1k, 4k Options: • ISO 15693 Media o I-Code SLI Ferrite/Metal Mount o Tag IT • Proprietary: Many more How to Build an NFC Application 9
  • 10. Demo 1. Requirement 1. Android 4.0 NFC-enabled handset 2. Download from Google Play: 1. NFC TagInfo by Michael Roland 3. Enable NFC (phone boots with NFC off): 1. Menu  System Settings  Wireless & Networks  More 2. Check NFC box 4. Scan some tags and study ―Tag Information …‖ 1. UID(x) 2. RF Technology 3. Tag Type 4. Manufacturer 5. Target technology classes (Android) How to Build an NFC Application 10
  • 11. NDEF • Mifare Memory Structure o Sectors o Blocks o Keys o Access Bits How to Build an NFC Application 11
  • 12. NDEF • Get ATR – Is MiFare 1k • Set Reader Read Key (FF FF FF FF FF) • Authenticate Reader to Tag Sector 0 o Is NFC Initialized? How do you know? • Set write key (FF FF FF FF FF) • Write MAD • Write Keys and Access Bits • Write first empty record How to Build an NFC Application 12
  • 13. NFC Forum Defined Not NFC Forum Defined • Text • Payment • Mime Types o urn:nfc:wkt:T • URI • Coupon Vendor o urn:nfc:wkt:U • Start a Car Application • Smart Poster • Etc. Etc. o urn:nfc:wkt:Sp • Signature o urn:nfc:wkt:Sig • Mime Types • Handover o Vendor o urn:nfc:wkt:HO o Application • … o Etc. How to Build an NFC Application 13
  • 14. Demo 1. Requirement 1. Android 4.0 NFC-enabled handset 2. Download from Google Play: 1. NXP TagWriter Lite Edition 3. Enable NFC (phone boots with NFC off): 1. Menu  System Settings  Wireless & Networks  More 2. Check NFC box 4. Create and Write some tags with NDEF Records 1. Contact — Add a vcard: Richard @ 305-982-7424 2. URL — Enter a web address: http://www.flomio.com 3. Plain Text — Add this text ―Hello World!‖ 4. SMS — Prepare message: 305-982-7424 — ―Sup Flomio!‖ 5. Now TAP-TO-X! How to Build an NFC Application 14
  • 15. Infrastructure How to Build an NFC Application 15
  • 16. General Credit Card (CC) Approval/Payment Process using NFC How to Build an NFC Application 16
  • 17. Application • Android offers comprehensive NFC support: o 2.3.2 API 10 Gingerbread o 2.3.3 o 2.3.4 o 4.0 Ice Cream Sandwitch • Beam o Available • Tag Read/Write • Tag Emulate • P2P with another Android o Not Available • Smart Card Emulation • P2P Generalized How to Build an NFC Application 17
  • 19. Death by Dialog How to Build an NFC Application 19
  • 20. Android Setup • Register a detailed intent filter in the app’s AndroidManifest.xml • Get Adapter Handle and Set Listen Filters mAdapter = NfcAdapter.getDefaultAdapter(this); mOutPendingIntent = PendingIntent.getActivity(this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED); // ndef.addAction(NfcAdapter.ACTION_TAG_DISCOVERED); mFilters = new IntentFilter[] { ndef, }; mTechLists = new String[][] {new String[] { android.nfc.tech.NfcV.class.getName() }, new String[] { android.nfc.tech.IsoDep.class.getName() }, new String[] { NfcF.class.getName() } }; How to Build an NFC Application 20
  • 21. Android Intents public void onResume() { super.onResume(); if (isSending) { if (mAdapter != null) Send P2P NDEF Message mAdapter.enableForegroundNdefPush(this, mMessage); } else { mAdapter.enableForegroundDispatch(this, mOutPendingIntent, mFilters, mTechLists); if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(getIntent() .getAction())) { NDEF Received processIntent(getIntent()); } else if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(getIntent() .getAction())); { processTagIntent(getIntent()); } Tag no NDEF } } How to Build an NFC Application 21
  • 22. Android Process Info /** * Parses the NDEF Message from the intent and prints to the TextView */ void processIntent(Intent intent) { mText = (TextView) findViewById(R.id.textInfo); // get the data Parcelable[] rawMsgs = intent .getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); // only one message sent during the beam NdefMessage msg = (NdefMessage) rawMsgs[0]; // record 0 contains the MIME type, record 1 is the AAR, if present mText.setText(new String(msg.getRecords()[0].getPayload())); } /** Show tag found **/ void processTagIntent(Intent intent) { mText = (TextView) findViewById(R.id.textInfo); // get the tag handle and data Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); if (tag != null) { // tell me about the tag found mText.setText(new String("Tag discovered:" + tag.toString())); } else { // lost tag or not finished Log.i(APPTAG, "Tag not ready or no longer there"); }; } How to Build an NFC Application 22
  • 23. Android Make NDEF public static NdefRecord newTextRecord(String text, Locale locale,boolean encodeInUtf8) { byte[] langBytes = locale.getLanguage().getBytes(Charset.forName("US-ASCII")); Charset utfEncoding = encodeInUtf8 ? Charset.forName("UTF-8") : Charset.forName("UTF-16"); byte[] textBytes = text.getBytes(utfEncoding); int utfBit = encodeInUtf8 ? 0 : (1 << 7); char status = (char) (utfBit + langBytes.length); byte[] data = new byte[1 + langBytes.length + textBytes.length]; data[0] = (byte) status; System.arraycopy(langBytes, 0, data, 1, langBytes.length); System.arraycopy(textBytes, 0, data, 1 + langBytes.length,textBytes.length); return new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_TEXT, new byte[0], data); } String mTextPayload = "JOHN A. DOE,YBC99999999" + mSequence; mMessage = new NdefMessage(new NdefRecord[] { newTextRecord(mTextPayload, Locale.ENGLISH, true) }); How to Build an NFC Application 23
  • 24. How to Build an NFC Application 24
  • 25. How to – Construct NDEF Header Location 7 Abbrev MB Name Message Begin FALSE 0 TRUE 1 6ME Message End 0 1 5CF Chunk Flag 0 1 4SR Short Record 0 1 3IL ID Length 0 1 2 0 1 1 TNF Type Name Format 0 1 0 0 1 d1 1 1 0 1 0 0 0 1 c9 1 1 0 0 1 0 0 1 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 MB ME CF SR IL TNF MB ME CF SR IL TNF Type Length Type Length Payload Length Payload Length 3 Payload Length 2 Type Payload Length 1 ID Payload Length 0 Payload ID Length Type ID How to Build an NFC Application Payload 25
  • 26. Type Name Format TNF Well Known Record Types urn:nfc:wkt:T T 0x54 Type Name Format (TNF) urn:nfc:wkt:U U 0x55 Empty 0x00 Well Known Type 0x01 urn:nfc:wkt:Sp Sp 0x53 0x70 Media 0x02 urn:nfc:wkt:Sig Sig 0x53 0x69 0x67 Absolute URI 0x03 External 0x04 Unk 0x05 Language Unchanged 0x06 en 0x65 0x6E Reserved 0x07 Urn:nfc:mime/vnd.m360.id fr 0x66 0x72 sp 0x73 0x70 de 0x64 0x65 urn:nfc:ext:M360:id Uri Identifier Codes None 0x00 http://www. 0x01 https://www. 0x02 http:// 0x03 https:// 0x04 tel: 0x05 mailto: 0x06 How to Build an NFC Application 26
  • 27. Smart Poster NDEF Message 0 &HD1 209 0xD1 record header 12 17 &H77 119 0x77 w 29 34 &H54 84 0x54 T 1 &H2 2 0x02 type length 13 18 &H77 119 0x77 w 30 35 &H2 2 0x02 language lnght 2 &H28 40 0x28 length 14 19 &H77 119 0x77 w 31 36 &H65 101 0x65 e 3 &H53 83 0x53 S 15 20 &H2E 46 0x2E . 32 37 &H6E 110 0x6E n 4 &H70 112 0x70 p 16 21 &H6D 109 0x6D m 33 38 &H4D 77 0x4D M 0 5 &HD1 209 0xD1 record header 17 22 &H6F 111 0x6F o 34 39 &H6F 111 0x6F o 1 6 &H1 1 0x01 type length 18 23 &H62 98 0x62 b 35 40 &H62 98 0x62 b 2 7 &H16 22 0x16 length 19 24 &H69 105 0x69 i 36 41 &H69 105 0x69 i 3 8 &H55 85 0x55 U 20 25 &H74 116 0x74 t 37 42 &H74 116 0x74 t 4 9 &H0 0 0x00 prefix 21 26 &H61 97 0x61 a 38 43 &H61 97 0x61 a 5 10 &H68 104 0x68 h 22 27 &H6F 111 0x70 p 39 44 &H70 112 0x70 p 6 11 &H74 116 0x74 t 23 28 &H2E 46 0x2E . 40 45 &HFE 254 0xFE end 7 12 &H74 116 0x74 t 24 29 &H6D 109 0x6D m 8 13 &H70 112 0x70 p 25 30 &H65 101 0x65 e 9 14 &H3A 58 0x3A : 26 31 &HD1 209 0xD1 record header 10 15 &H2F 47 0x2F / 27 32 &H1 1 0x01 type length 11 16 &H2F 47 0x2F / 28 33 &HA 10 0x0A length How to Build an NFC Application 27
  • 28. Smart Poster How to Build an NFC Application 28
  • 29. Smart Poster Complex How to Build an NFC Application 29
  • 30. Signed Smart Poster How to Build an NFC Application 30
  • 31. Handling Records How to Build an NFC Application 31
  • 32. Thank you Touch the web. Richard Grundy Twitter: @flomio Web: www.flomio.com How to Build an NFC Application 32

Notes de l'éditeur

  1. Another way to explain what the forum / standards are responsible for and not responsible for
  2. Bridging solutions