lumia app labs: developing nfc apps in windows phone 8
TRANSCRIPT
DEVELOPING NFC APPS IN WINDOWS PHONE 8 Andreas Jakl [@mopius] Mopius
LUMIA APP LABS #8
− NFC intro
− Share captured photos
− Share URLs
− Share your app − Custom URI scheme
− LaunchApp tag
− Storing data on NFC tags
− Multi-user collaboration
− Tools & resources
AGENDA
2
3
TAP AND DO
A gesture that is a natural interaction between people in close proximity used to trigger doing something together between the devices they are holding.
System: Near Field Proximity (e.g., NFC)
Documentation: bit.ly/ProximitySpec
4
SCENARIOS
Connect Devices Exchange Digital Objects Acquire Content
5
Prox
imit
y AP
Is
Win
dow
s Ph
one
8 +
W
indo
ws
8 Documentation
Win8: bit.ly/ProximityAPI WP8: bit.ly/ProximityAPIwp8
ASUS VivoTab RT LTE
6
SHARE CAPTURED PHOTOS
7
SHARE CAPTURED PHOTOS
1. Take
picture
2. Share
captured file
CameraCaptureTask ShareMediaTask
Code Demo
8
SHARE URLS
NDEF Message
9
NFC DATA
NDEF Record (e.g., URL)
…
NDEF = NFC Data Exchange Format
10
NDEF.CODEPLEX.COM
Reusable NDEF
classes
Create NDEF messages & records
(standard compliant)
Parse information from raw byte arrays
Fully documented Open Source LGPL license
(based on Qt Mobility)
NDEF messages are standardized by the NFC Forum: http://www.nfc-forum.org/specs/
11
SUPPORTED RECORD TYPES
Smart Poster URI
Text LaunchApp
Android Application Record (AAR) Windows Phone Settings
Nokia Accessories Record NearSpeak Voice Messages
Geo tags Social tags SMS tags Telephone call Mailto tags
12
SHARE URLS
Code Demo
13
14
SHARE YOUR APP
15
CUSTOM URI SCHEME
nearspeak: en-USmGood+morning. Custom data
Protocol name
Encoded Launch URI
Examples* skype:mopius?call
nokia-music://show/artist/?name=Rihanna
* Definition & examples: http://en.wikipedia.org/wiki/URI_scheme
16
CUSTOM URI SCHEME
… from NFC tags
… on other devices
… from other apps
(same device)
Launch your app ...
Code Demo
17
USER EXPERIENCE
No app installed 1 app installed 2+ apps installed
18
LAUNCHING APPS
Tag / phone launches app through custom URI scheme
Tag directly contains app name and parameters
19
CUSTOM URIS VS. LAUNCHAPP
Use less space on tag (LaunchApp with multiple app ids: big!)
Better cross-platform compatibility (also Android apps can be launched with custom URI)
No unique app mapping (other apps can register for your URI scheme too!)
Recommended
20
STORING APP DATA ON NFC TAGS
HTTP Website
Link
Safest and most cross-platform
Custom URI Scheme
Better UX for app launching
LaunchApp Tag
Best app launching UX, but specific
to Windows
Windows Protocol
Should not be used for storing
custom data
External Type
Standardized type for storing data, but limited use on Windows
bit.ly/NfcAppData
21
MULTI-USER COLLABORATION
Tap for
22
MULTI-USER COLLABORATION
Quick Data Exchange
ProximityDevice Exchange Windows /
NDEF messages, SNEP protocol
Long Term Connection
PeerFinder Automatically builds
Bt / WiFi Direct socket connection
23
ESTABLISHING
Long Term Connection
Trigger
Interact with Tap NFC
Browse
Start Search Bt, WiFi, etc.
24
TAP TO TRIGGER
App not installed
App installed
25
CONNECTION STATE
PeerFound
1 Proximity gesture complete Devices can be pulled away
Connecting / Listening
2 Which device initiated tap gesture? → Connecting, other device Listening
Completed
3 Access socket of persistent transport
(e.g., TCP/IP, Bt)
26
NFCRPS Multiplayer game
Tap launches app
on 2nd phone
Players decide next move on
own device
Both see the winner! Code Demo
27
TOOLS & RESOURCES
− NFC Overview: developer.nokia.com/NFC
− MSDN Proximity API documentation: bit.ly/ProximityAPIwp8
− NFC News: nfcworld.com
− NDEF Library for Proximity APIs: ndef.codeplex.com
− NFC developer comparison (WP, Android, BlackBerry): bit.ly/NfcDevCompare
− Specifications: nfc-forum.org
TOOLS AND RESOURCES
28
29
Thank you! Andreas Jakl [@mopius]
nfcinteractor.com
Code examples online: bit.ly/NfcWebinar