Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Loading in …3
×
1 of 21

Windows Phone 8 NFC Quickstart

2

Share

Download to read offline

The quick walkthrough will show you how to create your first NFC app for Windows Phone 8.

The NearSpeak app (available soon in the WP Store) writes voice NFC tags - touch the tags again to hear your message! Leave notes for your partner, reminders for yourself, or use them for a fun public social experiment.

This hands-on tutorial will show you how to create this app. You will see how to write a LaunchApp tag using the NDEF Library for Proximity APIs, how to recognize text spoken by the user, and how to use the speech synthesizer to let the phone read the text again.

Note that the instructions require basic knowledge of Windows Phone development.

Related Books

Free with a 30 day trial from Scribd

See all

Related Audiobooks

Free with a 30 day trial from Scribd

See all

Windows Phone 8 NFC Quickstart

  1. 1. Windows Phone 8 NFC Quickstart – NearSpeak Andreas Jakl [@mopius] nfcinteractor.com Technology Wizard Nokia 1 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl NFC Forum and the NFC Forum logo are trademarks of the Near Field Communication Forum.
  2. 2. Near Field Communication NearSpeak 2 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  3. 3. Near Field Communication 3 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  4. 4. Scenarios Connect Devices Exchange Digital Objects Acquire Content 4 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  5. 5. Windows Phone 8 + Proximity APIs Windows 8 Documentation Win8: bit.ly/ProximityAPI WP8: bit.ly/ProximityAPIwp8 5 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  6. 6. NearSpeak nearspeak.at 6 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  7. 7. NearSpeak Record a Write to an Tap the tag to voice message NFC tag launch the app & hear the text! 7 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  8. 8. General Project Setup 1 Add Capabilities: Proximity, Microphone, Speech Recognition, Networking Requirement: NFC Connect to HW 2 Initialize ProximityDevice Detect devices in range _device = ProximityDevice.GetDefault(); Publish & subscribe to messages 3 Initialize Speech Recognizer & Synthesizer _recognizer = new SpeechRecognizer(); _synthesizer = new SpeechSynthesizer(); 8 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  9. 9. UI Design 9 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  10. 10. Listen 4 Text recognition (Speech-to-Text) var recoResult = await _recognizer.RecognizeAsync(); MessageBox.Show(string.Format("You said "{0}"n Please touch a tag to write the message.", recoResult.Text)); 10 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  11. 11. Data on an NFC Tag LaunchApp Arguments [speech text] WindowsPhone app ID {0450eab3-92…} Data Encapsulated in Encoded through Stored on NDEF Record(s) NDEF Message NFC Forum NFC Forum Tag Tag Type Platform 11 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl NDEF = NFC Data Exchange Format, Container image adapted from s_volenszki (Flickr), released under Creative Commons BY-NC 2.0
  12. 12. NDEF.codeplex.com Create NDEF Reusable Parse information messages & records NDEF from raw byte arrays (standard compliant) classes Fully documented Open Source LGPL license (based on Qt Mobility) 12 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  13. 13. Supported Record Types Geo tags Smart Poster Social tags URI SMS tags Text Telephone call LaunchApp Android Application Record (AAR) Nokia Accessories Record 13 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl Why use the library for “Talking Tags”? Creating LaunchApp records is easier, and you can also send them to other phones and not only write to a tag.
  14. 14. NDEF Library 5 Use NuGet package manager to install NDEF Library for Proximity APIs 14 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  15. 15. Write NFC Tags 6 Create LaunchApp Message (in button call-back method) var record = new NdefLaunchAppRecord {Arguments = recoResult.Text}; record.AddPlatformAppId("WindowsPhone", "{...}"); var msg = new NdefMessage {record}; 7 Write to the next tag _device.PublishBinaryMessage("NDEF:WriteTag", msg.ToByteArray().AsBuffer(), MessageWrittenHandler); 15 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  16. 16. Write NFC Tags 8 NFC message written to a tag? Inform user private void MessageWrittenHandler( ProximityDevice sender, long messageId) { Dispatcher.BeginInvoke(() => MessageBox.Show( "Message written")); } 16 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  17. 17. Speak When Launched 9 App launched from a tag? Speak the stored text! protected override async void OnNavigatedTo( NavigationEventArgs e) { base.OnNavigatedTo(e); if (NavigationContext.QueryString.ContainsKey( "ms_nfp_launchargs")) { await _synthesizer.SpeakTextAsync( NavigationContext.QueryString ["ms_nfp_launchargs"]); } } 17 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  18. 18. Nfc Interactor for Windows Phone 8 18 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  19. 19. nfcinteractor.com 19 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  20. 20. Near Field Communication NearSpeak 20 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl
  21. 21. Thank You. NFC Introduction bit.ly/NfcIntro Andreas Jakl Related Presentations [@mopius] Windows (Phone) 8 NFC App Scenarios bit.ly/NFCAppScenarios nfcinteractor.com NFC Development on the Windows 8 Platform Technology Wizard bit.ly/Win8NFC Nokia NFC Development with Qt on Symbian and MeeGo bit.ly/NfcDevelopment 21 Windows Phone 8 NFC Quickstart - NearSpeak v1.1.0 November 20, 2012 © 2012 Andreas Jakl

×