WinJS, Apache Cordova & NFC - HTML5 apps for Android and Windows Phone
Developing NFC Apps
-
Upload
larry-mcdonough -
Category
Technology
-
view
519 -
download
3
description
Transcript of Developing NFC Apps
![Page 1: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/1.jpg)
112 April 2023
NFC Forum, Developers ShowcaseMarch 21st, 2014
DEVELOPING NFC APPSfor BLACKBERRY
Larry McDonough, Principal Evangelist@LMCDUNNA
![Page 2: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/2.jpg)
212 April 2023
CONTENTS• Development on BlackBerry
• BlackBerry NFC Support
• 5 most common use cases
• NFC Demos
• Q & A
![Page 3: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/3.jpg)
312 April 2023
First, Some Stats…
• A mobile device management leader with global enterprise customer base exceeding 80,000
• 30,000+ BES 10 commercial & test servers installed
• 250,000+ BBM Channels globally since launch
• 40+ Million newly registered Android/iOS BBM users in first 60 days
• 665+ carriers and distribution partners offering BlackBerry products and services in more than 175 countries around the world
![Page 4: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/4.jpg)
412 April 2023
High Level Architecture
BlackBerry Platform & Services(BlackBerry Enterprise Service 10, Push, Payments, BBM,
Invocation Framework, Share Framework, Maps, …)
Native C++ &Cascades UI
BlackBerry 10 OS
HTML5 & WebWorks
Android Runtime
Support for NFC in the Android Runtime is coming in 10.3
![Page 5: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/5.jpg)
512 April 2023
Strong & Growing Ecosystem
C/C++Native SDK
Wide choice of programming languages
Java Android Runtime
C++/QtCascades
Broad range of
app dev libraries
and personal apps
Managing corporate...
HTML5 BlackBerryWebWorks™
![Page 6: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/6.jpg)
612 April 2023
Top Partners
![Page 7: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/7.jpg)
712 April 2023
BlackBerry World
• In over 170 Markets
• Free to register
• Free to submit upgrade
• 70/30 revenue share
• Credit card, PayPal, Carrier Billing
• 5+ Billion apps downloaded
![Page 8: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/8.jpg)
812 April 2023
http://developer.blackberry.com
• Tools, samples, documentation, Forums…
• HTML5 / WebWorks• C, C++, Native SDK• Cascades UI Framework• Android
• Frameworks Partners: • Appcelerator, Cordova, dojo,
jQuery Mobile, Marmalade, Qt, Sencha Touch, Unity
![Page 9: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/9.jpg)
912 April 2023
BlackBerryNFC Support
![Page 10: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/10.jpg)
1012 April 2023
CONTENTS• What is NFC? (skipped for this audience!)
• NFC Tags
• Peer to Peer
• Card Emulation
• Virtual Target (Host Card) Emulation
• Reading Contactless Cards
• APIs & Built-in Apps Support
![Page 11: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/11.jpg)
1112 April 2023
About NFC TagsMemory Cards that
store data
Have a contactless interface
Read by a device termed “the Reader”
App takes action in response to the message
![Page 12: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/12.jpg)
1212 April 2023
About NFC Tags4 standard NFC Forum
tag types
Message format is standard (NDEF)
Standard message types include Smart
Poster, Text, URICustom types
(“external”) allowed
Various tag capacities
![Page 13: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/13.jpg)
1312 April 2023
About Tag Circuitry
![Page 14: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/14.jpg)
1412 April 2023
Field Detection and Power
![Page 15: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/15.jpg)
1512 April 2023
Demo 1 – NFC Business Card
• No coding or client app necessary
• Uses standard URL message format
• Leverages browser to take user to my eBusiness Card site
• Backend server code helps me track who I met, who downloaded my vcard, etc.
Front Back
w/QR CodeFor iOS users
w/NFC TagFor real smartphone users
![Page 16: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/16.jpg)
1612 April 2023
After scanning tag, developers can:
• Add my vcard to their address book which includes usual stuff plus:
• LinkedIn URL,
• Twitter handle,
• Slide Share link,
• BlackBerry Dev Blog link,
• My Blogger link, etc.
• Request a device, Register as a vendor, and visit BlackBerry dev site
Demo 1 – NFC Business Card
![Page 17: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/17.jpg)
1712 April 2023
Demo 2 – NFC Fun Run
Have a nice cup of tea
Stop timer
Run!
Start timer
![Page 18: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/18.jpg)
1812 April 2023
Register with Invocation Framework
<invoke-target id="com.example.NfcRaceTime"><type>APPLICATION</type><filter>
<action>bb.action.OPEN</action>
<mime-type>application/vnd.rim.nfc.ndef</mime-type>
<property var=“uris” value=“ndef://4/my.rim.com/myrecordtype”/></filter>
</invoke-target>
![Page 19: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/19.jpg)
1912 April 2023
Client action C++ and Qt
bb::system::InvokeManager* _invokeManager = new bb::system::InvokeManager();
void App::receivedInvokeRequest( const bb::system::InvokeRequest& request) {
QByteArray data = request.data();
QtMobilitySubset::QNdefMessage ndefMessage = QtMobilitySubset::QNdefMessage::fromByteArray(data);
handleNdefRequest(ndefMessage);}
![Page 20: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/20.jpg)
2012 April 2023
CONTENTS• What is NFC? (skipped for this audience!)
• NFC Tags
• Peer to Peer
• Card Emulation
• Virtual Target (Host Card) Emulation
• Reading Contactless Cards
• APIs & Built-in Apps Support
![Page 21: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/21.jpg)
2112 April 2023
Transfer data from one device to another• Share information just by touching
Any kind of data• Photos, music files, address book contacts are typical
examplesFor larger items let NFC negotiate a Bluetooth connection• No need for the usual BT pairing process• Simple!
What is Peer to Peer NFC?
![Page 22: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/22.jpg)
2212 April 2023
What is Peer to Peer NFC?
Bask in the admiration!
NFC ( and maybe Bluetooth) Magic
Touch devices!
Select object to share
![Page 23: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/23.jpg)
2312 April 2023
Share from QMLInvokeActionItem { id: sharedNdefData query { mimeType: "application/vnd.rim.nfc.ndef" invokeActionId: "bb.action.SHARE" }}
onShowing: { // make NDEF message as byte array in C++ sharedNdefData.data = _ndefFactory.getNdefVcardMessage(sendVcard.ndefFirstName, sendVcard.ndefLastName, sendVcard.ndefAddress, sendVcard.ndefEmail, sendVcard.ndefMobile); }
![Page 24: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/24.jpg)
2412 April 2023
Share from C++NfcShareManager *_nfcShareManager = new NfcShareManager();...void NfcSharing::fileShareContentChanged(QString paths) { NfcShareFilesContent request; QList<QUrl> urls;... // Construct a list of local file URLs from file paths... request.setFileUrls(urls);
// share mode File means Bluetooth connection handover _nfcShareManager->setShareMode(bb::system::NfcShareMode::File); NfcShareSetContentError::Type rc = _nfcShareManager->setShareContent(request);}
![Page 25: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/25.jpg)
2512 April 2023
CONTENTS• What is NFC? (skipped for this audience!)
• NFC Tags
• Peer to Peer
• Card Emulation
• Virtual Target (Host Card) Emulation
• Reading Contactless Cards
![Page 26: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/26.jpg)
2612 April 2023
What are we Emulating?
Almaden ValleyHealth Club
Larry McDonoughMember Since: 2/11/2005
Membership & Loyalty Cards Credit Cards ID Cards
We are emulating Smart Cards
![Page 27: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/27.jpg)
2712 April 2023
What are Smart cards?
A small computer
Processor, OS, file system
Can run special apps called
‘applets’
Secure Embedded in a plastic card
Contacts and/or contactless
interface
Almaden ValleyHealth Club
Larry McDonoughMember Since: 2/11/2005
![Page 28: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/28.jpg)
2812 April 2023
Smart Cards & Readers
Almaden ValleyHealth Club
Larry McDonoughMember Since: 2/11/2005
Power
Communications
Smart Card ReaderWith contact-based slot and contactless interface (NFC)
![Page 29: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/29.jpg)
2912 April 2023
General Architecture
![Page 30: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/30.jpg)
3012 April 2023
BlackBerry Architecture
![Page 31: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/31.jpg)
3112 April 2023
Card Emulation In Use
Admire your purchase
Optionally be notified of transaction
Reader communicates directly with SE
Touch handset to a reader
![Page 32: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/32.jpg)
3212 April 2023
Interact with Secure Element
...rc = nfc_se_session_open_logical_channel(hSESession, the_aid, sizeof(the_aid), fcpResponseType, &seChannel, &openResponseLen);...rc = nfc_se_channel_transmit_apdu( seChannel, the_apdu, apdu_size, &exchangeResponseLen );...rc = nfc_se_channel_get_transmit_data(seChannel, result, &nReceiveAPDUBufferSize));...
![Page 33: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/33.jpg)
3312 April 2023
Transaction Notification...<invoke-target id="com.example.NfcTool.tl"> <entry-point>1</entry-point> <type>APPLICATION</type> <filter>
<action>bb.action.NOTIFY</action> <mime-type>application/vnd.bb.nfc_transaction</mime-type> <property var="uris“ value="aid://SIM/6e.66.63.74.65.73.74.30.31/"/>
</filter></invoke-target>...
![Page 34: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/34.jpg)
3412 April 2023
MNOs
FinancialInstitutions
Retail
Transport
SecureProvisioning(e.g. TSM)
SecureTransactions(e.g. EMV)
SecurePayments
(NFC)
NFC Payments EcoSystem
![Page 35: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/35.jpg)
3512 April 2023
CONTENTS• What is NFC? (skipped for this audience!)
• NFC Tags
• Peer to Peer
• Card Emulation
• Virtual Target (Host Card) Emulation
• Reading Contactless Cards
• APIs & Built-in Apps Support
![Page 36: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/36.jpg)
3612 April 2023
What is Virtual Target Emulation?
Smile at new allocation of loyalty points!
Application completes transaction
Reader communicates with BlackBerry 10 App
Touch handset to a reader
![Page 37: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/37.jpg)
3712 April 2023
Fool that Reader!
• Virtual target emulation makes your smartphone seem just like an NFC tag or card
• The reader cannot tell them apart
• Of course you cannot set the UID of the emulated target – that is not under your control
![Page 38: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/38.jpg)
3812 April 2023
Emulating an NDEF Tag...
nfc_ndef_record_t *ndefRecord = makeCustomRecord(QString("my.rim.com"), QString("myrecordtype"), tagData);
rc = nfc_create_ndef_message(&_emulateNdefMessage);
rc = nfc_add_ndef_record(_emulateNdefMessage, ndefRecord);
rc = nfc_start_ndef_tag_emulation(_emulateNdefMessage);...
![Page 39: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/39.jpg)
3912 April 2023
CONTENTS• What is NFC? (skipped for this audience!)
• NFC Tags
• Peer to Peer
• Card Emulation
• Virtual Target (Host Card) Emulation
• Reading Contactless Cards
• APIs & Built-in Apps Support
![Page 40: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/40.jpg)
4012 April 2023
What is it?
Read data from physical (plastic) contactless cards• Right into your application
Reduce manual data entry• e.g., credit card number
Make card usage tracking more convenient• e.g., view card use history or balance on BlackBerry 10
smart phone
![Page 41: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/41.jpg)
4112 April 2023
What can you do with it?
1. Card details required
2. User presentscontactless card
3. App reads detailsfrom card and completes
form
![Page 42: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/42.jpg)
4212 April 2023
How do you do this?
Exactly *how* depends on the card type• A credit card is not the same as an ID card• Transit cards are not all the same
Exchange APDUs with the card• Response APDUs will contain the data you want• You have to send the right command APDUs though
Touch card to BlackBerry to fill in form• Details for credit cards are defined in the EMV specifications
![Page 43: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/43.jpg)
4312 April 2023
How do you do this?
User delighted with result of your thoughtful
feature
APDU ‘conversation’ with card yields data
BlackBerry 10 App acts as reader
Touch handset to a card
![Page 44: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/44.jpg)
4412 April 2023
Code Example...rc = nfc_register_tag_readerwriter(TAG_TYPE_ISO_14443_4);...nfc_tag_transceive(target, TAG_TYPE_ISO_14443_4, the_apdu, apdu_size, response, MAX_RESPONSE_SIZE, &rlength);...
![Page 45: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/45.jpg)
4512 April 2023
Amsterdam Travel Pass
Review your last two transactions
APDU ‘conversation’ with Transit Card
BlackBerry 10 App acts as reader
Touch handset to Transit Card
![Page 46: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/46.jpg)
4612 April 2023
NFC APIs APIs R/W APINDEF Write/Read (Invocation Framework)ISO14-4ISO14-3ISO14-3 RawISO15-3 P2P APINDEF send/receive (Invocation Framework)ISO18
VCE APIISO14-4 UICC CE APISIM AccessTransaction NTF
![Page 47: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/47.jpg)
4712 April 2023
NFC Apps Support (Built in)
SmartTagsContactsBrowserGallery (Pictures, Video, Music Player)DocToGoFile Manager
CalendarAdobe ReaderEmailBBMAppWorldCall
Apps supporting NFC (implicit, explicit) out-of-the-box:
![Page 48: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/48.jpg)
4812 April 2023
CONTENTS• What is NFC? (skipped for this audience!)
• NFC Tags
• Peer to Peer
• Card Emulation
• Virtual Target (Host Card) Emulation
• Reading Contactless Cards
• APIs & Built-in Apps Support
![Page 49: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/49.jpg)
4912 April 2023
NFC Developer Resources
• http://tinyurl.com/cqfzf7y Articles
• https://github.com/blackberry/Cascades-Community-SamplesCode
• Martin Woolley @mdwrim• John Murray @jcmrim• Rob P Williams @robbieDubya
Contacts
![Page 50: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/50.jpg)
5012 April 2023
Questions & Answers
• http://tinyurl.com/cqfzf7y Articles
• https://github.com/blackberry/Cascades-Community-SamplesCode
• Martin Woolley @mdwrim• John Murray @jcmrim• Rob P Williams @robbieDubya
Contacts
Larry McDonough @lmcdunna
![Page 51: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/51.jpg)
5112 April 2023
Thank You
![Page 52: Developing NFC Apps](https://reader036.fdocuments.net/reader036/viewer/2022062319/554f85b1b4c9052a518b4ead/html5/thumbnails/52.jpg)
5212 April 2023
Native C/C++/Qt Application Developers
High Level ArchitectureWeb Application
Developers
Community and Content
Developers
UI Framework
Platform, device and
cloud APIs
BlackBerry 10 OS
Memory Mgmt
SecurityGraphic
s
BlackBerry Cascades
HTML5, CSS, JavaScript
Sensors ….
Gaming Platforms
Android Runtime
Web Frameworks
Multi-threadin
g