SlideShare ist ein Scribd-Unternehmen logo
1 von 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

Weitere ähnliche Inhalte

Was ist angesagt?

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
 

Was ist angesagt? (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
 

Andere mochten auch

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
 

Andere mochten auch (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
 

Ähnlich wie 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
 

Ähnlich wie 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
 

Mehr von 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
 

Mehr von 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
 

Kürzlich hochgeladen

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
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
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentPim van der Noll
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rick Flair
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...AliaaTarek5
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Mark Goldstein
 
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
 
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
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 

Kürzlich hochgeladen (20)

What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.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
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native developmentEmixa Mendix Meetup 11 April 2024 about Mendix Native development
Emixa Mendix Meetup 11 April 2024 about Mendix Native development
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...Rise of the Machines: Known As Drones...
Rise of the Machines: Known As Drones...
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
(How to Program) Paul Deitel, Harvey Deitel-Java How to Program, Early Object...
 
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
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
Arizona Broadband Policy Past, Present, and Future Presentation 3/25/24
 
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
 
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
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 

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

Hinweis der Redaktion

  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