Google I/O 2011 How To NFC 在說些什麼?

来源:互联网 发布:荷兰GPA算法 编辑:程序博客网 时间:2024/05/18 13:29

Google 在 2011 I/O 大會上對於發展 NFC 技術做了一番說明,底下是原始影像和重點整理,提供給你參考:

http://www.youtube.com/watch?v=49L7z3rxz4Q

這裡是影片中有提到的 NFC Android Documentation(http://nfc.android.com/)。

重點整理:

  • NFC 不等於 RFID,NFC 是 1-4 公分距離感測,RFID 感測距離可以到公尺;NFC 每秒只能傳 1Kbits,所以不適合放大量 data,so please no XML in the NFC。
  • Gingerbread (Android 2.3) API 目前支援 reader/writer mode,不支援 Card emulation,下一版(Ice Cream Sandwich)也不確定會不會放 Card emulation 功能。

原因是業界目前 NFC 卡的標準有許多,目前 NFC 硬體只能 emulate 一種格式,這就看手機製造商的選擇,有可能某些手機選擇支援 NFC A,有些手機選擇 NFC B,等等不同格式.

Android team 認為這對 3rd party developer 會是個困擾,所以他們決定不放進去。在業界標準沒有達成統一之前,或是 NFC 硬體不能同時emulator 多種格式之前,他們都不會輕易的加到 Android SDK。

Android 沒有 support card emulation 功能就代表手機不能拿來當做悠遊卡一樣做 mobile payment,所以 Google 鼓勵 developer 使用 NFC 技術做 peer-to-peer、data exchange、0-click sharing,偏重兩隻手機之間互動的方式。

但如果兩隻手機用同樣的 app,使用現有 Gingerbread 的 API,還是可以做到特別定義的交易行為。

可以看得出來,就技術面來說,手機拿來做卡片支付是尚未 ready 的機制,而 Google 本身也不會主動參與這種偏政治性的議題。所以 NFC 目前先拿來被 Google 鼓勵來做兩隻手機之間的互動方式,再來的方向就讓開發社群自行發展囉。


附录演讲字幕:

0:09
>>Jeff Hamilton: Nick Okay. Hi, everybody.Welcome to how to NFC.
0:12
My name is Jeff Hamilton, and I'm an engineeron the Android team working on the NFC stack.
0:16
>>Nick Pelly: And my name is Nick Pelly. I'malso a software engineer on the Android team,
0:21
working on the NFC stack.I also want to introduce you to Ben Dodson,
0:26
who is an intern on the Android team and willbe helping with the demos.
0:30
>>Jeff Hamilton: Before we get started, we'dlike to point out -- hold on a second. We
0:39
lost the slides here.>>Nick Pelly: Should we switch to the other
0:54
box?>>Jeff Hamilton: Yeah.
1:04
Okay. Before we get started, we'd just liketo point out real quick we have some links
1:07
for feedback for the presentation. If you'dlike to give feedback on how we're doing up
1:11
here. Also, we have some hashtags if you'regoing to be tweeting about the talk, you can
1:18
see up here, IO2011 and Android. We're goingto take some live questions from the audience
1:23
as well as from Google Moderator. If you havequestions that come up during the talk, you
1:26
can put them in online, or if you're watchingthe live stream, feel free to put questions
1:30
in there and we'll get to those at the endof the talk.
1:34
So we're going to talk today about, you know,first, what is NFC.
1:41
Second, we're going to talk about why useNFC and why this is relevant to you as developers
1:46
to add to your applications.Third, we're going to talk briefly about how
1:51
to NFC 101, just kind of an intro to NFC onAndroid and what you can do as developers
1:56
to add NFC support to your applications.Fourth, we're going to talk to how to NFC
2:01
201 and deep dive a little bit more into thedetails of the technology.
2:09
So first, what is NFC?Just a quick show of hands, how many people
2:12
in the audience are familiar with what NFCis?
2:14
Wow.>>Nick Pelly: That's a lot.
2:16
>>Jeff Hamilton: That's quite a lot of you.Now we'd like to do a quick show of hands.
2:21
How many of the developers out there haveadded NFC support to their applications.
2:23
>>Nick Pelly: We've got to change this.>>Jeff Hamilton: Quite a few of hands were
2:29
up for the first question, not for the second.We're hoping by the end of this talk, you'll
2:32
have the information you need to add NFC supportto your applications.
2:39
So just real quick, what is NFC? It standsfor Near Field Communications. And it's a
2:43
wireless technology similar to Bluetooth orWi-Fi where you can transmit data wirelessly.
2:48
Unlike Bluetooth or Wi-Fi, it has very shortrange. So the theoretical maximum is about
2:55
ten centimeters. On a smartphone, you're goingto see closer to one to four centimeters typical
3:00
range for interactions.NFC is also typically low speed. So you're
3:06
going to get between your configurations,106 to maybe 414 kilobits per second. That's
3:13
kilobits, not kilobytes. That kind of dependson your configuration as well as -- these
3:19
are theoretical maximum numbers. You mightsee lower speeds than that.
3:25
So those two properties, you know, don't reallycompare to Bluetooth or Wi-Fi. But what's
3:29
really great about NFC is it's a low-frictionsetup. So because it's -- only works at short
3:35
range, anytime you bring two devices thatsupport NFC within that range, they're going
3:39
to set up a connection and be ready to talkto each other. So there's no discovery like
3:44
you have in Bluetooth. There's no pairing.You don't have to put in passwords or anything
3:48
like that. This is really, we think, a magicalproperty of NFC that really makes it kind
3:51
of a science fiction type of technology. Thingsjust work.
3:56
Additionally, NFC supports what is calledpassive targets. These are devices that do
4:01
NFC, but they don't have batteries in them.These are things like stickers or random devices
4:08
that aren't powered, can support NFC. There'sa tiny microcontroller with an antenna, and
4:13
it picks up the power from a secondary deviceand actually powers up the device from another
4:19
one. So you can interact with things in theworld and they don't need power. And that's
4:23
a really interesting property of NFC thatdoesn't exist in any other technology. And
4:29
we think it really enables, you know, interestingapplications for, you know, the technology
4:34
and great things that people can do with it.Off to Nick.
4:41
>>Nick Pelly: Jeff's talked a little bit aboutthe basic properties of NFC. And, hopefully,
4:47
some of you in the audience have some ideasof how you can use these properties to build
4:52
awesome applications.Today, we want to make the case to you of
4:56
why NFC is going to be so compelling to users.Why should you care about NFC?
5:08
Well, we like to think of it as bridging thephysical and the virtual worlds. Now, this
5:14
is a kind of cheesy saying. But, you know,this is really true. With NFC and low proximity,
5:19
you can bring two devices next to each otherand it will trigger a virtual reaction. Physical
5:25
actions, virtual reactions.This is something that we haven't seen from
5:30
any other wireless technology. Bluetooth,Wi-Fi, you don't have that easy connection
5:35
setup. This is new to NFC, and we think usersare going to love it.
5:39
Let us show some demonstrations.So first, basic tag read. You may already
5:47
be familiar with this, but we're going toshow it anyway. Everyone has a Google I/O
5:52
badge. And inside it, you've got your NFCsticker. I've got one of them here right now.
5:58
So you may have already tried this with yourNexus S. If not, let me show you how easy
6:04
it is to read content off of this tag.You take your Nexus S, if I get the right
6:10
phone. At the home screen, and just touchit to the tag. (chime).
6:18
There you go. I've read Jeff's contact details.That's the V card. So these are stickers,
6:23
you can start thinking about where you mightwant to place these stickers. A useful one
6:28
for Jeff would probably be on his front.So we can now tap Jeff and read his contact
6:37
details.>>Jeff Hamilton: Come see me after the talk.
6:40
[ Laughter ]>>Nick Pelly: So these stickers don't need
6:45
any power. They're inexpensive, they're becomingcheaper. You can think of them a little like
6:51
QR codes. You can embed basic data onto them.Let's now go to a few more demonstrations
6:59
of the kind of content you can put on an NFCtag.
7:01
We're going to switch to the demo board, wherewe have a number of tags embedded into the
7:09
board so that we can quickly tap differentareas and show you the NFC content in the
7:14
tags.These tags could just as easily be a sticker
7:16
or a card or any other form factor.Ben's going to just tag a few of these and
7:21
show how easy it is to read content.The first one had a URL. Android.com, the
7:26
Wi-Fi's a little slow -- there we are. It'scoming up. (chime).
7:31
The next one has another V card. And thenthe next one should have some text. (chime).
7:40
So, hopefully, you're getting the idea. Wecan put URLs, text, contact, in fact, any
7:45
MIME data type into a tag. And most importantly,when you touch the phone to the tag, it doesn't
7:51
matter where you are, it doesn't matter thatyou don't have any application running. You
7:55
can be at the home screen, and it will takeyou to the right application to handle that
7:58
content. That's really powerful. QR codesdon't do that.
8:03
Let's do a direct comparison, actually, ofNFC versus QR codes.
8:07
This is a little bit unfair, but let's justdo it to see the difference in speed.
8:12
So Jeff is going to try and read a GooglePLACES location embedded in a tag by scanning.
8:22
While Ben is going to read it from a QR code.Three, two, one, go. (chime).
8:30
>>Nick Pelly: And the NFC tag's already done.It's a little bit unfair to QR. You have to
8:36
fire up the application and focus the camera.Good luck if you're in low light conditions.
8:42
So the key point here, NFC is just reallyfast. It's low friction. We think users are
8:47
going to love it.And you can see the sequence with QRs.
8:51
So let's now go to an application that weput together in just a few days. We have APIs
8:58
for NFC read, write, and peer-to-peer thatare already a part of the Gingerbread platform
9:04
today. So we've used these APIs to put togetheran application called Sticky Notes. It's just
9:10
a very simple application to, you know, showyou how easy it is to use.
9:15
Ben is going to tag this phone to some textand it's going to automatically launch the
9:20
Sticky Notes application. That's it. It'sread the content. We can now show you that
9:25
it can actually write content to these tagsas well. This is something we haven't mentioned
9:30
yet. These tags are reprogrammable. They area -- they have their own microprocessor. It's
9:38
not like a QR code. You can actually programthese things once they're already deployed.
9:42
So can we get, like, a word or a phrase thatyou want to put into a tag here? We can demonstrate
9:48
it live.Chicken. Okay.
9:49
>>Jeff Hamilton: Chicken it is.>>Nick Pelly: That was really quick.
9:55
We have a lively audience.Okay. Ben's programmed it into the tag to
10:03
prove we're not faking it. Jeff is going touse a different phone to read it back out.
10:07
And note it's going to launch the Sticky Notesapplication again.
10:09
>>Jeff Hamilton: There we go.>>Nick Pelly: That's it. It's just so easy.
10:12
So now the third mode --[ Applause ]
10:22
>>Jeff Hamilton: There we go.>>Nick Pelly: Thank you.
10:23
[ Applause ]>>Nick Pelly: The third that's really interesting
10:24
is peer-to-peer. Yep, you can read or writeto these passive stickers, and, yeah, there
10:30
are plenty of other peer-to-peer protocols,Bluetooth, Wi-Fi. What makes NFC so interesting
10:36
is that it's triggered by the proximity, soyou don't need to go fumbling around in any
10:40
UI. You just put the two phones together.What we have is the two phones, both in the
10:46
Sticky Notes application, both with differenttext contents. With the Nexus S, the antennas
10:51
are in the back of the phone, so you placethem back to back. (chime).
10:57
And they've exchanged content. That's it.You don't need to go fumbling around in any
11:02
menus.[ Applause ]
11:04
>>Nick Pelly: We're going to show some morepeer-to-peer demos, and we're going to do
11:11
it using the demo board. There's the outlineof two Nexus S phones on here. They have actually
11:16
got antennas hard-wired behind them so thatwe can show you the front of both phones as
11:21
we do peer-to-peer. But if you're trying thisat home, you're going to want to put the phones
11:25
back to back.So we hope that you're beginning to see some
11:33
of the possibilities of this technology.What we wanted to do was just throw together
11:38
some demos of -- some more sort of sci-fi,like, what can this proximity-triggered action
11:45
enable.We wanted to create a wormhole. We programmed
11:50
two tags to be the end points of this wormhole.You can imagine that one tag is in Australia;
11:56
one tag is in San Francisco. And when youplace one phone on the first tag, it begins
12:02
the wormhole. (chime).>>Nick Pelly: And on this other tag. (chime).
12:12
We've taken a risk with these demos. We haveNFC, Bluetooth, and Wi-Fi at a conference.
12:21
So the Wi-Fi is a bit slow.But what's going to happen in a decent Wi-Fi
12:25
connection is you're going to have a videochat complete and you can be talking to someone
12:30
on the other side of the world just throughtouching the phones to a tag.
12:33
>>Jeff Hamilton: One more time. (chime).Some people claim wormholes don't exist.
12:39
>>Nick Pelly: I guess Einstein was right.All right. Let's go to another demo.
12:46
So we have worked with Halfbrick Studios andin just a few days, we took the Fruit Ninja
12:54
application and added NFC and Bluetooth tomake it head-to-head multiplayer. Head-to-head
13:03
multiplayer games over Bluetooth is not reallynew, but what is new is using NFC to initiate
13:08
the connection.So we have one phone at the Fruit Ninja menu
13:13
screen. The other phone can be anywhere. It'sjust at the home screen right now. Put them
13:17
together and see what happens. (chime).[ Applause ]
13:20
>>Nick Pelly: That's it, straight into a game.Isn't that awesome?
13:27
It looks like our intern has been practicingthis one.
13:33
>>Jeff Hamilton: He's pretty good.>>Nick Pelly: I want to be clear, everything
13:39
we've shown you is possible with GingerbreadAPIs. This can all be done today. We're going
13:44
to make it easier for developers with someadditional APIs in Ice Cream. But the functionality
13:49
is already there.Let's talk a little bit more about Ice Cream
13:56
Sandwich.I hope you're already convinced that NFC is
14:00
an interesting technology. And we really hopethat we've got your imagination going with
14:05
the kinds of activities that you can buildout of this physical interaction.
14:11
We think it's really interesting, too, andwe think this is just the tip of the iceberg.
14:15
Here are some ideas that we're going to putinto the Ice Cream Sandwich release.
14:23
We want to really focus on these 0-click interactions.We keep coming back to the one-key feature.
14:30
You can put two phones together without anyUI, without having to launch any application,
14:34
and share content.So we're going to bring 0-click sharing into
14:38
the platform for Ice Cream Sandwich.Let's show some demonstrations.
14:43
Ben is viewing a contact. You put the otherphone next to it, and immediately, it just
14:49
shares that contact. This is how easy it shouldbe.
14:51
[ Applause ]>>Nick Pelly: It's sharing the on-screen contact
14:59
with the other phone.Let's go to a Web page. Ben is going to load
15:02
a Web page. Android.com. Put it against anotherphone, and -- (chime) -- as you can guess,
15:09
it just loads the Web page.We want to build this into as many system
15:12
apps as we can. And we want to make the APIsfor this easily available to application developers
15:18
for use with your applications.So there's one more demo that we want to show.
15:27
We don't have NFC in a tablet yet, but wehave hacked up this tablet with an NFC evaluation
15:33
board.[ Laughter ]
15:34
>>Nick Pelly: To show you, you know, whatcan be possible when we have a broader range
15:39
of devices available with NFC.Let's say you're watching YouTube on a Nexus
15:46
S. It's got a great screen, but the tabletis so much better. Here's what we think should
15:50
happen when you touch your YouTube video tothe tablet.
15:53
[ Applause ]>>Nick Pelly: And if you noticed, it resumes
16:06
playback right where the other one left off.>>Jeff Hamilton: If only I could dance that
16:10
well.>>Nick Pelly: So we hope we have you excited.
16:16
There's one more demo that we think the applicationdevelopers in the audience are going to be
16:20
particularly excited about. And that is applicationsharing.
16:25
So let's say that one phone is running FruitNinja. The other phone doesn't have Fruit
16:31
Ninja installed. What should happen when youput those two phones together?
16:39
Well, let's demonstrate.>>Jeff Hamilton: Let's see.
16:40
(chime).>>Nick Pelly: There you go. Take you to the
16:49
market to download it. This is going to encourageviral app sharing. If you and your friends
16:54
you want to share an app to a friend, youdon't have to go search to it in the market.
16:57
You can just touch your phone to theirs andthey can download it.
17:01
I will now pass back to Jeff for how to NFC.>>Jeff Hamilton: Thanks, Nick. Those were
17:10
some great demos.So we have seen a little bit about what you
17:13
can do with NFC, what the technology is like.And hopefully you all are starting to think
17:17
about what kinds of things you can do in yourapplications using NFC.
17:22
Let's talk a bit about how you would do that.First we're going to talk quickly about how
17:27
to read data over NFC. Then we're going totalk how to write data over NFC. And then
17:32
we're going to get into some more advancedtopics at the end.
17:37
The first thing to know when reading datafrom NFC is that there's a data structure
17:40
called NDEF, this stands for NFC Data ExchangeFormat. It is the data container format to
17:46
use for NFC.The reason that there needs to be a standardized
17:50
data container format here is that on thepassive tags, there's a lot of different types
17:53
of technology that exist, and they all havea lot of different properties, different ways
17:57
they store data on them, and things like that.So the standard NDEF here is designed to be
18:03
able to work across all of these differenttypes of technologies. And it's just a way
18:08
you can interact with NFC devices and be guaranteedthat you're going to have a common data structure
18:12
across these devices for many different vendors.The general structure of NDEF is, first you
18:19
have a message, and the message encapsulateswithin it one or more NDEF records.
18:25
And the message is just an encapsulation ofrecords. The records that you have in there,
18:31
each record has a high level type, and thenthere's optionally a second level type that's
18:37
scoped within the first level type. There'san optional ID within the record. And then
18:41
there's an optional payload as well.For more information about NDEF messages and
18:47
NDEF records, the NDEF message and NDEF recordclasses in the SDK, there's a bunch of documentation
18:53
there with the gory details.>>Nick Pelly: NDEF was the contain format
18:57
we used for each of those demos.>>Jeff Hamilton: The first thing to know about
19:02
NDEF when reading it on the phone is how it'sgoing to be dispatched to your application.
19:07
So by design, the NFC data is dispatched toonly one activity on the phone. And we think
19:14
this is actually a very important aspect ofthe way we design the system. Because when
19:17
users are interacting with things with NFC,they really are looking for instant gratification
19:22
for the way that they're interacting withthings around them in space. And so what we
19:27
really wanted to do is launch directly intothe application that handles the data that
19:33
they're interacting with. And we really thinkthat, you know, for the best experience for
19:37
the user, going directly to the applicationis very important so that they can interact
19:40
with things around them.So let's talk a bit about how you get into
19:45
your activity when data is read over NDEF.So what we do is we take the first NDEF record
19:53
in the NDEF message and we look at its type.And we build an intent from that type.
20:03
So this slide shows some examples of how weare going to take an NDEF and convert it into
20:07
an intent. And we show that on the right-handside with some snippets from an Android manifest
20:11
file, and this is how you would capture NDEFdata coming into the phone from your activity.
20:16
So the first two examples show how we handlejust raw text coming in. So the Sticky Notes
20:23
example we showed earlier handles text plainline type, and it just deals with general
20:28
text.So there are two ways you can get general
20:30
text. There is a top-level type well-knownwith a secondary type of text, and the payload
20:36
is just text.The second one is you can have MIME data in
20:41
an NF record, so if you have MIME data andthe secondary type is text plain, the payload
20:46
again would be just text. And what we do iswe take the MIME type there, text plain, and
20:51
we put that on the MIME type field for theintent that we start when the data comes in,
20:56
and that let's applications filter on thedifferent types of data they are interested
21:00
in.So taking that a step further, the third example
21:03
here is using the application slash VND.exampleand this is the generally accepted format
21:09
of doing vendor specific MIME codes or MIMEtypes.
21:14
So this is something we think would be greatfor developers. If you have a data structure
21:18
you want to put in a sticker or you want totransfer over peer to peer, you can just create
21:23
your own custom MIME type using VND dot andthen your domain name and put your payload
21:29
in there.What we do is we take that MIME type, put
21:32
it into the intent and from your Android manifestyou can specify you want that MIME type coming
21:38
in from NDEF, and then your application willget launched directly to handle your data
21:42
structures.And the last example, we can do basically
21:46
the same thing using a URI. So there are threedifferent ways you can store URIs in NDEF.
21:51
If we find one of those three ways, we pullthe URI out, and we set that as the data field
21:57
on the intent, and you can use the existingstandard Android manifest matching mechanism
22:02
for saying which URIs you are interested in.And you can be as specific or generic as you
22:07
want when setting up that match in the system.>>Nick Pelly: You can think of NDEF types
22:12
as like a superset of MIME and URL types,and Android does the work for you in mapping
22:17
those to MIME or URL types for intent filters.>>Jeff Hamilton: Okay. So now we talked a
22:25
little bit about how we build that intent,let's look at some code snippets for how applications
22:29
would actually handle that.The first one we have here is the Android
22:33
manifest from the Sticky Notes example weshowed earlier, and it's just an extra intent
22:37
filter that has the action NDEF discoveredon there. And this one, for the Sticky Notes,
22:43
was looking for text, so it set the MIME typeto text plain.
22:47
Here you would just put in, in this intentfilter, you would put in some kind of filter
22:51
there for whatever data type you have thatyour application is dealing with over NFC.
22:58
The second code snippet we have here is justthe activity and how it would handle it when
23:01
it receives that intent. There's basicallyjust an extra on the intent, it's called extra
23:06
NDEF messages and that's an array of NDEFmessages. Typically there's only one NDEF
23:11
message that comes over the payload, but itis an array because it is possible in some
23:15
cases to have multiple NDEF messages. So typicallyyou just look at the first NDEF in that array,
23:21
get that NDEF record in there and off yougo.
23:24
>>Nick Pelly: This code snippet is straightfrom the Sticky Notes application that we
23:29
demonstrated, and the full code is available,is linked at the end of the presentation.
23:32
>>Jeff Hamilton: Let's talk a bit about bestpractices when dealing with NFC and NDEF data.
23:42
I think this is very important that you alwayswant to use precise intent filters. You don't
23:47
just want to say I capture URIs that all haveHTTP as their scheme because if multiple applications
23:53
are doing that, you are going to get somethinglike we have in the slides here where you
23:56
have an activity chooser dialogue, and theuser is really not going to have that instant
24:01
gratification that we think is the hallmarkof NFC and what makes the technology really
24:04
exciting for users, and it's not going tobe a great experience for them.
24:08
So we highly suggest that you structure yourdata in ways that you can create precise intent
24:13
filters with custom MIME types or with URIsto domains that you control so you are not
24:20
going to be stepping on each other toes, andit will be the best experience for all the
24:24
users out there.Another thing worth mentioning as well we
24:29
talked earlier about how NFC is kind of slowon the data transfer rate, so we also recommend
24:34
that you keep your data structures on thesmaller side. Typically, one kilobyte or less
24:39
is a good recommendation.>>Nick Pelly: Please, no XML over NFC.
24:45
>>Jeff Hamilton: Okay. So we talked aboutreading NDEF. Now let's talk about where you
24:52
can read it from.So you can read it from passive tags, as we
24:57
showed in the demos earlier. There are a bunchof different types of passive tags. So the
25:02
NFC forum has gone out there and they specifiedfour standardized types of passive tags. They
25:07
are called type 1 through 4.We have up here some examples of products
25:13
that implement these specifications. Theseare the most common implementations of these
25:18
specifications that you find out there, althoughthey are not the only implementations that
25:21
exist. There is the Topaz, type 1; MIFAREUltralight, type 2; Sony Felica, type 3; and
25:27
MIFARE Desfire, type 4.Outside of the NFC forum defined types, there
25:34
are also some proprietary NFC tags Micro classicis the best example of that. There is tons
25:40
of micro classics out there in the world today,and they support NDEF as well.
25:46
Because they are completely standardized,support for those is optional in Android.
25:50
Not all devices are necessarily going to beable to read these tags. The Nexus S can read
25:55
them, but if you are putting a deploymentout there in the world, we highly suggest
25:59
you go with one of the standard type 1 through4 tags because then you will be guaranteed
26:04
that all devices will be able to read themand you won't run into any problems with people
26:08
who have devices that can't read the typeof tag you have deployed.
26:14
And last but not least, you can read NDEFpeer to peer. And this is from one Android
26:18
phone to another. And we think that's a veryexciting way to read it as well.
26:26
So we talked earlier about NFC stickers. Ithink you have all probably seen these in
26:30
your badge sheaths. The stickers we have givenyou are type 4 tags that can hold up to two
26:35
kilobytes of data in them. If you read thesticker in there with the Nexus S, it will
26:41
take you to a Web page that has a link todocumentation about NFC, some sample code
26:45
from Sticky Notes application, as well asa link to the NXP tag writer application from
26:50
our friends at NXP, and you can download thatfrom the marketplace and you can use it to
26:54
rewrite the tag and play with it and put whateverdata you want in there.
26:59
One thing to note, these tags are rewritableso you can put whatever data structures you
27:02
want in. There you can play around with them,use them to develop applications. But beware
27:06
that you can't make them read only. So ifyou are going to put them up, stick them around
27:11
somewhere, be aware that someone might comearound and rewrite them on you and who knows
27:14
what they will put in there.Keep Nick away from your tags.
27:19
Okay. So let's talk a bit about writing inmore detail.
27:29
As we said, NDEF tags can be writable. It'salso possible to configure the tags to be
27:34
read only from the factor tree when you purchasethem. The type 1 and 2 tags it's possible
27:38
to make read only at any time. If you hada read/writable tag, you can mark it read
27:43
only and that will be honored in the tag.For types 3 and 4 they have to be configured
27:47
as read only from the factory. So if you geta read/writable tag like the ones we've given
27:51
you guys today, you can't mark that tag readonly later on. So that's something to be aware
27:57
of if you are looking to deploy tags out inthe field.
28:01
So when you go to write tags programmaticallyon Android, you have to do that when the tag
28:05
is in the field of the phone. So that's whenthe tag is touching the phone, pretty much.
28:09
And we have a code snippet here, again fromour Sticky Notes sample code. You can go down
28:15
to the sample code on the Web page. Basicallyyou just create an NDEF record that has the
28:21
text that you want to write into it, encapsulatethat in a NDEF message, and then get a reference
28:26
to the tag object that you want to write toand the NDEF technology you are going to use
28:31
to write, and then just call write NDEF messageand it goes out over to the tag and you are
28:35
good to go.So writing peer to peer is a little different.
28:42
The way we set it up on Android is only theforeground activity can register a payload
28:47
to push over a peer-to-peer link.So the application needs to register that
28:51
payload in advance. It's something that wethink is really important in the way the APIs
28:58
are set up, because we want to make sure theuser is aware of which activity is using the
29:07
NFC radio.>>Nick Pelly: I think it's a common theme
29:14
about APIs, actually. We always want to encouragethe foreground activity to be the one using
29:19
NFC. It's for instant gratification so theuser knows exactly which application is using
29:25
the NFC link.>>Jeff Hamilton: So your application on resume
29:29
we just call the NFC adapter, or API enableforeground NDEF push. And you head off an
29:35
NDEF message. So what happens then is thesystem will take that NDEF message, and when
29:39
a peer-to-peer link is established, it willhand that NDEF message over to the other phone
29:44
on the end of the peer-to-peer link, and itwill dispatch that NDEF message as if it had
29:48
been read from a passive tag.>>Nick Pelly: You can use the same code on
29:52
the receiving side for peer to peer as youused for reading a passive tag. It looks the
29:57
same. You just receive a NDEF payload.>>Jeff Hamilton: So this is a really nice
30:01
API, we think. It makes it very easy to addpeer-to-peer support for NFC on your applications.
30:07
You just need to call enable foreground NDEFpush from your on resume and hand off the
30:13
content.One thing we thought would be handy on the
30:17
API, and unfortunately we didn't get it intoGingerbread, we will add this in Ice Cream
30:22
Sandwich, is you can add a callback system-- you can register a callback. So when the
30:27
peer-to-peer link is brought up, there willbe a call back made to your application and
30:30
you can return a NDEF message at that timethat's relevant to the state of your application
30:34
when the link is established.So that's something you saw earlier with the
30:38
YouTube example. The YouTube application onthe phone is using this Ice Cream Sandwich
30:43
API, and it's responding with not only a linkto the video that its playing back but also
30:47
the time stamp of where it is in that videoso the other side can start playback at the
30:52
same point.>>Nick Pelly: Okay. So Jeff's covered the
31:02
basics of how to NFC. And we really focusedon NDEF tag read, NDEF tag write, and NDEF
31:10
peer to peer. There's a theme here. We'retalking about NDEF. But are all NFC tags NDEF?
31:15
Well, they are not. So we are going to gointo detail about the NFC ecosystem on a broader
31:21
level. Don't worry, we are not going to gotoo deep. There's a lot to talk about here
31:24
but we will just make you aware of some ofthe things that you should know.
31:27
So NFC as a technology has actually been aroundfor over 15 years. But NDEF is a fairly new
31:39
standardization. And over that 15 years, companieshave invested heavily into NFC for transit,
31:46
for credit cards, for passports, for physicalaccess cards. There's over 5 billion of these
31:51
already out there that your Nexus S or otherAndroid NFC phone can talk to already.
31:59
Now is probably a good time to bring up RFID.We haven't mentioned it yet. RFID is a different
32:05
technology to NFC and it really bugs me becauseI keep reading articles where they replace
32:11
NFC with RFID. They are different set of technologies.RFID is typically working at a range of meters.
32:19
NFC is exclusively a centimeter range technology.This is really important. This means that
32:25
you were going to get that proximity triggeredinteraction, physical reactions, virtual reactions.
32:32
And it means that you don't have to worryso much about many devices being in the field
32:37
or privacy and security.Anyway, so when we quote the 5 billion number,
32:41
that's 5 billion NFC tags.So this is our crazy diagram of like all the
32:50
different NFC technologies that -- actually,it's a subset of the technologies that have
32:54
been out there for the last 15 years. Whenwe rehearsed this, I can talk for half an
32:59
hour about all these technologies, but myproduct manager was like, no, let's just spend
33:04
30 seconds.So all I want to do is let you guys know there
33:08
are a bunch of different technologies thatare all sort of -- fall under the NFC ecosystem.
33:15
And all those tags that are deployed thatare non-NDEF are going to use one of these
33:19
technologies.Now, the good news for you guys today is we
33:23
have built APIs to the majority of these technologiesso that you can read and write with all of
33:28
these legacy tags that are already out theretoday.
33:30
[ Applause ]>>Nick Pelly: So I won't go into the detail,
33:42
but if you want to look into using these classes,the package is android.NFC.technology. We
33:48
have a set of classes like IsoDep, NfcA, NfcB,NfcF. If you know NFC well, you might have
33:54
heard of some of these before. And we haveall the low-level commands you need. You know,
33:58
transceive, authenticate, read, write, touse all of these technologies from your Android
34:05
applications.So I will mention that when I say technologies,
34:10
I kind of mean protocol. Any given tag canhave an RF level protocol and then one or
34:17
more other protocols building on top. So don'tbe surprised when you see multiple technologies
34:22
enumerate on a single tag.Now, we talked about dispatching to application
34:31
with NDEF. We use the NDEF discovered intent.It's a start activity intent so we always
34:37
are bringing an application to the foreground.It's the same with non-NDEF tags. We use the
34:44
tech discovered intent, it's a start activityintent. We are trying to bring the application
34:48
to the foreground so the user gets instantgratification.
34:53
The content you filter on is no longer theNDEF type because we don't know the type.
34:57
It's some unknown tag with different technologieson it. So instead you filter on the technologies
35:02
you want to use.So, for example, if you are writing an application
35:07
to read information off of a transit card,you might specify that you are looking for
35:11
cards with NfcA and IsoDep because you knowall the transit cards you care about have
35:16
those technologies.>>Jeff Hamilton: I think it's worth noting
35:22
it happens before the technology phase.So if you're writing an application and you're
35:27
using NDEF and you're using the intent filterslike we described earlier for NDEF data, that's
35:32
going to happen before the technology discoveredhappens.
35:36
So, basically, we call start activity if weget any results back for activities that handle
35:41
that NDEF data structure. We just launch directlyinto them. If there are no activities installed
35:45
in the system that handle that NDEF data structure,then we'll go on and try to dispatch and call
35:51
start activity on action tech discovered withthe technologies that are present on the tag
35:56
that's in the field.So if you're using NDEF, that takes precedent
36:00
over the technology level. We think that'skind of important, because NDEF allows much
36:05
more precise filtering to applications, and,you know, that's a great way to get directly
36:10
into your application for a better user experience.>>Nick Pelly: Please use NDEF if you can.
36:14
But if you can't because you're using legacytags, then look at tech discovered.
36:20
While we're talking about dispatching tagsto your applications, there's one other important
36:25
dispatch mechanism we want to mention.We have an API function, enable foreground
36:31
dispatch.When your activity is already in the foreground,
36:35
you can call this to tell the Android operatingsystem that you want to receive all further
36:40
tags into your application and not some otherapplication. You know, this is really important,
36:45
because otherwise, if you're trying to writeto a tag from your application and then you
36:51
scan a tag, you can make sure that you'renot going to launch to some other third-party
36:55
application. It's going to stay in your applicationand you can receive all the new tag updates.
36:59
So this is a good tip to look at enable foregrounddispatch.
37:02
Okay, I just talked a whole bunch about passivetags, reading and writing. Let's talk a little
37:11
bit deeper about peer-to-peer.The key feature of NFC for peer-to-peer is
37:18
that it's low friction. There's no discovery,there's no pairing. You just touch the phones
37:23
together and it will launch the application.However, it's got a low range. It's only going
37:27
to work when they're sort of one to four centimetersaway. That's not great for playing a multiplayer
37:33
game. And the data rate is really slow.So like with the Fruit Ninja demo, we really
37:38
recommend to switch to a high-bandwidth connectionlike Bluetooth, or you can equally well use
37:44
Wi-Fi, or even go through the cloud for yourheavy lifting in the application.
37:48
Bluetooth and NFC, they go together so well.We really recommend you look at this.
37:56
>>Jeff Hamilton: Wireless nirvana.>>Nick Pelly: NFC to initiate the connection,
38:00
and then Bluetooth for the -- the heavy lifting.Please don't do socket-style communication
38:05
with NFC. It doesn't work so well.Okay. We're getting towards the end. We just
38:13
want to recap on the key points that we'vepresented to you today.
38:18
Number one, I think we've said it a few timesnow, but just to hammer it home, NFC is quick
38:22
connection setup is what it's about. So pleasethink about how you can use this in your applications
38:29
and the kinds of experiences your users aregoing to get out of this.
38:32
Number two, you can work with passive devices,stickers, tags. You can take these stickers
38:37
and just, you know, place them around theenvironment, on people, and just, you know,
38:43
see what happens.NDEF dispatch, use precise intent filters
38:48
and prefer NDEF over the legacy technologies.Number four is, foreground interaction. The
38:57
APIs are designed to work in the foreground.So, you know, we really don't want to encourage
39:02
applications to be using the NFC connectionin the background.
39:08
And lastly, for socket-style communication,please use Bluetooth or some other, you know,
39:17
higher-range connection.We're about to go to Q&A, but I want to just
39:23
cover a few topics we know are going to comeup first.
39:28
Privacy. So, you know, when we work with NFC,we often hear people talking about privacy.
39:34
And, you know, it's a really important topicto discover. Because we do care about user
39:37
privacy. I don't want people reading my contactinformation out of my phone without me letting
39:42
them. So I want to touch on a few points.First of all, NFC is not RFID. It does not
39:49
work at a range of meters. This is a centimetertechnology. You have to be really close to
39:54
the phone in order to communicate with theNFC antenna. It's a very low-powered antenna.
40:01
Second point is, yeah, NFC is off when thescreen is off. So, you know, as I like to
40:07
call it, there's no butt-sniffing. You can'tgo and scan someone while their phone's in
40:12
their back pocket and the screen's off.[ Laughter ]
40:13
>>Jeff Hamilton: That's a good thing. Youdon't want Nick doing that to you.
40:17
>>Nick Pelly: I thought you took that outof the slides.
40:21
And lastly, third-party applications, theymust be in the foreground. We really think
40:26
this is the right usage model. It's instantgratification. And it means that you know
40:30
which applications are using the NFC linkand you know if they're misbehaving.
40:33
Okay. Second hot topic is security. It's relatedto privacy, and some of the important points
40:43
are similar.NFC is, by design, low range and low power.
40:48
So if someone was to try and intercept oreavesdrop on a communication, they're going
40:55
to be need to be very close in order to seewhat's going on.
41:00
Now, that said, there is no link-level encryptionbuilt into the standard NFC protocols. So
41:06
if you care deeply about the payload, if thepayload is a financial instrument or something
41:13
else that you need to keep secure, then youshould encrypt it or you should look at some
41:17
of the more advanced NFC technologies thatdo have encryption built into the lower level.
41:23
But by default, don't assume that the linklevel is encrypted.
41:31
Lastly, card emulation. This is the most popularquestion on Android developers' Google Groups.
41:38
So we talked a lot about reader/writer modeand peer-to-peer. There's a third major mode
41:45
of NFC, which is card emulation. This is whenthe Nexus S is pretending to be a passive
41:53
tag that you can put in the field of a reader/writer.So if you wanted to pretend to be a transit
41:59
card or pretend to be a credit card. So inGingerbread, we have no API support for card
42:05
emulation. And it's not that we forgot. Wethought very hard about it. But there's some
42:10
simple reasons.I showed you that diagram earlier of all those
42:16
different technologies. Well, if you're goingto do card emulation, the hardware has to
42:20
pick one of those technologies to emulate.You can't typically emulate all of them at
42:23
the same time. And the hardware out theretoday doesn't actually support all of these
42:28
at the same time anyway.So if we were to build these APIs, the applications
42:33
are going to have a really inconsistent experienceas they're deployed to different Android devices.
42:38
Some will support NFC A, some will supportNFC B. We don't think this is really going
42:43
to be a great story for third-party developersright now.
42:48
And secondly, when you're doing card emulation,you're emulating a passive target that is
42:53
going to have one kilobyte, two kilobytesof memory. You're going to then have to decide
42:57
which application has the right to managethis limited resource.
43:01
So we did not put card emulation APIs in Gingerbreadbecause we want to make sure that we have
43:06
a compelling user story before we do that.And we really think that peer-to-peer is the
43:11
way to go for future NFC uses. Peer-to-peerand NDEF, because with NDEF you can filter
43:16
on content. And with peer-to-peer, it's anewer technology. It doesn't have to assume
43:22
that one side is passive.So that's it for the main part of the presentation.
43:33
We encourage you to go to NFC.android.com.We have links to the sample code for Sticky
43:39
Notes, links to the developer APIs. And youcan give us feedback on how we went today
43:47
at the feedback link. You can tweet aboutthis with the hashtags. And we're going to
43:52
now take questions from the audience live,and also, you can post questions online at
43:58
the last link.Thank you.
43:59
[ Applause ]>>Nick Pelly: Okay, can we get the first question
44:27
live, in the brown shirt.>>> So what can you tell us about your plans
44:33
for other devices that support -- that willsupport NFC in the near future, other than
44:37
the Nexus S?>>Nick Pelly: Well, I think, you know, it's
44:40
up to the OEMs. You know, I think they aregoing to want to -- they would love to see
44:45
more applications in the market. So it's kindof up to you guys to write some really great
44:50
applications out there that really, you know,make the OEMs see the use cases for NFC. Yeah,
44:58
and, you know, we do know personally of dozensof phones in the pipeline for 2011 that are
45:03
going to have NFC. So don't worry, they willcome as well.
45:06
>>> Thank you.>>Jeff Hamilton: Take a question from the
45:11
back mike, please.>>> So are there intents, then, to update
45:18
all of the standard apps, contacts, GMail,the browser, to have a standard NDEF payload
45:26
that they're just showing all the time?>>Jeff Hamilton: Yes. So that's something
45:29
that we showed off in the Ice Cream Sandwichpreview. That's something we're going to look
45:32
at adding in the Ice Cream Sandwich platform.You know, in the demos that we showed, like,
45:36
from contacts, it's exporting a standard Vcard. So it's a MIME type, which is V card.
45:41
So that's a pretty big standard there. URIscome through just as a URI. There's an NDEF
45:47
specification for how to store URIs, so thosecome through just like that. So NDEF as a
45:53
format covers pretty much all the data structuresthat we'd export. And for things like contacts,
45:57
we just go with the standards like V card.>>> All right. So Ice Cream Sandwich is when
46:01
we'd start to see that just show up in thestandard apps?
46:03
>>Jeff Hamilton: Yeah, in the platforms.So in your applications today, you as developers
46:06
can add support for this stuff today on Gingerbread.>>Nick Pelly: We'll take a question from the
46:13
Google Moderator.Are we going to have a way of using NFC in
46:16
the emulator?And that's something that we get asked a lot.
46:20
And I think, you know, for right now, we reallyencourage you to buy a Nexus S and use it
46:27
with real hardware. But we are working onit for the emulator. And hopefully soon.
46:31
>>Jeff Hamilton: Yeah, I think that the problemwith the emulator is they're -- as we saw
46:35
with that diagram, there are so many differenttechnologies that exist in the realm of NFC.
46:39
And it's very difficult to support all ofthose simultaneously in the emulator. So that's
46:44
something we're working on.>>Nick Pelly: Question from the front.
46:49
>>> So the lack of card emulation support,does that mean you can't do mobile payments
46:54
with NFC as it's implemented in Gingerbread?>>Nick Pelly: It means that you can't do mobile
46:58
-- you can't do mobile payments with the APIsavailable in Gingerbread.
47:02
>>> And are you planning to add that in forIce Cream Sandwich?
47:06
>>Nick Pelly: It's something that we're notgoing to rule out.
47:08
>>> What's the sort of missing pieces therethat you're looking for to make that what
47:14
you call a compelling environment to enablethat?
47:17
>>Jeff Hamilton: At an API level, you mean?>>> I think, if I understood, you were saying
47:22
it's just not a compelling proposition rightnow. What are the missing pieces to make it
47:28
compelling?>>Nick Pelly: The problem is that the hardware
47:29
out there today, you know, if you buy an NFCcontroller, it typically is only going to
47:34
be able to emulate one of those RF-level technologies.So as an application developer, you don't
47:40
know which -- when it's getting deployed toa phone, which one is on the phone. So I guess
47:45
until we see the industry standardize aroundmaybe one RF-level technology or until we
47:51
see NFC controllers able to support multipleof those. I guess we're actually hoping that
47:57
everyone will just move to peer-to-peer orNDEF exchange, because that removes this problem
48:02
entirely.>>> Looking for a standard in the frequency
48:04
supported?>>Nick Pelly: In the modulation of the -- they
48:08
all do 13.56 megahertz, but they have differentmodulation schemes.
48:08
>>Jeff Hamilton: Take a question from theback mike.
48:09
>>> Okay. I understand this is peer-to-peerand very close communication. But for the
48:15
passive tag reading-wise, I don't think thereis any restriction for, like, reading two
48:23
devices at the same time for the passive tag.Is it true or is it not?
48:31
>>Jeff Hamilton: Currently, the Nexus S onlysupports reading one passive tag in the field
48:35
at a time.There are a few technical limitations in place.
48:40
And more than that, you know, we think there'sreally just a user interaction limitation
48:45
there where, you know, as we talked about,we thought -- we think it's very important
48:48
for the users to go directly to the applicationhandling the tag they're interacting with
48:53
for that instant gratification. So if thestack is handling two tags at once, if they
48:58
both have NDEF payload, it's not clear whatactivity is going to be launched.
49:02
>>> Right, right.>>Jeff Hamilton: So we really think that the
49:05
best part of NFC is that it's just kind of-- it instantly happens for the user. And
49:09
so for that reason, right now, you know, weonly support one --
49:12
>>> Who is handling those sequences, basically.>>Jeff Hamilton: Who is handling that sequence?
49:17
>>> Yeah. If you have a passive tag and thenboth reaches at the same time, who is --
49:21
>>Jeff Hamilton: So if you have two passivetags in the field, it's going to arbitrarily
49:26
pick, you know, one to be the first tag. AndI think that depends on the ID of the tag.
49:30
And the way it works is a polling loop. Sothe radio in the phone will look to see what
49:36
exists in the field. And I think that kindof depends on which tag ends up responding
49:40
first in the field. It's pretty arbitrary.>>> Okay. Thanks.
49:44
>>Jeff Hamilton: Yep.>>Nick Pelly: Maybe a question from Google
49:48
Moderator.Is Google going to partner with somebody to
49:51
bring real-world NFC use? E.g. mobile payments.For mobile payments, nothing to announce.
50:01
I think -- you know, we're looking at peer-to-peer,and we're looking at bringing 0-click sharing
50:04
to Ice Cream Sandwich. And these are whatwe see as the use cases today.
50:10
>>Jeff Hamilton: Okay. Question from the firstmike.
50:14
>>> Is there a type of NFC tag that allowsan administrator only to write to it?
50:19
>>Jeff Hamilton: Yes. There are differentlevels of encryption, authentication support
50:24
in the tags that we talked about.Some of the tags support doing authentication
50:30
using a shared key. And they have differentaccess control rights in them. So the tags
50:34
that you have actually do support that. Andthey're using the default keys. So what you
50:38
can do is you can authenticate with the tag,using a -- you know, a shared key, and, you
50:43
know, that might give you, based on the accesscontrol, rights to modify the tag, where,
50:48
you know, if you don't have that administratorkey, you would only have rights to read from
50:52
the tag.>>> And that's type one that does that?
50:55
>>Jeff Hamilton: Type four, I know, does that.It depends on the product specifically. So
50:59
the MIFARE Desfire definitely supports that.Type one and two I don't believe do that.
51:04
Type one and two are simpler tags. They havesmaller data storage. They're also a lot cheaper
51:09
as well.But type four, if you get the MIFARE Desfire,
51:12
will do that that. Off the top of my head,I'm not quite familiar with the exact capabilities
51:17
of other products.>>> Thank you.
51:23
>>> Hi. In your examples, you had one phonering an application and the other phone was
51:27
on the home screen, so it was pretty obviouswhen you did peer-to-peer which way that data
51:33
transmission was going to happen. What happensif there's an app running on both, when both
51:34
are active and want to share data?>>Nick Pelly: We're still debating what to
51:38
do there, actually. It's a really good question.>>Jeff Hamilton: So right now, if you have
51:43
foreground dispatch enabled in your application,everything will come to you. So our advice
51:48
would be, you know, if you really care aboutthis in your application, you can -- you know,
51:52
you can set up your NDEF push. You can alsoenable foreground dispatch. That means while
51:57
you're in the foreground, trying to do otherthings over NFC, you'll get messages coming,
52:01
all the messages inbound, even if they'renot destined for your application. And you
52:04
can either drop them on the floor if you want,or you can indicate to the user that, hey,
52:10
I got something from the other side that'snot mine. You might want to do something about
52:14
that.>>> So if there's two separate apps or if
52:18
there's the same app running on both phones,can they exchange information both ways during
52:22
that one connection?>>Jeff Hamilton: Yeah, the data will go both
52:24
directions. And it will get dispatched onthe other side, depending on the dispatch
52:28
stuff we talked about earlier.If you're going to go with the NDEF push,
52:34
we suggest also going with the foregrounddispatch, and then you have control over the
52:38
inbound stuff while you're expecting to doNFC transactions with another phone.
52:41
>>Nick Pelly: Okay. To Google Moderator.Can I add an adapter to my cell phone to support
52:48
NFC?And the answer is, yes. We just showed it.
52:51
But we had to hack up the kernel, so -->>Jeff Hamilton: Yeah, it was a bit of a hack.
52:55
So there aren't any existing adapters today.Maybe someone will build one with the Android
53:02
hardware developer kit announced earlier today,hopefully.
53:05
What you can do is you can get stickers thatare designed to be put on the backs of phones.
53:11
And there are special stickers that have,like, a ferrite shielding on them because
53:14
the stickers have antennas in them and they'repretty sensitive to the other radios in the
53:19
phone. So if you're interested in doing interactionswith phones, you can put a sticker on the
53:23
back. And, obviously, you can't update thecontent of the sticker from non-NFC phones,
53:27
but you could do something like put in Bluetoothaddresses of the phone on that sticker on
53:32
the back of it.Question from the first mike.
53:37
>>> How durable are the tags themselves? Wouldthey be wearable and washable?
53:42
>>Nick Pelly: I think you should keep thattag on for a few days and see.
53:51
>>> If I wanted to put the tag on my backpocket and be slapped by a phone, would that
53:56
be possible.>>Jeff Hamilton: It depends. Basically, the
53:58
tags are a little IC on here as well withan antenna. And then that's all kind of packaged
54:03
together. There are lots of different peopledoing different types of packaging. So right
54:08
now, you know, you can get stickers. You canget, you know, stickers like I talked about
54:12
with the ferrite shielding on them specificallyfor cell phones. There are people doing things
54:16
that you can put on CD cases to do rentingmovies, that kind of stuff.
54:21
>>Nick Pelly: I think some people are workingon washable NFC tags that you can embed into
54:26
clothing similar to inventory tracking tags.I think we'll see those coming soon.
54:32
Question from the back.>>> Suppose a user is writing to one of the
54:36
tags that you provided and the payload isnearing the limit, the two kilobytes or whatever.
54:42
Given the amount of bandwidth available, itcan take several seconds to do that right.
54:43
Is there anything in the API to ensure theintegrity of that data or do you have to kind
54:47
of roll that yourself, or -->>Jeff Hamilton: What you can do is -- the
54:54
code snippet we had was pretty simple. Whenyou get the reference to the tag in the field,
54:58
you can query it to see what its capacityis. So what you can do is check to see, you
55:04
know, is your data payload larger than thecapacity of the tag. And you can check that
55:08
up-front.Beyond that, you know, when you get -- basically,
55:11
if the tag, say it leaves the field whileyou're in the middle of doing that operation,
55:15
you would get, like, an I/O exception thrownto your application.
55:19
What exactly the state of the tag is at thatpoint, I'm not sure, probably depends on the
55:21
specific tag technology that you're writingto.
55:25
>>> Gotcha.>>Nick Pelly: Okay. Question from Google Moderator.
55:29
Will developers be getting access to the secureelement?
55:33
>>Jeff Hamilton: So this one kind of goesalmost hand in hand with card emulation.
55:39
Typically, the hardware is set up to do cardemulation through the secure element.
55:43
Right now, we don't have any APIs to talkto the secure element. And we think that we
55:46
probably won't be getting APIs to do thatanytime in the near future in the SDK.
55:50
There are a bunch of different reasons. Again,the secure element is a very limited resource.
55:56
It can't hold a large amount of data in there.And if we open it up to any third-party application,
56:02
there's going to be a huge resource contentionover the secure element.
56:05
Additionally, to talk to the secure elements,even from applications on the phone, you need
56:10
to authenticate yourself properly.And if you improperly authenticate yourself
56:14
a certain number of times, there are secureelements out there that will physically destroy
56:17
themselves and can never be recovered. Sothat's something that we really think would
56:22
be a bad experience for users, and we don'twant developers getting blamed for, you know,
56:26
breaking hardware. It would be tough to knowwhich application did it. We think it would
56:31
be a very bad situation. So today, you know,we don't have APIs for that. And there are
56:36
some constraints that make it tough to createAPIs in the SDK for any third-party application
56:41
to talk to the secure element.>>Nick Pelly: Question from the front.
56:46
>>> I know you said that card emulation isn'tgoing to be supported anytime soon and that
56:50
it's because of all the legacy reasons. Butare there any vendors out there today that
56:54
are building payment solutions that are basedon peer-to-peer or, you know, NDEF so that
57:01
we can actually, you know, take our phonesto local Starbucks and pay for coffee, you
57:05
know, using Nexus S?>>Nick Pelly: I really hope so. I'd love to
57:08
see peer-to-peer used for payment technology-- used for payment.
57:12
I think NDEF and peer-to-peer are the wayto go going forward.
57:16
>>> But are you aware of anything that's alreadyin the works?
57:18
>>Nick Pelly: No.>>> And second question, and this may be irrelevant,
57:22
but I know it's only on while the screen ison. But what are the power or battery effects
57:28
of having the NFC enabled?>>Nick Pelly: It's about five milliamps in
57:31
polling mode. So it's pretty negligible comparedto the back light.
57:36
>>> Okay.>>Jeff Hamilton: Question from the back mike.
57:39
>>> I am just curious. What's the smallestfootprint size of the NFC stickers or tags
57:45
that you've seen? Is it pretty much like thattechnology requires it to be that big?
57:49
>>Jeff Hamilton: The smallest I've seen is30 millimeter round, which is actually pretty
57:55
small if you look at it. I think the biggerthe antenna is, you know, the better -- the
58:00
longer range you're going to be able to interactwith it.
58:02
>>> I see.>>Jeff Hamilton: But I have seen 30 millimeter
58:05
round, which is actually pretty small.>>Nick Pelly: It's 13.56 megahertz is used
58:10
for all NFC technology. So you have some fundamentalconstraints on the antenna size, especially
58:15
when you're powering a passive target.>>> Thank you.
58:19
>>Nick Pelly: Going to Google Moderator, doesthe Google NFC team see value in the intersection
58:27
of NFC and identity? If so, what in the presentset of APIs is useful for NFC-based identity?
58:34
I mean, I think we see value for NFC all overthe place. And, you know, not -- not only
58:40
specifically an identity, but for so manydifferent use cases. And, you know, we're
58:45
not going to be able to explore all of those.We're trying to put together the APIs for
58:50
developers to try and build apps themselves.And I guess specifically the APIs available
58:58
presently while there's the low-level APIsfor, you know, transceiving to any tag. So
59:04
there are some tags that have secure storageon the tag. You can use low-level APIs to
59:10
actually interact with those. Or, you know-- all the APIs we presented to you today
59:15
are around NDEF.>>Jeff Hamilton: Question from the front.
59:21
>>> Actually, the four record type definitionsin standards, but you didn't mention about
59:27
the generic controls. So when are you goingto support that?
59:30
>>Jeff Hamilton: We don't have support forit today. We don't actually have plans for
59:34
supporting that right now in the dispatchingmechanism. So if you're building an application,
59:40
you can get the technology level and you canlook at that, and you could interact with
59:46
the -- you know, the -- at the technologylevel and get the NDEF off the tag.
59:50
>>> So could a vendor define their own, youknow, generic, you know -- the control for
59:55
their own sake?>>Jeff Hamilton: So for -- you can define
60:00
that. It just wouldn't get dispatched usingthe NDEF-discovered intent.
60:05
And part of the reason there is that the specificationthere doesn't fit very well into the Android
60:11
intent system. So it's not a great way tomap that into intents and allow applications
60:15
to filter properly.>>> Okay.
60:17
>>Nick Pelly: So I think we'll just take onemore question, then we're out of time. But
60:22
we're available in the office hours afterwards,and hopefully tomorrow.
60:24
So one more from the back.>>> Okay. I just wanted to ask about the critical
60:30
mass issues.So, basically, you're talking about hardware
60:33
here. This is not like a QR code where anyonecan print one out in a home machine. A, can
60:37
I just go down to a store and buy a roll ofNFC stickers.
60:41
B, there's going to be a period of time inwhich people get frustrated when they try
60:46
to hold two phones together and nothing happens,because the NFC support is not implemented
60:52
yet in 100% of the apps.So how do you get from here to critical mass?
60:57
Will there be a symbol on the screen of apps,like a standard symbol that says, "I support
61:01
NFC"? How do you get to critical mass andovercome the hardware issues especially? Because
61:06
these things, you can't just make them outof thin air.
61:08
>>Jeff Hamilton: The first question, if youlook on the Internet, you can't just go to
61:13
a Best Buy or a Fry's or something and justpick up a roll of stickers today. There are
61:17
vendors on the Internet that will sell themto you. They're not super easy to come by
61:21
today. We're hoping that will change as NFCgets deployed in more phones and more consumers
61:26
are starting to interact with the technology.Additionally, you know, for the second question,
61:33
you know, I think -- you know, we've addedit to the Nexus S, and we're really hoping
61:36
that people find value in the technology anddevelopers started adding support for it to
61:41
their applications and then more OEMs willadd NFC support to their hardware.
61:45
In terms of identifying which applicationshave NFC support in there, we've been toying
61:50
around with some ways to try to expose thatinformation to the user. But we don't really
61:54
have anything specific to announce today.>>Nick Pelly: I think it's the chicken and
61:57
the egg problem. And I guess we're the chicken.>>Jeff Hamilton: Yeah. All right.
62:02
Well, we're out of time now. So thank you,everyone, for coming. We appreciate it.
62:05
[ Applause ]>>Jeff Hamilton: And we'll be in office hours
62:10
if you have more questions.>>Nick Pelly: Thanks a lot.

有空的话,再翻译一下吧


原创粉丝点击