SlideShare a Scribd company logo
1 of 57
NFC
about
Sven Haiges, hybris GmbH
  Twitter @hansamann

    Android, HTML5,
    Groovy & Grails


 sven.haiges@hybris.de
about
Sven Haiges, hybris GmbH
  Twitter @hansamann

    Android, HTML5,
    Groovy & Grails


 sven.haiges@hybris.de

                           NFC
Basics                    Card
                            Emulation
                     Reader/Writer
                            P2P



                   NFC
 TagTechnologies
Tag NDEF
Dispatch                 APIs
                         Android
Basics
NFC roots: RFID

• RFID - Radio Frequency Identification
• 1983: First RFID patent granted
• Typical, well-known use-cases for RFID
  animal identification, road taxes, libraries


• 2004: Nokia, Philips and Sony established
  the NFC Forum
NFC

• “transfer data at low speed, without
  security, over short distances”
• ~10 centimeters, in reality less
• 424 kBit/s
• 13.56 MHz
NFC Devices
• First mainstream Android
  smartphone: Nexus S
• Common in new top
  Android phones
• New RIM / Nokia devices
• Apple iPhone?
Nokia 6131

   • released 2006
   • early 2007: iPhone!
   • J2ME Spec: JSR 257
     Contactless Communication API


   • NFC is not new!
Forecast
                        NFC handsets (k units)
600000

450000

300000

150000

     0
      2010   2011(e)    2012(e)        2013(e)               2014(e)                     2015(e)




                                                 Source:IHS iSuppli,compiled by Digitimes,May 2011
Payment
Tickets
      Coupons
           Smart Poster



Payment
Tickets
       Coupons
            Smart Poster



Payment

          Identity
     Keycard
               Personal ID
NFC Checkin
                             Tickets
   Social                 Coupons
Gaming     vCard               Smart Poster



                   Payment

                             Identity
                        Keycard
                                  Personal ID
NFC Checkin
                              Tickets
    Social                 Coupons
 Gaming     vCard               Smart Poster



                    Payment
      WiFi
Connections
     Bluetooth                Identity
                         Keycard
                                   Personal ID
Transponder
     Format          Technology/Capacity


                      13.56 Mhz
 Wristbands                  125 Khz
      Cards Labels
Sticker Keyfobs         NFC Forum
      Tags               Type 1-4
can be
                                   made read
                                     only!
NFC Forum Type 2 Tag
  Mifare Ultralight - 64 bytes
 Mifare Ultralight C - 192 bytes
Mifare Ultralight
All Surface Tag
Mifare Ultralight
All Surface Tag

                    Mifare Ultralight
                    Paper Ticket
Mifare Ultralight
All Surface Tag

                      Mifare Ultralight
                      Paper Ticket




  Mifare Ultralight
     Square Label
Mifare Ultralight
                 All Surface Tag

                                       Mifare Ultralight
                                       Paper Ticket




Mifare Classic
                   Mifare Ultralight
Keyfob
                      Square Label
Shops

• tagage.net
• rfidshop.com
• smartcardfocus.com
• and many more...
Comparing NFC




         Source:NFC Forum
NFC Modes
NFC Modes

• Peer-to-Peer Mode
• Reader/Writer Mode
• Card Emulation Mode
Android NFC Support

• Peer-to-Peer Mode: limited
• Reader/Writer Mode: excellent support
• Card Emulation Mode: no support
NFC & Android
NFC & Android

• Tag-Reading ab Android 2.3, API Level 9
• Tag-Writing ab Android 2.3.3, API Level 10
• Core classes: NFCAdapter, NFCManager,
  Tag Technology Classes
Android Manifest

• NFC Permission
  <uses-permission android:name="android.permission.NFC" />



• API Level
  <uses-sdk android:minSdkVersion="10" />


• NFC Feature
  <uses-feature android:name="android.hardware.nfc"
  android:required="true" />
Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="de.flavor.android.nfc"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
	   	    <activity android:name=".MimeActivity" android:label="MIME">
	           <intent-filter>
	   	    	      <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
	   	    	      <data android:mimeType="application/json" />
	   	    	      <category android:name="android.intent.category.DEFAULT" />
	   	       </intent-filter>	
        </activity>
    </application>
    <uses-permission android:name="android.permission.NFC" />
    <uses-sdk android:minSdkVersion="10" />
    <uses-feature android:name="android.hardware.nfc" android:required="true" />
</manifest>
Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="de.flavor.android.nfc"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
	   	    <activity android:name=".MimeActivity" android:label="MIME">
	           <intent-filter>
	   	    	      <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
	   	    	      <data android:mimeType="application/json" />
	   	    	      <category android:name="android.intent.category.DEFAULT" />
	   	       </intent-filter>	
        </activity>
    </application>
    <uses-permission android:name="android.permission.NFC" />
    <uses-sdk android:minSdkVersion="10" />
    <uses-feature android:name="android.hardware.nfc" android:required="true" />
</manifest>
Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="de.flavor.android.nfc"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
	   	    <activity android:name=".MimeActivity" android:label="MIME">
	           <intent-filter>
	   	    	      <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
	   	    	      <data android:mimeType="application/json" />
	   	    	      <category android:name="android.intent.category.DEFAULT" />
	   	       </intent-filter>	
        </activity>
    </application>
    <uses-permission android:name="android.permission.NFC" />
    <uses-sdk android:minSdkVersion="10" />
    <uses-feature android:name="android.hardware.nfc" android:required="true" />
</manifest>
Android Manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="de.flavor.android.nfc"
      android:versionCode="1"
      android:versionName="1.0">
    <application android:icon="@drawable/icon" android:label="@string/app_name">
	   	    <activity android:name=".MimeActivity" android:label="MIME">
	           <intent-filter>
	   	    	      <action android:name="android.nfc.action.NDEF_DISCOVERED"/>
	   	    	      <data android:mimeType="application/json" />
	   	    	      <category android:name="android.intent.category.DEFAULT" />
	   	       </intent-filter>	
        </activity>
    </application>
    <uses-permission android:name="android.permission.NFC" />
    <uses-sdk android:minSdkVersion="10" />
    <uses-feature android:name="android.hardware.nfc" android:required="true" />
</manifest>
NFCManager

• NFCManager used to get the NFCAdapter
• Boring
• Shortcut for
  getSystemService(NFC_SERVICE)
NFCAdapter

• the real thing
• Control Foreground Dispatch and
  P2P NDEF Push
• check if NFC is turned on
Checking for NFC
if (!getNFCAdapter().isEnabled())
{
	   Toast.makeText(getApplicationContext(),
	   "Please activate NFC and press back to return to the application!",
	   Toast.LENGTH_LONG).show();
	
	   startActivity(
       new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS)
    );
}
Reading a Tag

• Unlock phone,
  touch tag :-)
• Most likely, the
  intent chooser will
  open
Foreground Dispatch

• Foreground Activity may redirect all intents
  related to tag, technology or NDEF
  discovery to itself
• Getting all tags while activity is visible:
  enable in onResume(), disable in onPause()
Foreground Dispatch
nfcAdapter.enableForegroundDispatch(                 techListsArray does not matter
   activity,                                         here, as ACTION_TECH_DISCOVERED
                                                     is not in intentFilters array. It can
   pendingIntent,                                    be null :-)
   intentFiltersArray,
                                                     Most basic TAG-catch-all:
   techListsArray);                                  use ACTION_TAG_DISCOVERED in
                                                     filterList, no techs


intent = PendingIntent.getActivity(activity, 0,
              new Intent(activity, activity.getClass())
              .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0);

IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
ndef.addDataType("*/*");
intentFiltersArray = new IntentFilter[] { ndef };

techListsArray = new String[][] { new String[] { NfcA.class.getName() } };
Receiving a Tag
public void onNewIntent(Intent intent) {
    Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
}
...
tag.getId() //returns id as byte[]

String techs[] = tag.getTechList();
for (String tech : techs) {
	   if (tech.equals("android.nfc.tech.Ndef"))
	   {
	   	    Ndef ndef = Ndef.get(tag);
	   	    ndef.getType()
	   	    ndef.getMaxSize()
	   	    ndef.canMakeReadOnly()
	   	    ndef.isWritable()
	   	    NFCUtil.printNdefMessageDetails(ndef.getCachedNdefMessage()));	 	
	   }
}
Tag Technologies
Tag Technologies map to
tech specifications or to
pseudo-technologie or
capabilities like NDEF or
NDEFFormatable

                                      TagTechnology



MifareClassic               MifareUltralight   NdefFormatable   Ndef

       NfcA                      NfcB              NfcF         NfcV

                                                  IsoDep
Tag Technologies
Tag Technologies map to
tech specifications or to
pseudo-technologie or
capabilities like NDEF or
NDEFFormatable

                                      TagTechnology



MifareClassic               MifareUltralight   NdefFormatable   Ndef

       NfcA                      NfcB              NfcF         NfcV

                                                  IsoDep
NDEF
• NFC Data Exchange Format
• NFC Forum
• Records can be MIME-type media, URIs or
   RTDs (Record Type Definitions)

             1                 *
Ndef-Tag         NdefMessage       NdefRecord
NdefRecord
TNF    Type   ID   Payload
NdefRecord
         TNF    Type      ID        Payload




                          URI                 URI :-)


NdefRecord             WELL_KNOWN        SMART_POSTER


                         MIME                 TEXT
Reading Tag Content
//r = NdefRecord
if (r.getTnf() == NdefRecord.TNF_ABSOLUTE_URI) {
	   b.append(String
	   	    	   .format("TNF_ABSOLUTE_URI: type(%1$s), id(%2$s), payload(%3$s)n",
	   	    	   	   	    new String(r.getType()), idBytes.toString(),
	   	    	   	   	    new String(r.getPayload())));
}
else if (r.getTnf() == NdefRecord.TNF_MIME_MEDIA)
{
	   b.append(String
	   	    	   .format("TNF_MIME_MEDIA: type(%1$s), id(%2$s), payload(%3$s)n",
	   	    	   	   	    new String(r.getType()), idBytes.toString(),
	   	    	   	   	    new String(r.getPayload())));
}
Tag Dispatch
Tag Dispatch
           Foreground Activity Dispatch



 NDEF Data Dispatch: ACTION_NDEF_DISCOVERED



Tag Technology Dispatch: ACTION_TECH_DISCOVERED



   Fall-back Dispatch: ACTION_TAG_DISCOVERED
Direct Start

• Write custom NDEF
  MIME-type media
  messages
• Use custom
  IntentFilter to bind to
  your messages
Writing NDEF MIME

NdefMessage msg =
   NFCUtil.getNdefMimeMessage("application/json", "{"key":"value"}");
Intent i = new Intent(this, WriteActivity.class);
i.putExtra(WriteActivity.NDEF_MESSAGE, msg);
startActivity(i);
Writing NDEF MIME

NdefMessage msg =
   NFCUtil.getNdefMimeMessage("application/json", "{"key":"value"}");
Intent i = new Intent(this, WriteActivity.class);
i.putExtra(WriteActivity.NDEF_MESSAGE, msg);
startActivity(i);
Writing NDEF MIME

private static NdefRecord getMimeRecord(String mimeType, String content) {
	   NdefRecord record = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
	   	    	   mimeType.getBytes(), getRandomIdBytes(), content.getBytes());
	   return record;
}
Writing NDEF MIME
Ndef ndef = Ndef.get(tag);
if (ndef.isWritable() && ndef.getMaxSize() > this.msg.toByteArray().length)
{
	    ndef.connect();
	    ndef.writeNdefMessage(this.msg);
	    ndef.close();
}
else
	    //show toast?
P2P: NDEF Push

• Create NDEF Message which is pushed to
  another active device once the other
  device is close
  NfcAdapter.enableForegroundNdefPush(activity, ndefmessage)
  NfcAdapter.disableForegroundNdefPush(activity)
about
Sven Haiges, hybris GmbH
  Twitter @hansamann

    Android, HTML5,
    Groovy & Grails


 sven.haiges@hybris.de
about
Sven Haiges, hybris GmbH
  Twitter @hansamann

    Android, HTML5,
    Groovy & Grails


 sven.haiges@hybris.de

                           NFC

More Related Content

What's hot

Product manager for dynamic nfc id 11949
Product manager for dynamic nfc  id 11949Product manager for dynamic nfc  id 11949
Product manager for dynamic nfc id 11949Raoul Brouns
 
Nokia NFC Presentation
Nokia NFC PresentationNokia NFC Presentation
Nokia NFC Presentationmomobeijing
 
Merchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
Merchant360 SP4G(tm) NFC Coverage Walls Counters and FloorsMerchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
Merchant360 SP4G(tm) NFC Coverage Walls Counters and FloorsMerchant360, Inc.
 
The User Experience of Near Field Communication
The User Experience of Near Field CommunicationThe User Experience of Near Field Communication
The User Experience of Near Field CommunicationMemi Beltrame
 
Contactless NFC Tags For Mobile Loyalty
Contactless NFC Tags For Mobile LoyaltyContactless NFC Tags For Mobile Loyalty
Contactless NFC Tags For Mobile LoyaltyMerchant360, Inc.
 
Telecommunications in the logistic sector lodz
Telecommunications in the logistic sector lodzTelecommunications in the logistic sector lodz
Telecommunications in the logistic sector lodzJustino Lourenço
 
near field communication
near field communicationnear field communication
near field communicationNitish Tanwar
 
Near Field Communication on iPhone with iCarte
Near Field Communication on iPhone with iCarteNear Field Communication on iPhone with iCarte
Near Field Communication on iPhone with iCarteAndrew Roughan
 
Rfid and the Mobile phone quiz
Rfid and the Mobile phone quizRfid and the Mobile phone quiz
Rfid and the Mobile phone quizTheodor Tolstoy
 
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
 
Leverage RFID with NFC for Better ROI - by Steve McRae
Leverage RFID with NFC for Better ROI - by Steve McRaeLeverage RFID with NFC for Better ROI - by Steve McRae
Leverage RFID with NFC for Better ROI - by Steve McRaeMerchant360, Inc.
 
NFC Patents for Smartphone Mobile Payments Licensing Potential Assessment
NFC Patents for Smartphone Mobile Payments Licensing Potential AssessmentNFC Patents for Smartphone Mobile Payments Licensing Potential Assessment
NFC Patents for Smartphone Mobile Payments Licensing Potential AssessmentAlex G. Lee, Ph.D. Esq. CLP
 
Vodafone Cash Service - NFC tag
Vodafone Cash Service - NFC tagVodafone Cash Service - NFC tag
Vodafone Cash Service - NFC tagDeyaa Ahmed
 
Near Field Communication in m-Commerce
Near Field Communication in m-CommerceNear Field Communication in m-Commerce
Near Field Communication in m-CommerceThejasK8
 
Designing low costs sensor system for the Internet of Things
Designing low costs sensor system for the Internet of ThingsDesigning low costs sensor system for the Internet of Things
Designing low costs sensor system for the Internet of ThingsAndreas Schaller
 
E-Catalogue Of HUAYUAN RFID Products
E-Catalogue Of HUAYUAN RFID ProductsE-Catalogue Of HUAYUAN RFID Products
E-Catalogue Of HUAYUAN RFID ProductsHUAYUAN ELECTRONIC
 

What's hot (20)

Product manager for dynamic nfc id 11949
Product manager for dynamic nfc  id 11949Product manager for dynamic nfc  id 11949
Product manager for dynamic nfc id 11949
 
Nokia NFC Presentation
Nokia NFC PresentationNokia NFC Presentation
Nokia NFC Presentation
 
Merchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
Merchant360 SP4G(tm) NFC Coverage Walls Counters and FloorsMerchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
Merchant360 SP4G(tm) NFC Coverage Walls Counters and Floors
 
NFC wallet
NFC walletNFC wallet
NFC wallet
 
Nfc
NfcNfc
Nfc
 
The User Experience of Near Field Communication
The User Experience of Near Field CommunicationThe User Experience of Near Field Communication
The User Experience of 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
 
Telecommunications in the logistic sector lodz
Telecommunications in the logistic sector lodzTelecommunications in the logistic sector lodz
Telecommunications in the logistic sector lodz
 
near field communication
near field communicationnear field communication
near field communication
 
Near Field Communication on iPhone with iCarte
Near Field Communication on iPhone with iCarteNear Field Communication on iPhone with iCarte
Near Field Communication on iPhone with iCarte
 
Rfid and the Mobile phone quiz
Rfid and the Mobile phone quizRfid and the Mobile phone quiz
Rfid and the Mobile phone quiz
 
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
 
Leverage RFID with NFC for Better ROI - by Steve McRae
Leverage RFID with NFC for Better ROI - by Steve McRaeLeverage RFID with NFC for Better ROI - by Steve McRae
Leverage RFID with NFC for Better ROI - by Steve McRae
 
NFC Guidebook, 2011
NFC Guidebook, 2011NFC Guidebook, 2011
NFC Guidebook, 2011
 
NFC Patents for Smartphone Mobile Payments Licensing Potential Assessment
NFC Patents for Smartphone Mobile Payments Licensing Potential AssessmentNFC Patents for Smartphone Mobile Payments Licensing Potential Assessment
NFC Patents for Smartphone Mobile Payments Licensing Potential Assessment
 
Vodafone Cash Service - NFC tag
Vodafone Cash Service - NFC tagVodafone Cash Service - NFC tag
Vodafone Cash Service - NFC tag
 
Civintec introduction 2015
Civintec introduction 2015Civintec introduction 2015
Civintec introduction 2015
 
Near Field Communication in m-Commerce
Near Field Communication in m-CommerceNear Field Communication in m-Commerce
Near Field Communication in m-Commerce
 
Designing low costs sensor system for the Internet of Things
Designing low costs sensor system for the Internet of ThingsDesigning low costs sensor system for the Internet of Things
Designing low costs sensor system for the Internet of Things
 
E-Catalogue Of HUAYUAN RFID Products
E-Catalogue Of HUAYUAN RFID ProductsE-Catalogue Of HUAYUAN RFID Products
E-Catalogue Of HUAYUAN RFID Products
 

Viewers also liked

Near field communication (nfc) technology
Near field communication (nfc) technologyNear field communication (nfc) technology
Near field communication (nfc) technologyAnkur Sharma
 
NFC technical presentation
NFC technical presentationNFC technical presentation
NFC technical presentationAkshat Rohatgi
 
NFC Technology
NFC TechnologyNFC Technology
NFC TechnologyNeha Singh
 
NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016Laurent Dardé
 
NFC(Near Field Communication)
NFC(Near Field Communication)NFC(Near Field Communication)
NFC(Near Field Communication)ADARSH KUMAR
 
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 communicationdivyasolanki101
 
Near Field Communication (NFC)
Near Field Communication (NFC)Near Field Communication (NFC)
Near Field Communication (NFC)Seminar Links
 
Tap into NFC Meetup - Boston
Tap into NFC Meetup  - Boston Tap into NFC Meetup  - Boston
Tap into NFC Meetup - Boston NFC Forum
 
NEAR FIELD COMMUNICATION
NEAR FIELD COMMUNICATIONNEAR FIELD COMMUNICATION
NEAR FIELD COMMUNICATIONHarisankar U K
 
Nfc tutorial
Nfc tutorialNfc tutorial
Nfc tutorialRoy Chen
 
Guide du tag NFC : quels usages dans quels contextes ?
Guide du tag NFC : quels usages dans quels contextes ?Guide du tag NFC : quels usages dans quels contextes ?
Guide du tag NFC : quels usages dans quels contextes ?Olivier Devillers
 
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXP
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXPdroidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXP
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXPDroidcon Berlin
 
Near Field Communication (NFC Architecture and Operating Modes)
Near Field Communication (NFC Architecture and Operating Modes)Near Field Communication (NFC Architecture and Operating Modes)
Near Field Communication (NFC Architecture and Operating Modes)Deepak Kl
 
Nfc-Full Presentation
Nfc-Full PresentationNfc-Full Presentation
Nfc-Full PresentationDILIN RAJ DS
 
Near field communication
Near field communicationNear field communication
Near field communicationNagesh Mishra
 
Near Field Communication & Android
Near Field Communication & AndroidNear Field Communication & Android
Near Field Communication & Androidromemore
 

Viewers also liked (20)

Near field communication (nfc) technology
Near field communication (nfc) technologyNear field communication (nfc) technology
Near field communication (nfc) technology
 
NFC technical presentation
NFC technical presentationNFC technical presentation
NFC technical presentation
 
NFC Technology
NFC TechnologyNFC Technology
NFC Technology
 
NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016NFC Everywhere Brochure 2016
NFC Everywhere Brochure 2016
 
NFC(Near Field Communication)
NFC(Near Field Communication)NFC(Near Field Communication)
NFC(Near Field Communication)
 
Nfc kdr
Nfc kdrNfc kdr
Nfc kdr
 
Nfc
NfcNfc
Nfc
 
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
 
Near Field Communication (NFC)
Near Field Communication (NFC)Near Field Communication (NFC)
Near Field Communication (NFC)
 
Tap into NFC Meetup - Boston
Tap into NFC Meetup  - Boston Tap into NFC Meetup  - Boston
Tap into NFC Meetup - Boston
 
NEAR FIELD COMMUNICATION
NEAR FIELD COMMUNICATIONNEAR FIELD COMMUNICATION
NEAR FIELD COMMUNICATION
 
Nfc tutorial
Nfc tutorialNfc tutorial
Nfc tutorial
 
Guide du tag NFC : quels usages dans quels contextes ?
Guide du tag NFC : quels usages dans quels contextes ?Guide du tag NFC : quels usages dans quels contextes ?
Guide du tag NFC : quels usages dans quels contextes ?
 
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXP
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXPdroidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXP
droidcon 2012: What's the Hack is NFC .., Hauke Meyn, NXP
 
Near Field Communication (NFC Architecture and Operating Modes)
Near Field Communication (NFC Architecture and Operating Modes)Near Field Communication (NFC Architecture and Operating Modes)
Near Field Communication (NFC Architecture and Operating Modes)
 
Nfc-Full Presentation
Nfc-Full PresentationNfc-Full Presentation
Nfc-Full Presentation
 
Near field communication
Near field communicationNear field communication
Near field communication
 
Nfc technology ppt
Nfc technology pptNfc technology ppt
Nfc technology ppt
 
Near Field Communication & Android
Near Field Communication & AndroidNear Field Communication & Android
Near Field Communication & Android
 

Similar to NFC on Android - Near Field Communication

NFC & RFID on Android
NFC & RFID on AndroidNFC & RFID on Android
NFC & RFID on Androidtodbotdotcom
 
NFC Bootcamp Seattle Day 2
NFC Bootcamp Seattle Day 2 NFC Bootcamp Seattle Day 2
NFC Bootcamp Seattle Day 2 traceebeebe
 
DefCon 2012 - Near-Field Communication / RFID Hacking - Lee
DefCon 2012 - Near-Field Communication / RFID Hacking - LeeDefCon 2012 - Near-Field Communication / RFID Hacking - Lee
DefCon 2012 - Near-Field Communication / RFID Hacking - LeeMichael Smith
 
Near field communication
Near field communicationNear field communication
Near field communicationParamvir Singh
 
Architecture and Development of NFC Applications
Architecture and Development of NFC ApplicationsArchitecture and Development of NFC Applications
Architecture and Development of NFC ApplicationsThomas de Lazzari
 
A 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCA 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCSecuRing
 
A 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCA 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCSlawomir Jasek
 
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)PROIDEA
 
Encode x Tezos: Building a dApp on Tezos
Encode x Tezos: Building a dApp on TezosEncode x Tezos: Building a dApp on Tezos
Encode x Tezos: Building a dApp on TezosKlaraOrban
 
Building a dApp on Tezos
Building a dApp on TezosBuilding a dApp on Tezos
Building a dApp on TezosTinaBregovi
 
Neal Thompson of Maritz at MPITechCon on RFID
Neal Thompson of Maritz at MPITechCon on RFIDNeal Thompson of Maritz at MPITechCon on RFID
Neal Thompson of Maritz at MPITechCon on RFIDKyle Hillman
 
Near field communication (NFC) in android
Near field communication (NFC) in androidNear field communication (NFC) in android
Near field communication (NFC) in androidMindfire Solutions
 
ABC2011Winter デ部 NFC
ABC2011Winter デ部 NFCABC2011Winter デ部 NFC
ABC2011Winter デ部 NFCMasahiro Wakame
 
Outsmarting smartphones
Outsmarting smartphonesOutsmarting smartphones
Outsmarting smartphonesSensePost
 
Rfid101 rfid introduction_lr
Rfid101 rfid introduction_lrRfid101 rfid introduction_lr
Rfid101 rfid introduction_lrCecile Tan
 
Rfid101 rfid introduction_lr
Rfid101 rfid introduction_lrRfid101 rfid introduction_lr
Rfid101 rfid introduction_lrCecile Tan
 

Similar to NFC on Android - Near Field Communication (20)

NFC & RFID on Android
NFC & RFID on AndroidNFC & RFID on Android
NFC & RFID on Android
 
Nfc on Android
Nfc on AndroidNfc on Android
Nfc on Android
 
Android NFC
Android NFCAndroid NFC
Android NFC
 
NFC Bootcamp Seattle Day 2
NFC Bootcamp Seattle Day 2 NFC Bootcamp Seattle Day 2
NFC Bootcamp Seattle Day 2
 
DefCon 2012 - Near-Field Communication / RFID Hacking - Lee
DefCon 2012 - Near-Field Communication / RFID Hacking - LeeDefCon 2012 - Near-Field Communication / RFID Hacking - Lee
DefCon 2012 - Near-Field Communication / RFID Hacking - Lee
 
Near field communication
Near field communicationNear field communication
Near field communication
 
Architecture and Development of NFC Applications
Architecture and Development of NFC ApplicationsArchitecture and Development of NFC Applications
Architecture and Development of NFC Applications
 
A 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCA 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFC
 
A 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFCA 2018 practical guide to hacking RFID/NFC
A 2018 practical guide to hacking RFID/NFC
 
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
CONFidence 2018: A 2018 practical guide to hacking RFID/NFC (Sławomir Jasek)
 
Encode x Tezos: Building a dApp on Tezos
Encode x Tezos: Building a dApp on TezosEncode x Tezos: Building a dApp on Tezos
Encode x Tezos: Building a dApp on Tezos
 
Building a dApp on Tezos
Building a dApp on TezosBuilding a dApp on Tezos
Building a dApp on Tezos
 
Neal Thompson of Maritz at MPITechCon on RFID
Neal Thompson of Maritz at MPITechCon on RFIDNeal Thompson of Maritz at MPITechCon on RFID
Neal Thompson of Maritz at MPITechCon on RFID
 
Near field communication (NFC) in android
Near field communication (NFC) in androidNear field communication (NFC) in android
Near field communication (NFC) in android
 
ABC2011Winter デ部 NFC
ABC2011Winter デ部 NFCABC2011Winter デ部 NFC
ABC2011Winter デ部 NFC
 
Rto automation using nfc
Rto automation using nfcRto automation using nfc
Rto automation using nfc
 
Aidc technology
Aidc technologyAidc technology
Aidc technology
 
Outsmarting smartphones
Outsmarting smartphonesOutsmarting smartphones
Outsmarting smartphones
 
Rfid101 rfid introduction_lr
Rfid101 rfid introduction_lrRfid101 rfid introduction_lr
Rfid101 rfid introduction_lr
 
Rfid101 rfid introduction_lr
Rfid101 rfid introduction_lrRfid101 rfid introduction_lr
Rfid101 rfid introduction_lr
 

More from Sven Haiges

NFC and Commerce combined
NFC and Commerce combinedNFC and Commerce combined
NFC and Commerce combinedSven Haiges
 
End to End Realtime Communication using Mobiel Devices and the Web
End to End Realtime Communication using Mobiel Devices and the WebEnd to End Realtime Communication using Mobiel Devices and the Web
End to End Realtime Communication using Mobiel Devices and the WebSven Haiges
 
NFC Android Introduction
NFC Android IntroductionNFC Android Introduction
NFC Android IntroductionSven Haiges
 
Gesture-controlled web-apps
Gesture-controlled web-appsGesture-controlled web-apps
Gesture-controlled web-appsSven Haiges
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on AndroidSven Haiges
 
Grails @ Java User Group Silicon Valley
Grails @ Java User Group Silicon ValleyGrails @ Java User Group Silicon Valley
Grails @ Java User Group Silicon ValleySven Haiges
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishGrails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishSven Haiges
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006
Grails 0.3-SNAPSHOT Presentation WJAX 2006Grails 0.3-SNAPSHOT Presentation WJAX 2006
Grails 0.3-SNAPSHOT Presentation WJAX 2006Sven Haiges
 

More from Sven Haiges (11)

NFC and Commerce combined
NFC and Commerce combinedNFC and Commerce combined
NFC and Commerce combined
 
End to End Realtime Communication using Mobiel Devices and the Web
End to End Realtime Communication using Mobiel Devices and the WebEnd to End Realtime Communication using Mobiel Devices and the Web
End to End Realtime Communication using Mobiel Devices and the Web
 
NFC Android Introduction
NFC Android IntroductionNFC Android Introduction
NFC Android Introduction
 
Gesture-controlled web-apps
Gesture-controlled web-appsGesture-controlled web-apps
Gesture-controlled web-apps
 
CouchDB on Android
CouchDB on AndroidCouchDB on Android
CouchDB on Android
 
Android UI
Android UIAndroid UI
Android UI
 
Html5
Html5Html5
Html5
 
Grails @ Java User Group Silicon Valley
Grails @ Java User Group Silicon ValleyGrails @ Java User Group Silicon Valley
Grails @ Java User Group Silicon Valley
 
Grails and Dojo
Grails and DojoGrails and Dojo
Grails and Dojo
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 EnglishGrails 0.3-SNAPSHOT Presentation WJAX 2006 English
Grails 0.3-SNAPSHOT Presentation WJAX 2006 English
 
Grails 0.3-SNAPSHOT Presentation WJAX 2006
Grails 0.3-SNAPSHOT Presentation WJAX 2006Grails 0.3-SNAPSHOT Presentation WJAX 2006
Grails 0.3-SNAPSHOT Presentation WJAX 2006
 

Recently uploaded

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfLoriGlavin3
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
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
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
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
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESmohitsingh558521
 
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
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Moving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdfMoving Beyond Passwords: FIDO Paris Seminar.pdf
Moving Beyond Passwords: FIDO Paris Seminar.pdf
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
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
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
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
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
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
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
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.
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
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
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
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
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICESSALESFORCE EDUCATION CLOUD | FEXLE SERVICES
SALESFORCE EDUCATION CLOUD | FEXLE SERVICES
 
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
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 

NFC on Android - Near Field Communication

  • 1. NFC
  • 2. about Sven Haiges, hybris GmbH Twitter @hansamann Android, HTML5, Groovy & Grails sven.haiges@hybris.de
  • 3. about Sven Haiges, hybris GmbH Twitter @hansamann Android, HTML5, Groovy & Grails sven.haiges@hybris.de NFC
  • 4. Basics Card Emulation Reader/Writer P2P NFC TagTechnologies Tag NDEF Dispatch APIs Android
  • 6. NFC roots: RFID • RFID - Radio Frequency Identification • 1983: First RFID patent granted • Typical, well-known use-cases for RFID animal identification, road taxes, libraries • 2004: Nokia, Philips and Sony established the NFC Forum
  • 7. NFC • “transfer data at low speed, without security, over short distances” • ~10 centimeters, in reality less • 424 kBit/s • 13.56 MHz
  • 8. NFC Devices • First mainstream Android smartphone: Nexus S • Common in new top Android phones • New RIM / Nokia devices • Apple iPhone?
  • 9. Nokia 6131 • released 2006 • early 2007: iPhone! • J2ME Spec: JSR 257 Contactless Communication API • NFC is not new!
  • 10. Forecast NFC handsets (k units) 600000 450000 300000 150000 0 2010 2011(e) 2012(e) 2013(e) 2014(e) 2015(e) Source:IHS iSuppli,compiled by Digitimes,May 2011
  • 12. Tickets Coupons Smart Poster Payment
  • 13. Tickets Coupons Smart Poster Payment Identity Keycard Personal ID
  • 14. NFC Checkin Tickets Social Coupons Gaming vCard Smart Poster Payment Identity Keycard Personal ID
  • 15. NFC Checkin Tickets Social Coupons Gaming vCard Smart Poster Payment WiFi Connections Bluetooth Identity Keycard Personal ID
  • 16. Transponder Format Technology/Capacity 13.56 Mhz Wristbands 125 Khz Cards Labels Sticker Keyfobs NFC Forum Tags Type 1-4
  • 17. can be made read only! NFC Forum Type 2 Tag Mifare Ultralight - 64 bytes Mifare Ultralight C - 192 bytes
  • 18.
  • 20. Mifare Ultralight All Surface Tag Mifare Ultralight Paper Ticket
  • 21. Mifare Ultralight All Surface Tag Mifare Ultralight Paper Ticket Mifare Ultralight Square Label
  • 22. Mifare Ultralight All Surface Tag Mifare Ultralight Paper Ticket Mifare Classic Mifare Ultralight Keyfob Square Label
  • 23. Shops • tagage.net • rfidshop.com • smartcardfocus.com • and many more...
  • 24. Comparing NFC Source:NFC Forum
  • 26. NFC Modes • Peer-to-Peer Mode • Reader/Writer Mode • Card Emulation Mode
  • 27. Android NFC Support • Peer-to-Peer Mode: limited • Reader/Writer Mode: excellent support • Card Emulation Mode: no support
  • 29. NFC & Android • Tag-Reading ab Android 2.3, API Level 9 • Tag-Writing ab Android 2.3.3, API Level 10 • Core classes: NFCAdapter, NFCManager, Tag Technology Classes
  • 30. Android Manifest • NFC Permission <uses-permission android:name="android.permission.NFC" /> • API Level <uses-sdk android:minSdkVersion="10" /> • NFC Feature <uses-feature android:name="android.hardware.nfc" android:required="true" />
  • 31. Android Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.flavor.android.nfc" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".MimeActivity" android:label="MIME"> <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED"/> <data android:mimeType="application/json" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.NFC" /> <uses-sdk android:minSdkVersion="10" /> <uses-feature android:name="android.hardware.nfc" android:required="true" /> </manifest>
  • 32. Android Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.flavor.android.nfc" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".MimeActivity" android:label="MIME"> <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED"/> <data android:mimeType="application/json" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.NFC" /> <uses-sdk android:minSdkVersion="10" /> <uses-feature android:name="android.hardware.nfc" android:required="true" /> </manifest>
  • 33. Android Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.flavor.android.nfc" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".MimeActivity" android:label="MIME"> <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED"/> <data android:mimeType="application/json" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.NFC" /> <uses-sdk android:minSdkVersion="10" /> <uses-feature android:name="android.hardware.nfc" android:required="true" /> </manifest>
  • 34. Android Manifest <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="de.flavor.android.nfc" android:versionCode="1" android:versionName="1.0"> <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".MimeActivity" android:label="MIME"> <intent-filter> <action android:name="android.nfc.action.NDEF_DISCOVERED"/> <data android:mimeType="application/json" /> <category android:name="android.intent.category.DEFAULT" /> </intent-filter> </activity> </application> <uses-permission android:name="android.permission.NFC" /> <uses-sdk android:minSdkVersion="10" /> <uses-feature android:name="android.hardware.nfc" android:required="true" /> </manifest>
  • 35. NFCManager • NFCManager used to get the NFCAdapter • Boring • Shortcut for getSystemService(NFC_SERVICE)
  • 36. NFCAdapter • the real thing • Control Foreground Dispatch and P2P NDEF Push • check if NFC is turned on
  • 37. Checking for NFC if (!getNFCAdapter().isEnabled()) { Toast.makeText(getApplicationContext(), "Please activate NFC and press back to return to the application!", Toast.LENGTH_LONG).show(); startActivity( new Intent(android.provider.Settings.ACTION_WIRELESS_SETTINGS) ); }
  • 38. Reading a Tag • Unlock phone, touch tag :-) • Most likely, the intent chooser will open
  • 39. Foreground Dispatch • Foreground Activity may redirect all intents related to tag, technology or NDEF discovery to itself • Getting all tags while activity is visible: enable in onResume(), disable in onPause()
  • 40. Foreground Dispatch nfcAdapter.enableForegroundDispatch( techListsArray does not matter activity, here, as ACTION_TECH_DISCOVERED is not in intentFilters array. It can pendingIntent, be null :-) intentFiltersArray, Most basic TAG-catch-all: techListsArray); use ACTION_TAG_DISCOVERED in filterList, no techs intent = PendingIntent.getActivity(activity, 0, new Intent(activity, activity.getClass()) .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); IntentFilter ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); ndef.addDataType("*/*"); intentFiltersArray = new IntentFilter[] { ndef }; techListsArray = new String[][] { new String[] { NfcA.class.getName() } };
  • 41. Receiving a Tag public void onNewIntent(Intent intent) { Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); } ... tag.getId() //returns id as byte[] String techs[] = tag.getTechList(); for (String tech : techs) { if (tech.equals("android.nfc.tech.Ndef")) { Ndef ndef = Ndef.get(tag); ndef.getType() ndef.getMaxSize() ndef.canMakeReadOnly() ndef.isWritable() NFCUtil.printNdefMessageDetails(ndef.getCachedNdefMessage())); } }
  • 42. Tag Technologies Tag Technologies map to tech specifications or to pseudo-technologie or capabilities like NDEF or NDEFFormatable TagTechnology MifareClassic MifareUltralight NdefFormatable Ndef NfcA NfcB NfcF NfcV IsoDep
  • 43. Tag Technologies Tag Technologies map to tech specifications or to pseudo-technologie or capabilities like NDEF or NDEFFormatable TagTechnology MifareClassic MifareUltralight NdefFormatable Ndef NfcA NfcB NfcF NfcV IsoDep
  • 44. NDEF • NFC Data Exchange Format • NFC Forum • Records can be MIME-type media, URIs or RTDs (Record Type Definitions) 1 * Ndef-Tag NdefMessage NdefRecord
  • 45. NdefRecord TNF Type ID Payload
  • 46. NdefRecord TNF Type ID Payload URI URI :-) NdefRecord WELL_KNOWN SMART_POSTER MIME TEXT
  • 47. Reading Tag Content //r = NdefRecord if (r.getTnf() == NdefRecord.TNF_ABSOLUTE_URI) { b.append(String .format("TNF_ABSOLUTE_URI: type(%1$s), id(%2$s), payload(%3$s)n", new String(r.getType()), idBytes.toString(), new String(r.getPayload()))); } else if (r.getTnf() == NdefRecord.TNF_MIME_MEDIA) { b.append(String .format("TNF_MIME_MEDIA: type(%1$s), id(%2$s), payload(%3$s)n", new String(r.getType()), idBytes.toString(), new String(r.getPayload()))); }
  • 49. Tag Dispatch Foreground Activity Dispatch NDEF Data Dispatch: ACTION_NDEF_DISCOVERED Tag Technology Dispatch: ACTION_TECH_DISCOVERED Fall-back Dispatch: ACTION_TAG_DISCOVERED
  • 50. Direct Start • Write custom NDEF MIME-type media messages • Use custom IntentFilter to bind to your messages
  • 51. Writing NDEF MIME NdefMessage msg = NFCUtil.getNdefMimeMessage("application/json", "{"key":"value"}"); Intent i = new Intent(this, WriteActivity.class); i.putExtra(WriteActivity.NDEF_MESSAGE, msg); startActivity(i);
  • 52. Writing NDEF MIME NdefMessage msg = NFCUtil.getNdefMimeMessage("application/json", "{"key":"value"}"); Intent i = new Intent(this, WriteActivity.class); i.putExtra(WriteActivity.NDEF_MESSAGE, msg); startActivity(i);
  • 53. Writing NDEF MIME private static NdefRecord getMimeRecord(String mimeType, String content) { NdefRecord record = new NdefRecord(NdefRecord.TNF_MIME_MEDIA, mimeType.getBytes(), getRandomIdBytes(), content.getBytes()); return record; }
  • 54. Writing NDEF MIME Ndef ndef = Ndef.get(tag); if (ndef.isWritable() && ndef.getMaxSize() > this.msg.toByteArray().length) { ndef.connect(); ndef.writeNdefMessage(this.msg); ndef.close(); } else //show toast?
  • 55. P2P: NDEF Push • Create NDEF Message which is pushed to another active device once the other device is close NfcAdapter.enableForegroundNdefPush(activity, ndefmessage) NfcAdapter.disableForegroundNdefPush(activity)
  • 56. about Sven Haiges, hybris GmbH Twitter @hansamann Android, HTML5, Groovy & Grails sven.haiges@hybris.de
  • 57. about Sven Haiges, hybris GmbH Twitter @hansamann Android, HTML5, Groovy & Grails sven.haiges@hybris.de NFC

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n