1
00:00:00,506 --> 00:00:06,676
[ Silence ]

2
00:00:07,176 --> 00:00:07,496
>> All right.

3
00:00:07,496 --> 00:00:09,796
So welcome back to
Computer Science S-76.

4
00:00:09,796 --> 00:00:12,216
This is the last time we'll meet
in this more formal setting.

5
00:00:12,216 --> 00:00:15,136
Recall that next Wednesday is
our app party at which point all

6
00:00:15,136 --> 00:00:16,526
of your projects will be more

7
00:00:16,766 --> 00:00:19,026
than several days done most
likely and we'll gather

8
00:00:19,026 --> 00:00:21,616
in the lab room and we'll
have some cake and some snacks

9
00:00:21,616 --> 00:00:24,176
and some chitchat, and the
goal will be to bring your app,

10
00:00:24,176 --> 00:00:25,776
to bring your laptop
as appropriate

11
00:00:25,946 --> 00:00:27,766
and actually demonstrate
what you did not only

12
00:00:27,766 --> 00:00:30,736
for your last project, but
maybe your first project or two

13
00:00:30,736 --> 00:00:33,036
as well, particularly if
you took novel approach

14
00:00:33,036 --> 00:00:35,686
to the user interface or
generally just want to show off.

15
00:00:35,766 --> 00:00:38,016
So tonight, we wrap
up our look at iOS,

16
00:00:38,226 --> 00:00:39,896
but first, a couple of things.

17
00:00:40,066 --> 00:00:44,266
You know that we've had a team
of folks behind the scenes here

18
00:00:44,266 --> 00:00:46,976
and in front of the camera,
namely Chris, and RJ, and Rob.

19
00:00:46,976 --> 00:00:49,096
So I just wanted to
publicly thank them for all

20
00:00:49,096 --> 00:00:50,316
of their efforts thus far.

21
00:00:50,716 --> 00:00:50,976
Thank you.

22
00:00:51,451 --> 00:00:53,451
[ Applause ]

23
00:00:53,886 --> 00:00:56,396
And also to folks you haven't
probably met in person,

24
00:00:56,396 --> 00:00:58,966
but Shelley and Ramone and
Dan who've been running things

25
00:00:58,966 --> 00:00:59,856
behind the scenes.

26
00:00:59,856 --> 00:01:00,696
So thank you to them as well.

27
00:01:01,181 --> 00:01:03,181
[ Applause ]

28
00:01:03,346 --> 00:01:06,676
Just in case you would like to
relive this summer experience

29
00:01:06,676 --> 00:01:10,946
and realize that the videos
will remain online at CS76.tv

30
00:01:10,946 --> 00:01:14,086
for the next few years most
likely, for better or for worse.

31
00:01:14,086 --> 00:01:16,726
So, if after the class ends and
you're back in school or back

32
00:01:16,726 --> 00:01:19,426
at work, you'd like to at least
review material or pull up PDFs,

33
00:01:19,426 --> 00:01:21,656
or sample code of the like, I
know that that will continue

34
00:01:21,656 --> 00:01:22,906
to survive on the internet.

35
00:01:22,986 --> 00:01:24,456
So feel free to tune in there.

36
00:01:24,546 --> 00:01:28,466
So a couple of outstanding
details here.

37
00:01:28,726 --> 00:01:31,146
So we started the semester
looking and talking

38
00:01:31,146 --> 00:01:33,316
about web apps versus
native apps.

39
00:01:33,666 --> 00:01:35,516
Someone want to recap
in just a sentence

40
00:01:35,516 --> 00:01:37,696
or two what the distinction
is and was?

41
00:01:38,516 --> 00:01:41,696
[ Pause ]

42
00:01:42,196 --> 00:01:43,546
Five weeks later?

43
00:01:45,026 --> 00:01:46,396
What's a difference?

44
00:01:46,626 --> 00:01:48,586
>> So the web apps are
much more portable,

45
00:01:49,046 --> 00:01:50,466
you can them across browsers.

46
00:01:50,466 --> 00:01:50,866
>> OK. Good.

47
00:01:50,866 --> 00:01:52,196
So web apps are much
more portable,

48
00:01:52,196 --> 00:01:53,776
you can use them
across browsers.

49
00:01:53,976 --> 00:01:56,026
>> You can get access and also
use special tools [inaudible]

50
00:01:56,026 --> 00:01:56,496
numbers and--

51
00:01:57,956 --> 00:01:58,476
>> OK. Good.

52
00:01:58,896 --> 00:02:01,346
But certain special hardware is
typically inaccessible to you.

53
00:02:01,346 --> 00:02:03,926
Things like the accelerometer
for which browsers like Safari

54
00:02:03,926 --> 00:02:06,916
and the like don't
necessarily provide an API 2.

55
00:02:07,246 --> 00:02:08,616
Good. Other thoughts?

56
00:02:08,956 --> 00:02:13,746
>> Native apps run natively on
the iOS whereas web apps have

57
00:02:14,366 --> 00:02:17,636
to be downloaded via
HTTP [inaudible]--

58
00:02:17,636 --> 00:02:19,926
>> OK. So web apps do have
to be downloaded via HTTP

59
00:02:19,926 --> 00:02:23,096
in the context of the browser
before they can actually be run,

60
00:02:23,156 --> 00:02:25,326
but you kind of give us a
circular definition before.

61
00:02:25,326 --> 00:02:26,726
What does it mean for
native apps to be native?

62
00:02:27,816 --> 00:02:32,406
>> Native apps are a [inaudible]
the iOS and so you do not have

63
00:02:32,406 --> 00:02:33,646
to retrieve with it
some others source.

64
00:02:34,076 --> 00:02:34,576
>> OK. Good.

65
00:02:34,576 --> 00:02:36,466
So you don't have to retrieve
them from other source other

66
00:02:36,466 --> 00:02:38,696
than the first time
installation from the App Store

67
00:02:38,696 --> 00:02:40,626
which is another
compelling feature perhaps,

68
00:02:40,626 --> 00:02:42,646
most people know how to
find apps in the App Store,

69
00:02:42,646 --> 00:02:44,486
but most people probably
you don't know how

70
00:02:44,486 --> 00:02:47,196
to actually bookmark a web
page so that it appears

71
00:02:47,196 --> 00:02:49,496
to be an application which
was a technique we looked

72
00:02:49,496 --> 00:02:50,836
at way back early on.

73
00:02:51,086 --> 00:02:52,996
So if you had to choose
right now for your third

74
00:02:52,996 --> 00:02:54,576
and final project which you do,

75
00:02:54,876 --> 00:02:57,476
how many folks are
leaning toward or already

76
00:02:57,666 --> 00:02:59,856
down the road of web apps?

77
00:03:00,866 --> 00:03:04,376
OK. So, handful six or
so-- and the native apps?

78
00:03:05,076 --> 00:03:06,486
OK. And most everyone else.

79
00:03:06,486 --> 00:03:07,116
So not better at all.

80
00:03:07,116 --> 00:03:10,656
So we have a good mix of at
least both at that class.

81
00:03:10,816 --> 00:03:13,376
So, all right, so that was
web apps versus native apps.

82
00:03:13,376 --> 00:03:15,666
What if you didn't
necessarily have to choose

83
00:03:15,896 --> 00:03:17,766
between two [inaudible]
contrast?

84
00:03:17,766 --> 00:03:20,186
Well, it turns out
that there are wrappers

85
00:03:20,186 --> 00:03:22,266
and the most popular of which
is probably something called

86
00:03:22,266 --> 00:03:25,186
PhoneGap which allows
you to write web apps

87
00:03:25,186 --> 00:03:27,936
that create the illusion of
them actually being native apps.

88
00:03:27,936 --> 00:03:30,676
And by this, I mean, you
go to PhoneGaps website

89
00:03:30,676 --> 00:03:32,456
and you download what kinds--

90
00:03:32,456 --> 00:03:35,006
what essentially is a starter
code that they have written

91
00:03:35,006 --> 00:03:39,356
for Objective-C, for Java, for
Windows Phone, for a whole bunch

92
00:03:39,356 --> 00:03:41,856
of other platforms as well
and they've implemented

93
00:03:41,856 --> 00:03:44,556
in different ways and each
of those languages hooks

94
00:03:44,626 --> 00:03:46,286
into the native hardware.

95
00:03:46,456 --> 00:03:50,096
And then I have exposed that
via JavaScript to WebCode.

96
00:03:50,096 --> 00:03:53,596
So in short, you couldn't
theory implement an application

97
00:03:53,596 --> 00:03:56,226
entirely in HTML5,
CSS, and JavaScript,

98
00:03:56,556 --> 00:03:59,616
but you can actually ship
it to the Apple App Store

99
00:03:59,616 --> 00:04:02,476
and the user could download
it and it would have an icon,

100
00:04:02,476 --> 00:04:04,206
and they would have gotten
it for free or 99 cents,

101
00:04:04,206 --> 00:04:05,096
whatever the case may be.

102
00:04:05,246 --> 00:04:08,566
And when they run it, it's
actually native iOS code running

103
00:04:08,566 --> 00:04:10,566
on the phone, but the contents

104
00:04:10,566 --> 00:04:12,776
of the rectangular
window are largely coming

105
00:04:12,776 --> 00:04:14,696
from some website externally.

106
00:04:14,696 --> 00:04:16,736
In fact, this is how
the earliest version

107
00:04:16,736 --> 00:04:18,816
of the Facebook application
was written.

108
00:04:18,816 --> 00:04:20,926
Some of you might recall that
it used to be much slower,

109
00:04:21,166 --> 00:04:23,226
which is actually a downside
of taking that approach.

110
00:04:23,226 --> 00:04:25,986
You don't necessarily get
the same lack of latency

111
00:04:25,986 --> 00:04:30,436
that you might in an iOS native
application, but the upside is,

112
00:04:30,436 --> 00:04:33,046
one, you don't have to
learn Objective-C and iOS.

113
00:04:33,296 --> 00:04:36,976
Two, you have access to tools
and more familiar environments

114
00:04:36,976 --> 00:04:38,756
which for most people
is web-based these days.

115
00:04:39,066 --> 00:04:42,846
And three, I'm kind of
out of reason, so two.

116
00:04:42,846 --> 00:04:44,216
So we have two pretty
compelling reasons.

117
00:04:44,216 --> 00:04:45,446
So how do you go
about doing this?

118
00:04:45,446 --> 00:04:47,286
Well, technologically, this
is actually implemented

119
00:04:47,286 --> 00:04:48,276
in kind of a clever way.

120
00:04:48,276 --> 00:04:49,456
So first and foremost,

121
00:04:49,456 --> 00:04:52,536
this technique using PhoneGap
actually gives you access

122
00:04:52,536 --> 00:04:54,816
to quite a bit of
hardware and contrast

123
00:04:54,816 --> 00:04:57,136
to what we proposed was
the case a few weeks back.

124
00:04:57,306 --> 00:05:01,376
So, all of the green boxes here
represent a native hardware

125
00:05:01,376 --> 00:05:04,306
that is supported on Android,
BlackBerry, iOS, Windows Phone,

126
00:05:04,306 --> 00:05:07,606
and so forth, things like the
accelerometer, the camera,

127
00:05:07,606 --> 00:05:09,446
the compass, and other details

128
00:05:09,446 --> 00:05:11,606
that are typically
inaccessible to JavaScript.

129
00:05:11,846 --> 00:05:14,436
But by downloading this
starter code which is native,

130
00:05:14,806 --> 00:05:16,666
you're therefore
providing a bridge of sorts

131
00:05:16,666 --> 00:05:18,716
between native code
and JavaScript code.

132
00:05:18,716 --> 00:05:21,156
And the means by which they
did this in the iOS platform,

133
00:05:21,156 --> 00:05:22,176
though it differs on others,

134
00:05:22,566 --> 00:05:26,356
is the PhoneGap folks
essentially register

135
00:05:26,666 --> 00:05:29,286
with their iOS native
application URLs

136
00:05:29,286 --> 00:05:32,586
of the form gap, colon, slash,
slash, and then something

137
00:05:32,586 --> 00:05:34,936
and they essentially have
an MBC style approach here

138
00:05:34,936 --> 00:05:38,636
where you can then specify as
part of this URL a class name,

139
00:05:38,836 --> 00:05:41,096
and a command, or a
method to actually call,

140
00:05:41,306 --> 00:05:43,246
and then some number
of arguments.

141
00:05:43,246 --> 00:05:46,006
So in another words, they
kind of made up their own sort

142
00:05:46,006 --> 00:05:52,866
of protocol by teaching iOS to
handle URLs that appear inside

143
00:05:52,866 --> 00:05:56,166
of a browser window via
code that they've written.

144
00:05:56,336 --> 00:05:59,406
So it turns out there's
a protocol called

145
00:05:59,406 --> 00:06:00,816
the UIWebViewDelegate.

146
00:06:00,816 --> 00:06:04,756
And if you implement this,
you can actually be the code

147
00:06:05,016 --> 00:06:09,686
that is invoked when an
otherwise foreign URL is used

148
00:06:09,686 --> 00:06:11,656
in the confines of an
embedded web browser.

149
00:06:11,656 --> 00:06:13,066
And indeed, that's
how PhoneGap works.

150
00:06:13,066 --> 00:06:15,716
You write WebCode that
you therefore embed inside

151
00:06:15,716 --> 00:06:18,846
of a rectangular window that's
just an embedded web browser

152
00:06:19,026 --> 00:06:20,846
and if you want to talk
to the native hardware,

153
00:06:21,056 --> 00:06:24,386
you essentially do this
by way of the URL bar.

154
00:06:24,616 --> 00:06:26,116
So this delegate
class allows you

155
00:06:26,116 --> 00:06:28,126
to specify what codes
should get invoked

156
00:06:28,196 --> 00:06:31,396
when the embedded browser
window sees a URL that start

157
00:06:31,396 --> 00:06:33,776
with gap, colon, slash, slash.

158
00:06:33,776 --> 00:06:36,776
And meanwhile, there's
also a UIWebView.

159
00:06:36,806 --> 00:06:37,516
This is the class.

160
00:06:37,726 --> 00:06:40,146
So even if you've not used it
before, it allows an iOS code

161
00:06:40,146 --> 00:06:43,776
to embed a browser inside of
your own native app and it turns

162
00:06:43,776 --> 00:06:46,196
out there's a method associated
with this class called string

163
00:06:46,196 --> 00:06:49,896
by evaluating JavaScript
from string which means

164
00:06:49,896 --> 00:06:54,216
that your code can be
injected into the local browser

165
00:06:54,386 --> 00:06:56,846
and then executed by
way of this method.

166
00:06:57,016 --> 00:06:59,336
So in short, this
provides a bridge of sorts

167
00:06:59,336 --> 00:07:02,416
between native iOS code
and the browser by way

168
00:07:02,466 --> 00:07:04,296
of this URL-based trick.

169
00:07:04,296 --> 00:07:08,806
And there's one other
step to this whereby--

170
00:07:10,306 --> 00:07:12,536
or rather in other
operating systems,

171
00:07:12,536 --> 00:07:14,046
this is done a little
bit differently.

172
00:07:14,046 --> 00:07:16,526
But I'm sure Apple provided
enough in the way of hooking

173
00:07:16,696 --> 00:07:18,956
that folks like PhoneGap are
able to come along and allow you

174
00:07:18,956 --> 00:07:20,016
to implement your next app

175
00:07:20,526 --> 00:07:23,726
as really a web app
underneath the hood,

176
00:07:23,726 --> 00:07:25,676
composed almost entirely
of JavaScript with a bit

177
00:07:25,676 --> 00:07:28,186
of Objective-C that some
other folks have written.

178
00:07:28,186 --> 00:07:29,456
So I would consider that perhaps

179
00:07:29,456 --> 00:07:31,806
for your next project
well beyond courses

180
00:07:31,806 --> 00:07:33,986
if that's of interest.

181
00:07:36,316 --> 00:07:37,026
Questions?

182
00:07:38,336 --> 00:07:38,606
All right.

183
00:07:38,606 --> 00:07:39,686
Well, what about provisioning?

184
00:07:39,766 --> 00:07:41,006
Sadly, some of you
have struggled

185
00:07:41,036 --> 00:07:43,716
with this this past week
because you may know a hacker

186
00:07:43,716 --> 00:07:49,796
or some prosecuted white-hat
type person found some

187
00:07:49,796 --> 00:07:51,966
vulnerabilities in
Apple's developer portal.

188
00:07:52,006 --> 00:07:53,766
The result of which
is that he was able

189
00:07:53,766 --> 00:07:56,176
to compromise supposedly
a whole bunch of names

190
00:07:56,176 --> 00:07:57,676
and e-mail addresses
of all of us

191
00:07:57,676 --> 00:08:00,516
who have [inaudible] registered
for the iOS developer portal.

192
00:08:00,746 --> 00:08:02,546
And to my knowledge,
this was the first time

193
00:08:02,546 --> 00:08:06,176
that Apple proceeded to take
the entire thing offline for,

194
00:08:06,176 --> 00:08:09,516
I think, over a week which is
wonderfully [inaudible] time

195
00:08:09,516 --> 00:08:10,566
for someone likes us.

196
00:08:10,566 --> 00:08:12,706
So, apologies to those of you
who have struggled with this,

197
00:08:12,736 --> 00:08:15,246
but this means now that
that thing is starting

198
00:08:15,246 --> 00:08:18,416
to comeback online, you can,
in fact, provision your device

199
00:08:18,416 --> 00:08:20,436
to run software written by you.

200
00:08:20,436 --> 00:08:23,466
So if you have an iOS
device, iPhone, iPad, or iPod,

201
00:08:23,526 --> 00:08:27,126
you can eventually, if not
already, go to URL like this,

202
00:08:27,126 --> 00:08:29,216
follow the online
documentation, and frankly,

203
00:08:29,396 --> 00:08:31,386
this is one of the biggest
headaches of iOS development.

204
00:08:31,386 --> 00:08:35,136
Just getting your damn code onto
your own phone, it's not nearly

205
00:08:35,136 --> 00:08:37,126
as simple as it is
in the Android world

206
00:08:37,126 --> 00:08:39,516
or in other platforms
because you essentially have

207
00:08:39,516 --> 00:08:43,316
to upload a public/private
key pair or portion thereof

208
00:08:43,346 --> 00:08:45,906
to Apple, so as to register
some cryptographic key

209
00:08:45,906 --> 00:08:48,326
with them then your code
has to be digitally signed

210
00:08:48,326 --> 00:08:51,476
in such a way that it's allowed
to run on your own phone even

211
00:08:51,476 --> 00:08:54,116
if you're doing all these
at home with a USB cable

212
00:08:54,376 --> 00:08:56,606
and this costs you
only 99 dollars a year

213
00:08:56,606 --> 00:08:57,326
for this privilege.

214
00:08:57,326 --> 00:08:59,696
So, long story short,
this is a huge headache,

215
00:08:59,696 --> 00:09:02,736
and every time I go, it changes
every year but you can kind

216
00:09:02,736 --> 00:09:04,106
of muscle through it
with the documentation

217
00:09:04,106 --> 00:09:05,926
which has gotten better
overtime, but the end result is

218
00:09:05,926 --> 00:09:08,136
that you can run the
software on your own phone.

219
00:09:08,136 --> 00:09:09,626
If you want to distribute
it to friends,

220
00:09:09,886 --> 00:09:13,336
you'll have to go buy a way of
the App Store or there are ways

221
00:09:13,336 --> 00:09:15,016
over the air that you
can distribute apps

222
00:09:15,016 --> 00:09:17,276
for testing's sake, and
there's also for those of you

223
00:09:17,276 --> 00:09:20,036
who work professionally, there's
an enterprise level account

224
00:09:20,036 --> 00:09:24,246
for 299 dollars a year, or 199
that allows you to share code

225
00:09:24,246 --> 00:09:26,966
that you've written other
folks on the development team,

226
00:09:26,966 --> 00:09:29,036
which makes it a little
easier to at least share

227
00:09:29,036 --> 00:09:31,256
and test software
among each other.

228
00:09:31,706 --> 00:09:33,446
So, not a particularly
fun process,

229
00:09:33,446 --> 00:09:35,926
but there is quite a sense
of gratification, I think,

230
00:09:36,236 --> 00:09:39,456
once you've got in your own
code working on your own phone.

231
00:09:39,456 --> 00:09:41,656
So, aspire to that
perhaps for next week

232
00:09:41,656 --> 00:09:43,336
and realize you don't have
to pay any of those fees.

233
00:09:43,576 --> 00:09:45,676
Assuming the member center
as it's called as back up

234
00:09:45,676 --> 00:09:47,656
and running, we can
provision your phone for you.

235
00:09:47,656 --> 00:09:50,686
You can fill up the form that's
linked on the course's website,

236
00:09:51,446 --> 00:09:52,616
and in the specification,

237
00:09:52,616 --> 00:09:55,926
so that you can then use our
academic account at least

238
00:09:55,926 --> 00:09:58,056
for the remaining couple
of weeks of summer school.

239
00:09:58,056 --> 00:10:01,886
All right, so we're fortunate
today to be joined by folks

240
00:10:01,886 --> 00:10:03,806
who will bring us two
different perspectives

241
00:10:03,806 --> 00:10:05,976
on how Mobile Software
Development can be done.

242
00:10:06,856 --> 00:10:09,366
First is Dan Armendariz
who's a buddy of mine

243
00:10:09,366 --> 00:10:11,376
and also the former
instructor of this course back

244
00:10:11,376 --> 00:10:14,656
in a day we doubled in both iOS
as well as Android development.

245
00:10:14,906 --> 00:10:16,966
And Dan has come back
from California to join us

246
00:10:16,966 --> 00:10:18,196
for an hour's chat this evening

247
00:10:18,196 --> 00:10:20,946
about how Android development
compares and contrasts

248
00:10:20,946 --> 00:10:22,796
with Native iOS developments.

249
00:10:22,796 --> 00:10:25,066
We're also fortunate to be
joined by a friend of ours

250
00:10:25,066 --> 00:10:27,306
from down the street
at Microsoft NERD,

251
00:10:27,696 --> 00:10:29,836
New English Research
& Development.

252
00:10:29,836 --> 00:10:32,036
Bob Familiar is joining
us tonight to take a look

253
00:10:32,036 --> 00:10:34,306
at Windows Phone
development and also some

254
00:10:34,306 --> 00:10:36,826
of the latest features
in Windows 8.

255
00:10:36,956 --> 00:10:38,496
So those of you who've
been following some

256
00:10:38,496 --> 00:10:40,216
of the progression of
that operating system,

257
00:10:40,216 --> 00:10:44,416
even has a neat beta and
demo for us take a look at.

258
00:10:44,416 --> 00:10:46,796
So without further ado, allow
me to introduce Bob Familiar

259
00:10:46,796 --> 00:10:47,956
who will join us
for the next hour.

260
00:10:48,136 --> 00:10:48,416
Bob.

261
00:10:48,416 --> 00:10:49,146
>> Thanks a lot, David.

262
00:10:49,146 --> 00:10:49,606
>> Thanks so much.

263
00:10:50,516 --> 00:10:52,516
[ Applause ]

264
00:10:53,016 --> 00:10:56,000
[ Pause ]

265
00:10:56,436 --> 00:10:57,586
>> So, good evening.

266
00:10:59,156 --> 00:11:01,446
First, I thank you
for the opportunity

267
00:11:01,446 --> 00:11:06,816
to be here and to talk to you.

268
00:11:07,336 --> 00:11:09,486
As David said, my
name is Bob Familiar.

269
00:11:09,486 --> 00:11:11,936
I'm the director of
technical evangelism

270
00:11:11,936 --> 00:11:13,596
for Microsoft here in northeast.

271
00:11:14,216 --> 00:11:17,686
Myself and my team,
we work with students

272
00:11:17,686 --> 00:11:19,076
and professional developers.

273
00:11:19,076 --> 00:11:23,666
We teach them how to build
apps for Windows Phone,

274
00:11:23,666 --> 00:11:27,876
for Windows 8, leveraging our
Cloud, Windows Azure, and,

275
00:11:27,916 --> 00:11:34,176
you know, we do that through
activities that we do online,

276
00:11:34,226 --> 00:11:36,916
through our blogs, through
engaging in technical forums.

277
00:11:36,916 --> 00:11:40,086
But we also run a lot
of hands-on workshops

278
00:11:40,086 --> 00:11:43,596
on college campuses and other
offices across the country.

279
00:11:44,396 --> 00:11:45,736
So what I want to talk to you

280
00:11:45,736 --> 00:11:48,416
about tonight is modern
app development on Windows.

281
00:11:48,576 --> 00:11:51,746
So the agenda is, I just
want to talk about, you know,

282
00:11:51,776 --> 00:11:53,626
what does it mean to
develop for Windows.

283
00:11:53,986 --> 00:11:55,486
I'm going to dig in a bit.

284
00:11:55,486 --> 00:11:56,466
We'll look at some code.

285
00:11:56,466 --> 00:12:00,146
We'll talk about building apps
that you use open data APIs.

286
00:12:00,196 --> 00:12:03,646
So if you've been interested
in building apps for iOS

287
00:12:03,646 --> 00:12:06,336
or for Android or for Windows,
and you're interested, hey,

288
00:12:06,336 --> 00:12:07,616
you know, I'd like
to do something

289
00:12:07,616 --> 00:12:12,176
with that Instagram API, or
it's Yelp, or Facebook, Twitter,

290
00:12:12,476 --> 00:12:14,886
I'm kind of go over
that design pattern.

291
00:12:14,886 --> 00:12:17,666
I'm going to show you some
examples, we'll dig into it.

292
00:12:17,666 --> 00:12:19,866
I, myself, am a C# developer

293
00:12:20,076 --> 00:12:22,416
so I'll be using the
C# programming language

294
00:12:22,416 --> 00:12:23,626
to demonstrate that.

295
00:12:23,896 --> 00:12:26,766
But the great news is that
the pattern I'm showing you is

296
00:12:26,766 --> 00:12:29,416
applicable, you know,
really very much

297
00:12:29,416 --> 00:12:33,186
in a cross-platform way
and you just, you know,

298
00:12:33,186 --> 00:12:33,856
there's different ways

299
00:12:33,856 --> 00:12:36,186
to implement it whether
you're doing JavaScript

300
00:12:36,276 --> 00:12:39,786
or you're developing
in Java for Android

301
00:12:39,786 --> 00:12:41,986
or on the Apple platform.

302
00:12:41,986 --> 00:12:44,886
So it just changes in
languages syntax at that point.

303
00:12:45,206 --> 00:12:47,926
Now, I'll close out and just
really ducktail nicely what

304
00:12:47,926 --> 00:12:49,356
David is talking
about with PhoneGap.

305
00:12:49,356 --> 00:12:53,246
I'm going to cover just
the cross-platform app

306
00:12:53,246 --> 00:12:55,976
and game development landscape.

307
00:12:55,976 --> 00:12:59,396
As you go into this space,
if this is your, you know,

308
00:12:59,446 --> 00:13:02,116
this is your career aspiration,

309
00:13:02,466 --> 00:13:03,726
one of the things
you really want

310
00:13:03,726 --> 00:13:05,946
to understand is what are
all the different ways

311
00:13:05,946 --> 00:13:09,206
that you can build apps and
games or these platforms.

312
00:13:09,466 --> 00:13:10,866
And if you're doing
it professionally,

313
00:13:10,866 --> 00:13:14,986
there may be value in leveraging
cross-platform frameworks

314
00:13:14,986 --> 00:13:15,686
and tools.

315
00:13:15,686 --> 00:13:18,316
So I'll just give you a
sense of what they are,

316
00:13:18,786 --> 00:13:21,856
what platforms they
support, what languages

317
00:13:21,856 --> 00:13:23,646
and what skill sets
you might need.

318
00:13:23,966 --> 00:13:26,846
But, you know, knowing how
to do something natively,

319
00:13:27,106 --> 00:13:28,706
it's a fantastic skill to have,

320
00:13:29,056 --> 00:13:32,306
but also there may be business
reasons why a cross-platform

321
00:13:32,306 --> 00:13:34,436
framework or tool makes sense.

322
00:13:34,436 --> 00:13:35,966
And we'll just go
over that briefly.

323
00:13:35,966 --> 00:13:39,656
And I'll finish out with
pointing you to a whole bunch

324
00:13:39,656 --> 00:13:43,576
of resources that
we have for you.

325
00:13:43,576 --> 00:13:46,246
So when you think about
developing for Windows,

326
00:13:46,246 --> 00:13:50,926
you know, obviously, we
made a significant change

327
00:13:51,236 --> 00:13:54,336
in the experience of Windows
when a user first used it.

328
00:13:54,336 --> 00:13:56,536
They're presented
with a Start screen.

329
00:13:56,536 --> 00:13:58,996
The apps that used to be

330
00:13:58,996 --> 00:14:03,276
on the Start menu are
now represented as tiles.

331
00:14:03,276 --> 00:14:05,816
And these are, in many
cases, live tiles.

332
00:14:05,816 --> 00:14:08,786
So the tiles themselves will
update with information.

333
00:14:08,786 --> 00:14:11,166
It's a touch-first experience.

334
00:14:11,166 --> 00:14:15,246
It's very, you know, our
goal is it's very immersive

335
00:14:15,246 --> 00:14:18,616
and allows a user to really get

336
00:14:18,616 --> 00:14:20,246
to what they want
to do very quickly.

337
00:14:20,756 --> 00:14:23,856
I'll demonstrate some apps
for you to show you that.

338
00:14:24,076 --> 00:14:27,186
Another key point from a
developer's perspective is

339
00:14:27,186 --> 00:14:31,026
that we provide new
language choice.

340
00:14:31,236 --> 00:14:36,476
So you can develop natively on
Windows and on Windows Phone

341
00:14:36,526 --> 00:14:41,006
in C++, in C#, but also
in HTML5 and JavaScript.

342
00:14:41,146 --> 00:14:45,816
So that, you know, opening
up the platform natively

343
00:14:46,156 --> 00:14:49,276
for web developers was,
you know, a big shift.

344
00:14:49,276 --> 00:14:50,206
And the way we do that,

345
00:14:50,206 --> 00:14:53,486
I'll describe what the platform
architecture is a little bit.

346
00:14:53,786 --> 00:14:55,976
But the bottom line is
there's a common runtime.

347
00:14:56,466 --> 00:14:59,906
So regardless of what language
you use, you have access

348
00:14:59,906 --> 00:15:02,146
to the full API set natively.

349
00:15:02,336 --> 00:15:03,466
So it's really about it.

350
00:15:03,466 --> 00:15:08,716
It's a skill set
decision for you.

351
00:15:08,716 --> 00:15:12,666
So, let's demonstrate a
couple of apps for you

352
00:15:12,666 --> 00:15:14,036
so you get a sense of, you know,

353
00:15:14,036 --> 00:15:15,966
when you're targeting
the Windows platform,

354
00:15:15,966 --> 00:15:18,556
how do you really differentiate
your app from others.

355
00:15:18,556 --> 00:15:21,506
So first off, you know, this
is the main Start screen

356
00:15:21,506 --> 00:15:22,536
in Windows 8.

357
00:15:23,266 --> 00:15:27,136
I'm running a-- this is an
ASUS ZenBook Prime Touch

358
00:15:27,136 --> 00:15:28,426
so it's got a touch screen.

359
00:15:28,876 --> 00:15:35,066
I can see all my apps, I can
easily scroll through them.

360
00:15:35,146 --> 00:15:37,976
With touch, I can pinch
zoom, in this way,

361
00:15:37,976 --> 00:15:42,316
I can see all the different
categories that I've defined.

362
00:15:42,696 --> 00:15:46,456
If I want to run an application,
let's say I want to go

363
00:15:46,456 --> 00:15:51,216
to the Microsoft Store, I
simply touch it, or of course,

364
00:15:51,216 --> 00:15:52,546
I could click it with the mouse.

365
00:15:52,546 --> 00:15:54,376
It's-- and one other
interesting thing

366
00:15:54,376 --> 00:15:56,066
about the platform is everything

367
00:15:56,066 --> 00:15:58,386
within Windows is
still fully functional

368
00:15:58,386 --> 00:15:59,386
with keyboard and mouse.

369
00:15:59,386 --> 00:16:03,306
But we've made it also a very,

370
00:16:03,306 --> 00:16:05,156
very good touch-first
experience.

371
00:16:05,326 --> 00:16:06,606
So now, I'm in the store.

372
00:16:06,606 --> 00:16:09,096
And if I was interested
in purchasing Halo:

373
00:16:09,096 --> 00:16:11,936
Spartan Assault, you
know, I could go in here

374
00:16:12,246 --> 00:16:13,426
and I could check it out,

375
00:16:13,426 --> 00:16:16,696
I could see the different
screenshots, I could look

376
00:16:16,696 --> 00:16:19,156
at reviews, and so on.

377
00:16:19,466 --> 00:16:21,226
And I could choose
to purchase it

378
00:16:21,226 --> 00:16:24,226
which in this case I already
have, so it knows that.

379
00:16:26,766 --> 00:16:29,116
Now, from an app developer,
one of the things I might wan

380
00:16:29,116 --> 00:16:35,386
to do is make sure that the
tile itself is providing value

381
00:16:35,386 --> 00:16:36,046
to the user.

382
00:16:36,046 --> 00:16:38,426
So you can have what's
called the live tile,

383
00:16:38,426 --> 00:16:39,456
and there's a couple
examples here.

384
00:16:39,456 --> 00:16:43,596
You see some tiles updating
with the different images.

385
00:16:43,926 --> 00:16:46,416
You can see the store
title is telling me

386
00:16:46,416 --> 00:16:47,736
that I have an update.

387
00:16:48,176 --> 00:16:50,186
So these are things that
you, as a developer,

388
00:16:50,186 --> 00:16:52,246
can take advantage of.

389
00:16:52,856 --> 00:16:56,966
The user could choose to
turn that off or turn it

390
00:16:56,966 --> 00:16:59,646
on at any time, but
it's something

391
00:16:59,646 --> 00:17:03,376
that if you are providing
say status of your game,

392
00:17:03,646 --> 00:17:06,406
you might want hotlist what
the recent high score is,

393
00:17:06,406 --> 00:17:09,156
or maybe if it's multiplayer
game that might want

394
00:17:09,156 --> 00:17:10,426
to tell the user
it's their turn,

395
00:17:10,926 --> 00:17:11,996
you know, it's a chess game.

396
00:17:12,206 --> 00:17:14,166
The person you've been playing
with has made their move, now,

397
00:17:14,416 --> 00:17:16,826
it's their turn to go
in and play the game.

398
00:17:16,826 --> 00:17:17,546
So you could actually do

399
00:17:17,546 --> 00:17:19,556
that without the app
actually running.

400
00:17:19,556 --> 00:17:21,986
So it's pretty powerful.

401
00:17:21,986 --> 00:17:24,756
Another thing that you can do
is you can provide different

402
00:17:25,006 --> 00:17:26,206
tile sizes.

403
00:17:26,766 --> 00:17:33,886
So, on Windows 8, we give
you the option of a wide tile

404
00:17:34,526 --> 00:17:39,046
or a standard 150x150 tile.

405
00:17:39,046 --> 00:17:41,056
It's another way you
can differentiate.

406
00:17:41,056 --> 00:17:43,766
You don't-- the wide
tile optional, but it's--

407
00:17:43,766 --> 00:17:46,066
you supply that if
you want to provide

408
00:17:46,106 --> 00:17:47,806
that capability for the user.

409
00:17:48,566 --> 00:17:49,776
Now, let's see.

410
00:17:50,516 --> 00:17:54,206
[ Pause ]

411
00:17:54,706 --> 00:17:56,036
Let's go here.

412
00:17:56,876 --> 00:18:00,136
So this is the Allrecipes
application.

413
00:18:00,136 --> 00:18:03,446
So this just gives
you an example of sort

414
00:18:03,446 --> 00:18:08,746
of the design language that we
are promoting with Windows 8.

415
00:18:08,966 --> 00:18:11,816
It starts with it
being chromeless.

416
00:18:11,816 --> 00:18:14,106
All right, so what that means
is you're not seeing any

417
00:18:14,286 --> 00:18:19,286
decoration, let's say operating
system window decoration here,

418
00:18:19,326 --> 00:18:19,756
right?

419
00:18:20,026 --> 00:18:22,456
Traditionally, in Windows,
if you opened a window

420
00:18:22,456 --> 00:18:25,926
like on Windows 7, on the
desktop, there would be an edge

421
00:18:25,926 --> 00:18:29,846
to the window, there
would be Minimize and Open

422
00:18:29,846 --> 00:18:31,896
and Close buttons on the
upper right-hand corner.

423
00:18:31,896 --> 00:18:34,056
There might be a
menu across the top.

424
00:18:34,056 --> 00:18:37,116
There's a lot of stuff
going on in this window.

425
00:18:37,226 --> 00:18:41,616
Here, the philosophy
is content is--

426
00:18:41,976 --> 00:18:44,716
content of the app
is the centerpiece.

427
00:18:45,036 --> 00:18:51,666
And so, you see very vivid,
you know, images being used.

428
00:18:51,666 --> 00:18:57,186
The user is guided
through this application.

429
00:18:57,186 --> 00:19:02,376
They navigate through it with--
by the use of topography.

430
00:19:02,886 --> 00:19:05,816
So, you know, really
nice looking fonts,

431
00:19:05,996 --> 00:19:08,066
different sizes mean
different things.

432
00:19:08,476 --> 00:19:13,476
I'm interested in recipes that
deal with bacon, all right,

433
00:19:13,476 --> 00:19:16,506
so I know I can just click
on that, I can touch that.

434
00:19:16,826 --> 00:19:20,496
And now, I'm seeing all
the recipes that match

435
00:19:20,496 --> 00:19:22,716
that particular category.

436
00:19:22,956 --> 00:19:25,466
If I want to go back, I can see
in the upper left-hand corner,

437
00:19:26,356 --> 00:19:27,786
little bread crumb arrow.

438
00:19:27,786 --> 00:19:30,156
I know that I can navigate
back to the main screen.

439
00:19:31,036 --> 00:19:34,526
So there's a lot more
to that design language.

440
00:19:35,306 --> 00:19:38,076
We refer to that as
modern app design.

441
00:19:38,076 --> 00:19:39,956
I think initially when we
released it, we referred to it

442
00:19:39,956 --> 00:19:43,186
as metro design, but now
it's modern app design,

443
00:19:43,186 --> 00:19:45,506
and if you going to
design.windows.com,

444
00:19:45,786 --> 00:19:47,656
there's a great deal
of documentation

445
00:19:47,706 --> 00:19:49,716
on this design language.

446
00:19:49,926 --> 00:19:55,416
It's guidance on how to make
a really beautiful application

447
00:19:55,756 --> 00:19:56,856
on Windows.

448
00:19:56,986 --> 00:19:59,826
Some of the other things
this app demonstrates is the

449
00:19:59,826 --> 00:20:00,976
integration with the
operating system itself.

450
00:20:01,046 --> 00:20:04,746
So, I just swiped from
the right-hand side.

451
00:20:04,746 --> 00:20:06,426
I brought in what's
called the Charms Bar.

452
00:20:06,426 --> 00:20:09,386
So, this is also a capability
as a developer, you have accesse

453
00:20:09,386 --> 00:20:13,486
to this platform features
from your application.

454
00:20:13,486 --> 00:20:14,646
So, for example, Search.

455
00:20:14,956 --> 00:20:16,256
If I click on Search,

456
00:20:16,376 --> 00:20:20,546
what you'll notice is the
Search layout panel comes in.

457
00:20:21,476 --> 00:20:24,556
And Allrecipes is
selected by default.

458
00:20:24,556 --> 00:20:25,796
So, if when I do a search now,

459
00:20:25,796 --> 00:20:27,876
I'm going to be searching
Allrecipes.

460
00:20:28,256 --> 00:20:31,736
But you can see that there are
number of other applications

461
00:20:31,736 --> 00:20:34,776
that have registered
themselves with Windows

462
00:20:35,066 --> 00:20:37,496
and are making themselves
available for search.

463
00:20:38,386 --> 00:20:39,976
But if I was interested
in cookies--

464
00:20:40,516 --> 00:20:43,616
[ Pause ]

465
00:20:44,116 --> 00:20:47,456
-- in All recipes, that
search is now being--

466
00:20:47,456 --> 00:20:51,006
that search query was just
passed to the application

467
00:20:51,006 --> 00:20:53,826
and the application then decides
how it wants to deal with it.

468
00:20:54,456 --> 00:20:56,146
So, any application can tie

469
00:20:56,146 --> 00:20:58,266
in to the search
capability that's built

470
00:20:58,266 --> 00:20:59,786
in to the operating system.

471
00:20:59,786 --> 00:21:02,106
Something registers
itself as a search target

472
00:21:02,556 --> 00:21:04,316
when the user types
in terms, so,

473
00:21:04,316 --> 00:21:05,876
your application could do that.

474
00:21:05,876 --> 00:21:08,806
All right, so you could
just tie in that feature.

475
00:21:08,806 --> 00:21:10,516
And the same with sharing.

476
00:21:11,106 --> 00:21:14,576
So, this says this app
can't share, all right?

477
00:21:14,576 --> 00:21:16,436
So, this app hasn't
implemented this feature.

478
00:21:16,686 --> 00:21:17,796
But what you could do in an app

479
00:21:17,846 --> 00:21:19,316
that would share
is it might say,

480
00:21:19,316 --> 00:21:23,496
"I'd like to share whatever
information's on the screen,"

481
00:21:23,796 --> 00:21:26,396
in which case, it might be
interesting to see if I go

482
00:21:26,396 --> 00:21:28,886
into a particular recipe
if it allows me to share.

483
00:21:28,886 --> 00:21:30,366
There we go.

484
00:21:30,606 --> 00:21:34,766
So now that I'm on a
particular recipe, it says--

485
00:21:34,906 --> 00:21:37,346
in Allrecipes, user says, "I
want to share this recipe."

486
00:21:37,536 --> 00:21:40,236
Well, what comes up are
all the applications

487
00:21:40,676 --> 00:21:42,266
that have registered
with Windows

488
00:21:42,266 --> 00:21:44,886
that support sharing
as a share target.

489
00:21:45,816 --> 00:21:48,746
So, Allrecipes doesn't know
how to share with Mail,

490
00:21:48,966 --> 00:21:51,626
doesn't know how to share
with OneNote, or SkyDrive.

491
00:21:52,036 --> 00:21:53,786
The operating system
knows how to do that.

492
00:21:54,276 --> 00:21:57,666
Allrecipe is simply saying, "I
want to take this information

493
00:21:57,666 --> 00:21:59,846
which is this recipe
and share it out."

494
00:21:59,946 --> 00:22:02,686
And the user gets to
choose where they share it.

495
00:22:03,096 --> 00:22:05,846
So, that's another way that
you can differentiate your app

496
00:22:05,846 --> 00:22:11,236
on the platform, take
advantage of search and share.

497
00:22:11,446 --> 00:22:16,056
Now, Allrecipes, that's a great
example of an HTML5 application.

498
00:22:16,176 --> 00:22:20,126
That was built in HTML5
and JavaScript for Windows.

499
00:22:20,126 --> 00:22:23,896
An example of a game
that's built in HTML5

500
00:22:23,896 --> 00:22:25,396
and JavaScript is Cut the Rope.

501
00:22:25,706 --> 00:22:26,956
So, it's a popular game.

502
00:22:26,956 --> 00:22:28,106
So, it's on all platforms.

503
00:22:28,106 --> 00:22:29,266
It's available in the browser.

504
00:22:30,766 --> 00:22:34,406
What this team did is they took
their HTML5 and JavaScript code.

505
00:22:34,406 --> 00:22:36,966
In about two weeks, they
had it running on Windows 8,

506
00:22:37,546 --> 00:22:40,136
very early on in
the beta timeframe.

507
00:22:40,836 --> 00:22:43,416
So, you know, just to give
you a sense of, you know,

508
00:22:43,416 --> 00:22:45,446
the kind of performance
that you can get,

509
00:22:45,536 --> 00:22:48,696
I'm going to embarrass
myself and try

510
00:22:49,136 --> 00:22:50,696
to play this game here so.

511
00:22:51,516 --> 00:22:58,076
[ Pause ]

512
00:22:58,576 --> 00:22:59,256
Here we go.

513
00:22:59,986 --> 00:23:00,516
Two out of three.

514
00:23:01,116 --> 00:23:03,336
It's OK. Here we go.

515
00:23:05,636 --> 00:23:07,826
That's HTML5 and JavaScript.

516
00:23:08,276 --> 00:23:11,326
Pretty performing,
that's because you--

517
00:23:11,326 --> 00:23:15,406
whether you're building a C++,
C#, or HTML5 and JavaScript,

518
00:23:15,406 --> 00:23:17,666
there's a common runtime
for all those languages.

519
00:23:17,886 --> 00:23:20,216
Now, you could actually
build and you can get closer

520
00:23:20,216 --> 00:23:23,456
to the metal and go C++
native, in which case,

521
00:23:23,456 --> 00:23:26,866
you are not leveraging that
common language runtime.

522
00:23:27,276 --> 00:23:33,166
But, you know, for most cases,
for most applications and games,

523
00:23:33,906 --> 00:23:37,586
that's actually quite sufficient
from a performance perspective.

524
00:23:37,806 --> 00:23:40,266
If you're writing
something like Halo Spartan,

525
00:23:40,466 --> 00:23:43,416
then you're probably, you know,
and you're doing 3D modeling

526
00:23:43,416 --> 00:23:45,326
and things of that sort,
you're going to be right

527
00:23:45,326 --> 00:23:48,116
on the metal with C++.

528
00:23:49,116 --> 00:23:51,556
Here's an app that's
written in C#.

529
00:23:52,436 --> 00:23:55,576
This is Cocktail Flow.

530
00:23:56,446 --> 00:23:59,336
So, this is just also
showing you, you know,

531
00:23:59,336 --> 00:24:03,606
that design language I talked
about earlier, its guidelines.

532
00:24:04,026 --> 00:24:08,146
The-- as a developer, you get to
decide how you want to implement

533
00:24:08,316 --> 00:24:11,996
that particular-- you
take that guidance

534
00:24:11,996 --> 00:24:13,236
and apply it to your app.

535
00:24:13,236 --> 00:24:14,996
And here is an example

536
00:24:14,996 --> 00:24:19,366
where we've got this really just
beautiful immersive application.

537
00:24:19,816 --> 00:24:21,256
It looks great on
that big screen.

538
00:24:22,886 --> 00:24:24,736
And, you know, maybe
you're interested

539
00:24:24,736 --> 00:24:26,706
in how you make this
particular [inaudible].

540
00:24:26,706 --> 00:24:30,456
You can see the nice
animations, fantastic imagery.

541
00:24:30,676 --> 00:24:33,376
And it's very fast.

542
00:24:33,686 --> 00:24:36,246
We used to-- when this
first came out, you know,

543
00:24:36,246 --> 00:24:38,526
we would refer to apps
like this as fast, fluid,

544
00:24:38,526 --> 00:24:39,596
immersive, and beautiful.

545
00:24:40,076 --> 00:24:42,806
That's really at the
core of the philosophy

546
00:24:42,806 --> 00:24:45,676
of that design language.

547
00:24:46,516 --> 00:24:49,376
[ Pause ]

548
00:24:49,876 --> 00:24:55,196
This is a game that's
built in C#.

549
00:24:56,516 --> 00:25:03,586
[ Pause ]

550
00:25:04,086 --> 00:25:07,056
I'm not saying that
all the power of this

551
00:25:07,056 --> 00:25:15,146
but you're the sense of--
that this is a-- let's go.

552
00:25:15,856 --> 00:25:20,026
One more. At last.

553
00:25:20,266 --> 00:25:22,776
All right.

554
00:25:23,986 --> 00:25:27,566
Very sad. But, the point
is you can build apps,

555
00:25:27,746 --> 00:25:30,646
you can build games, you know,
in your language of choice.

556
00:25:32,196 --> 00:25:34,906
Now, we make that possible
as I've said earlier

557
00:25:34,906 --> 00:25:38,846
because we have this common run
time Win RT, Windows Run Time.

558
00:25:39,556 --> 00:25:42,886
And on top of that, you have
your choice of language,

559
00:25:42,916 --> 00:25:48,286
C or C++, C Sharp or Visual
Basic, HTML, and JavaScript.

560
00:25:49,336 --> 00:25:51,426
There is something called XAML,

561
00:25:51,426 --> 00:25:53,896
Extensible Application
Markup Language.

562
00:25:54,286 --> 00:25:59,176
That-- that is the language that
you would combine with C or C++

563
00:25:59,176 --> 00:26:02,346
or C Sharp or Visual Basic
that does the layout of the UI.

564
00:26:02,986 --> 00:26:06,816
So, you can think of it
as equivalent to HTML--

565
00:26:06,816 --> 00:26:09,936
that HTML with JavaScript,
XAML with C Sharp.

566
00:26:09,936 --> 00:26:12,306
That's the same relationship
there.

567
00:26:13,516 --> 00:26:19,036
[ Pause ]

568
00:26:19,536 --> 00:26:23,496
So, what I want to show you
now is if you're interested

569
00:26:23,496 --> 00:26:26,516
in getting started to
build an application

570
00:26:26,646 --> 00:26:28,676
for Windows, what do you need?

571
00:26:28,676 --> 00:26:30,086
When we start with
Visual Studio?

572
00:26:31,366 --> 00:26:36,436
Visual Studio is the development
tool-- you're students, so,

573
00:26:36,436 --> 00:26:40,986
you have access to Visual Studio
at Professional at no cost

574
00:26:40,986 --> 00:26:42,406
through our DreamSpark program.

575
00:26:42,746 --> 00:26:45,316
So, if you're not signed up
at DreamSpark, please do.

576
00:26:45,316 --> 00:26:50,276
In fact, in the Applied Sciences
and Engineering Department,

577
00:26:50,376 --> 00:26:54,196
you actually have your
own DreamSpark Premium

578
00:26:54,196 --> 00:26:55,606
and you have a web store.

579
00:26:55,606 --> 00:26:57,726
So, does this class
know all about that?

580
00:26:57,856 --> 00:26:57,966
>> They--

581
00:26:58,016 --> 00:26:59,176
>> Plugged [phonetic] into that?

582
00:26:59,276 --> 00:27:00,146
>> They don't but they do now.

583
00:27:00,376 --> 00:27:01,016
>> They do now?

584
00:27:01,176 --> 00:27:01,656
Beautiful.

585
00:27:01,946 --> 00:27:06,106
So, I don't know what the URL
is to the Harvard Web Store,

586
00:27:06,106 --> 00:27:10,416
but if you go there, you
can get access to all

587
00:27:10,416 --> 00:27:12,096
of our products at no charge.

588
00:27:12,206 --> 00:27:13,546
We'll make that available
to students.

589
00:27:14,196 --> 00:27:16,036
So you're in Visual Studio.

590
00:27:16,136 --> 00:27:17,176
You want to get started.

591
00:27:17,916 --> 00:27:20,366
Well, I'm going to go ahead
and click New Project.

592
00:27:24,216 --> 00:27:26,736
And the first thing
you'll see is the way

593
00:27:26,736 --> 00:27:30,186
that we organize the
templates is by language.

594
00:27:30,186 --> 00:27:32,536
So, I've got Visual
C Sharp here,

595
00:27:32,826 --> 00:27:36,126
but there are other languages
and I can expand that.

596
00:27:36,796 --> 00:27:38,866
I could see-- here's JavaScript.

597
00:27:40,226 --> 00:27:45,236
So, if I wanted to build an app
for the Windows Store in HTML5

598
00:27:45,236 --> 00:27:48,256
and JavaScript, I could start
with one of these templates.

599
00:27:48,256 --> 00:27:49,396
All right?

600
00:27:49,396 --> 00:27:50,236
Let's say grid app.

601
00:27:50,236 --> 00:27:51,486
I'm going to say, "OK.

602
00:27:51,486 --> 00:27:52,256
I want to get started.

603
00:27:52,256 --> 00:27:55,666
I want to build an app that's
based on that grid layout

604
00:27:55,976 --> 00:27:57,916
that I saw with all the recipes.

605
00:27:57,916 --> 00:28:00,096
It was very similar
to Cocktail Flow.

606
00:28:00,096 --> 00:28:02,156
I want an app that sort
of looks like that."

607
00:28:03,016 --> 00:28:05,226
It started with that template.

608
00:28:05,226 --> 00:28:07,726
So now, it's going to
generate that solution.

609
00:28:07,726 --> 00:28:08,966
It's going to give
you essentially all

610
00:28:08,966 --> 00:28:10,796
of the scaffolding
for that application.

611
00:28:11,726 --> 00:28:16,186
And by default, these
templates used--

612
00:28:16,186 --> 00:28:18,736
what we call Model
View ViewModel.

613
00:28:19,536 --> 00:28:22,566
So, it's the variation
on Model View controller

614
00:28:23,156 --> 00:28:25,036
but the ideas that, you know,

615
00:28:25,036 --> 00:28:29,426
Model View that's the user
interface layout that's done

616
00:28:29,426 --> 00:28:33,606
in XAML or be done in,
you know, HTML and CSS.

617
00:28:33,606 --> 00:28:37,816
And then, there's the ViewModel,
that's the data that you want

618
00:28:37,816 --> 00:28:41,316
to bind to your user
interface controls.

619
00:28:41,546 --> 00:28:42,026
All right.

620
00:28:42,056 --> 00:28:45,216
So, that's sounded
[phonetic] by, you know,

621
00:28:45,216 --> 00:28:47,126
what David had said earlier
in the beginning of the class

622
00:28:47,126 --> 00:28:49,126
that you're familiar with
Model View controller,

623
00:28:49,446 --> 00:28:51,356
so, Model View ViewModel.

624
00:28:51,356 --> 00:28:52,286
You'll feel very comfortable.

625
00:28:53,126 --> 00:28:54,206
Same concept.

626
00:28:54,776 --> 00:28:55,566
So here I am.

627
00:28:56,216 --> 00:28:58,436
I've generated this HTML5

628
00:28:58,436 --> 00:29:02,856
and JavaScript Windows
Store application.

629
00:29:02,856 --> 00:29:05,446
I'm going to go ahead and just
run it on the local machine.

630
00:29:05,606 --> 00:29:06,926
See what I get for free.

631
00:29:07,516 --> 00:29:11,146
[ Pause ]

632
00:29:11,646 --> 00:29:13,806
Starts up, this is the
default splash screen.

633
00:29:13,936 --> 00:29:15,126
Here's an area you're
going to want

634
00:29:15,196 --> 00:29:16,746
to have some focus on, right?

635
00:29:16,746 --> 00:29:19,356
Having a great looking
splash screen is key.

636
00:29:19,556 --> 00:29:20,616
Now the app is running.

637
00:29:21,056 --> 00:29:23,816
So by default, you get
a template that's laying

638
00:29:23,816 --> 00:29:29,226
out some pseudo information
in groups.

639
00:29:29,696 --> 00:29:34,626
And if I were to click
on to a group header,

640
00:29:35,336 --> 00:29:40,306
I would see this view
just showing me the items

641
00:29:40,306 --> 00:29:43,786
within that group or I could
click on a specific item

642
00:29:43,786 --> 00:29:45,456
and now I'm looking
at that specific item.

643
00:29:46,096 --> 00:29:51,636
So there's all place holders for
the data that is going to light

644
00:29:51,636 --> 00:29:53,336
up your application, all right?

645
00:29:53,656 --> 00:29:54,666
So, you can see this is--

646
00:29:54,666 --> 00:29:56,516
this is certainly not
ready for the store

647
00:29:57,236 --> 00:29:59,616
but all the scaffolding
is in place,

648
00:29:59,646 --> 00:30:01,296
the navigation is in place.

649
00:30:01,556 --> 00:30:04,566
What you need to now do
is come in, apply design,

650
00:30:05,166 --> 00:30:07,646
and bring in the data of your
application, that's going

651
00:30:07,646 --> 00:30:09,216
to be something I'll
focus on when I talk

652
00:30:09,216 --> 00:30:11,146
about using these
open data APIs.

653
00:30:12,156 --> 00:30:16,616
But the bottom line is you get a
pretty functional starting place

654
00:30:16,616 --> 00:30:17,796
for your applications.

655
00:30:18,516 --> 00:30:25,106
[ Pause ]

656
00:30:25,606 --> 00:30:27,876
As I file, new project again--

657
00:30:28,386 --> 00:30:32,786
so that was HTML5
and JavaScript.

658
00:30:32,786 --> 00:30:35,966
Now if I go to C-sharp,
Windows store,

659
00:30:36,396 --> 00:30:38,456
I can see I've got
those same templates.

660
00:30:38,456 --> 00:30:39,136
I have a blank.

661
00:30:39,136 --> 00:30:40,156
I have a grid.

662
00:30:40,156 --> 00:30:41,516
I have something
called the split app.

663
00:30:42,906 --> 00:30:45,686
So let's do grid in C-sharp.

664
00:30:45,796 --> 00:30:48,956
I say OK. I'm really going

665
00:30:48,956 --> 00:30:51,566
to get essentially it's
the same application,

666
00:30:51,696 --> 00:30:56,286
but now the language
is C-sharp and XML.

667
00:30:57,031 --> 00:30:59,031
[ Pause ]

668
00:30:59,046 --> 00:31:00,946
If I say go ahead and run this

669
00:31:00,946 --> 00:31:05,256
on the local machine again I
get this default slash screen.

670
00:31:06,466 --> 00:31:08,796
The app is up and
running, looks identical.

671
00:31:09,346 --> 00:31:11,976
All right.

672
00:31:12,516 --> 00:31:22,186
[ Pause ]

673
00:31:22,686 --> 00:31:28,646
Now we also support
building for the phone.

674
00:31:28,866 --> 00:31:31,686
So we're on to that, I'd say OK,
I want to do let's say C-sharp

675
00:31:31,686 --> 00:31:36,146
for Windows Phone, and now here
are all the different templates

676
00:31:36,656 --> 00:31:39,756
that I could use for a
Windows phone application.

677
00:31:40,416 --> 00:31:42,726
So say I want to do a Pivot App.

678
00:31:43,596 --> 00:31:44,246
Let's say OK.

679
00:31:44,866 --> 00:31:46,786
What platform?

680
00:31:46,786 --> 00:31:49,516
Is it the Windows
Phone 8 or is it 7.1?

681
00:31:49,516 --> 00:31:51,586
I'm going to choose
Windows Phone 8.

682
00:31:54,056 --> 00:31:55,046
Say OK.

683
00:31:56,516 --> 00:32:01,356
[ Pause ]

684
00:32:01,856 --> 00:32:03,876
And right there in that
Window you can see there's--

685
00:32:04,106 --> 00:32:06,906
this is the XAML which
is defining the layout.

686
00:32:07,526 --> 00:32:10,486
Here is the WYSIWYG editor,

687
00:32:10,546 --> 00:32:12,246
so I can see exactly
what it looks like.

688
00:32:12,936 --> 00:32:15,176
And if I wanted to
see, you know,

689
00:32:15,176 --> 00:32:16,486
want to dive into the code.

690
00:32:16,486 --> 00:32:23,006
I could open up the
source file, and dive in.

691
00:32:23,006 --> 00:32:27,486
I'm going to go ahead
and run this.

692
00:32:30,016 --> 00:32:33,516
So what you're seeing here
is we're emulating the phone

693
00:32:33,516 --> 00:32:39,286
to get, you know, it's actually
running as a virtual machine,

694
00:32:40,066 --> 00:32:43,426
and it's running the Windows
Phone operating system,

695
00:32:44,096 --> 00:32:46,716
and but it's fully integrated,

696
00:32:46,716 --> 00:32:49,566
so I can actually,
you know, test it.

697
00:32:52,416 --> 00:32:54,636
There-- I can test
it with touch.

698
00:32:54,636 --> 00:32:57,856
I can test it with the mouse.

699
00:32:57,856 --> 00:33:03,116
And there are also some
additional things I can do let's

700
00:33:03,116 --> 00:33:04,936
say like, you know, Pivot.

701
00:33:05,326 --> 00:33:09,436
So if you wanted to make sure

702
00:33:09,436 --> 00:33:12,046
that your application
will respond to the user,

703
00:33:12,586 --> 00:33:15,316
putting the device
into landscape mode,

704
00:33:15,316 --> 00:33:17,356
to make sure the user
interface responded

705
00:33:17,356 --> 00:33:18,976
to that, you could test that.

706
00:33:19,516 --> 00:33:28,466
[ Pause ]

707
00:33:28,966 --> 00:33:30,056
Any question so far?

708
00:33:30,706 --> 00:33:32,766
Go ahead.

709
00:33:33,516 --> 00:33:47,106
[ Inaudible Remark ]

710
00:33:47,606 --> 00:33:48,746
Right. So the question is,

711
00:33:48,746 --> 00:33:53,056
if I'm targeting the Windows
platform and take advantage

712
00:33:53,056 --> 00:33:54,846
of some of the things
that differentiate the app

713
00:33:54,846 --> 00:33:57,986
on Windows, the Tiles
and Search and Share,

714
00:33:57,986 --> 00:34:01,696
those things aren't unavailable
on the other platforms,

715
00:34:01,966 --> 00:34:05,006
you know, how do
you plan for that?

716
00:34:05,006 --> 00:34:05,996
How do you deal with that?

717
00:34:06,426 --> 00:34:11,256
So later in the talk,
I'll inform you

718
00:34:11,256 --> 00:34:14,346
on all the different ways you
can build cross-platform apps

719
00:34:14,346 --> 00:34:15,016
and games.

720
00:34:15,386 --> 00:34:19,206
And but one of the things that
you'll learn is that especially

721
00:34:19,206 --> 00:34:25,026
in the area of apps, is the one
thing you can't really replicate

722
00:34:25,026 --> 00:34:26,076
going from one platform

723
00:34:26,076 --> 00:34:29,196
to the other is the user
experience, that is the UI.

724
00:34:29,516 --> 00:34:33,576
So the first step in your
architecture is separation

725
00:34:33,576 --> 00:34:36,096
of concerns, that's for
model-view-controller comes in,

726
00:34:36,456 --> 00:34:42,446
or MVC as-- MVVM, I'm
sorry, that we promote.

727
00:34:42,596 --> 00:34:48,556
The whole idea is separating
the UI layout, UI logic,

728
00:34:48,706 --> 00:34:51,316
middle tier logic, data access,

729
00:34:51,316 --> 00:34:53,966
make sure you've got good
separation in your code.

730
00:34:54,346 --> 00:34:59,216
So when you go to do something
in a cross-platform project,

731
00:34:59,536 --> 00:35:01,946
not all your code can
go cross platform.

732
00:35:02,666 --> 00:35:05,946
Typically, what you have is
you try to target the majority

733
00:35:05,946 --> 00:35:11,506
of your logic is-- that's
not user interface-related,

734
00:35:11,746 --> 00:35:14,806
that can be cross-platform.

735
00:35:15,706 --> 00:35:17,276
You try to choose a language

736
00:35:17,396 --> 00:35:19,196
that will get you
cross-platform,

737
00:35:19,306 --> 00:35:20,716
that's the other thing
you have to look at.

738
00:35:21,116 --> 00:35:24,186
But typically, you'll do
unique UI implementations

739
00:35:24,466 --> 00:35:27,466
on every file, because each
on has their own controls,

740
00:35:27,466 --> 00:35:31,076
their own idiosyncrasies,
their own features

741
00:35:31,076 --> 00:35:33,346
that you're going
to want to leverage.

742
00:35:33,706 --> 00:35:34,806
So it's a great question.

743
00:35:35,516 --> 00:35:37,656
[ Inaudible Remark ]

744
00:35:38,156 --> 00:35:39,656
The short answer was no.

745
00:35:39,946 --> 00:35:44,536
The shorter answer is, it's
like anything else in, you know,

746
00:35:44,536 --> 00:35:46,156
I've been doing this a while.

747
00:35:46,156 --> 00:35:51,716
The classic consulting
answer, is it depends,

748
00:35:51,716 --> 00:35:54,606
that's how you start answering
any of those questions, right?

749
00:35:54,966 --> 00:35:56,626
And so, you can take as a skill.

750
00:35:56,626 --> 00:35:57,406
Put that on your resume.

751
00:35:57,896 --> 00:35:58,966
You know how to say
it, it depends.

752
00:35:58,966 --> 00:36:01,226
It just buys you time as you
try to come up with the answer.

753
00:36:01,226 --> 00:36:04,216
So if you're ever in the
consulting situation,

754
00:36:04,216 --> 00:36:05,196
you could start there.

755
00:36:05,456 --> 00:36:05,676
Yes?

756
00:36:06,516 --> 00:36:22,416
[ Inaudible Remark ]

757
00:36:22,916 --> 00:36:25,916
Right. So, you know,
both Windows 8

758
00:36:25,916 --> 00:36:31,586
and Windows Phone have support
for sensors, for obviously touch

759
00:36:31,586 --> 00:36:34,676
and dealing with
accelerometers and gyroscopes,

760
00:36:34,676 --> 00:36:37,216
cameras, those APIs exist.

761
00:36:37,216 --> 00:36:40,486
What's-- When you start to
get into that part of the API,

762
00:36:40,486 --> 00:36:44,336
that's probably where the
majority of differences are

763
00:36:44,336 --> 00:36:46,716
between developing for
Windows 8 and developing

764
00:36:46,716 --> 00:36:48,486
for Windows Phone, 'cause
when you start to get

765
00:36:48,486 --> 00:36:50,656
into hardware-specific
areas like that.

766
00:36:51,026 --> 00:36:55,836
A large percentage of the
capabilities between Windows 8

767
00:36:55,836 --> 00:36:59,256
and Windows Phone are
shared, there's a shared core

768
00:36:59,516 --> 00:37:03,696
which I believe is actually is
a good lead into my next slide.

769
00:37:04,056 --> 00:37:07,796
Between Windows 8 and Windows
Phone, there's a shared core,

770
00:37:08,026 --> 00:37:11,986
probably gets you about
80 percent commonality.

771
00:37:12,346 --> 00:37:14,156
But when you get into
things that are specific

772
00:37:14,156 --> 00:37:16,316
to the hardware, it's just
going to be different.

773
00:37:16,496 --> 00:37:21,816
You know, how you deal
within accelerometers on--

774
00:37:22,036 --> 00:37:26,906
in the Windows Phone space work
that's dealing with the phones

775
00:37:26,906 --> 00:37:33,616
from Nokia, and you know, HTC
and other phone manufacturers.

776
00:37:33,666 --> 00:37:37,386
And then, you know, on Windows,
yes we have a camera, we do,

777
00:37:37,386 --> 00:37:40,646
you know, we handle-- we have
sensor support and so on,

778
00:37:40,646 --> 00:37:43,756
a whole another set
of hardware vendors.

779
00:37:43,996 --> 00:37:47,126
We try to abstract as much
as possible, but that's sort

780
00:37:47,126 --> 00:37:48,436
of where the differences lie.

781
00:37:48,736 --> 00:37:51,976
So again, separation
that concerns is key.

782
00:37:51,976 --> 00:37:54,626
When you're designing how,
at the implementation,

783
00:37:54,626 --> 00:37:55,896
you know that's the
kind of thing you want

784
00:37:55,896 --> 00:37:58,376
to encapsulate a way
into a class library.

785
00:37:58,876 --> 00:38:01,796
Make sure it's something that's
architecturally a little more

786
00:38:01,796 --> 00:38:02,476
plug and play.

787
00:38:03,516 --> 00:38:11,516
[ Inaudible Remark ]

788
00:38:12,016 --> 00:38:12,346
Yes?

789
00:38:14,516 --> 00:38:22,786
[ Inaudible Remark ]

790
00:38:23,286 --> 00:38:25,556
It's a great, great question.

791
00:38:25,556 --> 00:38:28,466
So the question is, if I already
have an app for the browser

792
00:38:28,466 --> 00:38:30,816
and I'm using, let's
say a jQuery

793
00:38:31,146 --> 00:38:33,456
and maybe some other
JavaScript libraries,

794
00:38:33,456 --> 00:38:36,006
can I get that to
run on the Windows 8?

795
00:38:36,276 --> 00:38:37,176
The answer is yes.

796
00:38:38,056 --> 00:38:43,446
So it's their-- well, I
should have started it.

797
00:38:43,446 --> 00:38:44,286
It depends.

798
00:38:44,436 --> 00:38:46,906
Well, the answer is yes.

799
00:38:46,906 --> 00:38:47,656
It will work.

800
00:38:47,856 --> 00:38:50,026
Is it going to be just
move your code over

801
00:38:50,026 --> 00:38:51,316
and hit run and it goes?

802
00:38:51,316 --> 00:38:52,466
No, so what you're going to need

803
00:38:52,466 --> 00:38:56,876
to do is first determine any
third party JavaScript libraries

804
00:38:56,876 --> 00:38:59,406
you're using, do they
work on Windows 8?

805
00:38:59,536 --> 00:39:02,506
Most do, jQuery as an
example, it just works.

806
00:39:02,506 --> 00:39:06,796
If you want to use jQuery for
doing AJAX calls, no problem.

807
00:39:07,146 --> 00:39:11,426
The Microsoft has libraries,
JavaScript libraries

808
00:39:11,426 --> 00:39:13,106
that you bring in
to your project

809
00:39:13,106 --> 00:39:15,416
that give you access
to the WinRT APIs.

810
00:39:16,086 --> 00:39:18,156
So you'll need to add
that into your project.

811
00:39:18,586 --> 00:39:22,746
You need to decide
how do you want to--

812
00:39:23,336 --> 00:39:27,916
where it gets interesting is
dealing with scaling your UI,

813
00:39:27,916 --> 00:39:32,966
so that it, you know,
has the look and feel

814
00:39:32,966 --> 00:39:36,356
in a Chromeless function
on Windows 8, right?

815
00:39:36,356 --> 00:39:39,526
So you might have to adjust
some of your style sheets

816
00:39:39,526 --> 00:39:40,986
and things of that sort.

817
00:39:41,206 --> 00:39:43,686
How do you want to integrate
with Search and Share,

818
00:39:43,686 --> 00:39:45,636
that's calling a
specific Windows API?

819
00:39:45,826 --> 00:39:48,456
You'll do that through
Microsoft JavaScript libraries.

820
00:39:48,836 --> 00:39:51,336
But the third party
libraries for the most part,

821
00:39:51,566 --> 00:39:52,846
we've seen that they just work.

822
00:39:53,446 --> 00:39:56,576
So a lot of them
already test it.

823
00:39:56,576 --> 00:39:57,536
People are already using them.

824
00:39:57,536 --> 00:39:59,326
There's probably a lot of
documentation on the internet,

825
00:39:59,326 --> 00:40:00,906
how that's being used.

826
00:40:01,376 --> 00:40:04,696
So, the story there is
it's a pretty good story.

827
00:40:05,036 --> 00:40:07,786
In fact, a guy in
my team by the name

828
00:40:07,786 --> 00:40:11,096
of Jesse Freeman who's
a really well-known

829
00:40:11,096 --> 00:40:14,986
in the Indie Game Development
circles, he builds games

830
00:40:15,016 --> 00:40:16,276
in HTML5 and JavaScript.

831
00:40:16,826 --> 00:40:20,746
And he actually teaches
students who want to build games

832
00:40:20,746 --> 00:40:21,976
in HTML5 and JavaScript.

833
00:40:21,976 --> 00:40:25,096
He teaches them first to build
it in the browser and then,

834
00:40:25,096 --> 00:40:27,236
the last class, they
move it over to Windows,

835
00:40:27,586 --> 00:40:29,246
they get it running and
they submit it to the store.

836
00:40:29,886 --> 00:40:33,006
So, so he's got it down to a
science on the gaming side.

837
00:40:33,126 --> 00:40:36,756
You're using Canvas or if you're
using, let's say, ImpactJS

838
00:40:37,216 --> 00:40:39,406
or what's another one?

839
00:40:39,406 --> 00:40:42,536
CreateJS is popular for
doing HTML5 game development.

840
00:40:42,536 --> 00:40:44,976
They just work, so.

841
00:40:45,346 --> 00:40:47,996
>> [Inaudible] It's got to be
possible to know that, right?

842
00:40:47,996 --> 00:40:51,426
It's not just fully
innovative view.

843
00:40:52,436 --> 00:40:53,596
It's really native.

844
00:40:54,146 --> 00:40:55,216
>> It's really native.

845
00:40:55,696 --> 00:40:58,936
Where you would want to use
PhoneGap which is, again,

846
00:40:58,936 --> 00:41:02,646
another great choice if
cross platform mobile--

847
00:41:02,646 --> 00:41:05,316
if you are HTML5 and
JavaScript and you want

848
00:41:05,316 --> 00:41:06,916
to make sure you're
going to work

849
00:41:06,916 --> 00:41:10,256
on all the platforms then
PhoneGap is a great choice.

850
00:41:10,846 --> 00:41:13,216
If you want to take
your existing browser,

851
00:41:13,536 --> 00:41:16,136
HTML5 JavaScript browser code
and just get it running native

852
00:41:16,136 --> 00:41:18,776
on Windows, that's another
choice, and you might decide

853
00:41:18,776 --> 00:41:23,416
to do that but then use
PhoneGap for iOS and Android.

854
00:41:23,416 --> 00:41:26,396
So, you-- these are all business
decisions at some point, right?

855
00:41:26,396 --> 00:41:29,376
If you're in a startup, you're
in a company and they're trying

856
00:41:29,376 --> 00:41:31,856
to make decisions on
investing time and money

857
00:41:31,856 --> 00:41:36,046
into building mobile
applications and which platforms

858
00:41:36,046 --> 00:41:39,356
to support, this is exactly
the conversations that go

859
00:41:39,356 --> 00:41:41,636
on in the design meetings.

860
00:41:42,316 --> 00:41:45,436
And so, it's good to kind of
think through those things,

861
00:41:45,436 --> 00:41:48,366
maybe learn all the different
ways to do it as you're doing it

862
00:41:48,366 --> 00:41:50,806
in this class and maybe in
your own copious spare time.

863
00:41:51,156 --> 00:41:53,916
Try out all these
different approaches

864
00:41:53,916 --> 00:41:55,966
and you'll learn a
tremendous amount

865
00:41:56,256 --> 00:41:59,946
about what each platform can do,
what each, you know, framework

866
00:41:59,946 --> 00:42:01,386
or tool like PhoneGap can do.

867
00:42:01,386 --> 00:42:04,766
Where is the gap in
functionality and so,

868
00:42:04,766 --> 00:42:08,036
that's just tremendous value
that you bring to whoever,

869
00:42:08,386 --> 00:42:09,686
you know, future
employer might be.

870
00:42:09,946 --> 00:42:14,796
Differentiated apps, by that
we mean taking advantage

871
00:42:14,796 --> 00:42:16,036
of live tiles, right?

872
00:42:16,356 --> 00:42:22,826
On the phone, you can actually
have your app be available

873
00:42:22,826 --> 00:42:27,536
on the lock screen,
also on Windows 8.

874
00:42:27,536 --> 00:42:30,006
There's a-- the ability to build
applications that take advantage

875
00:42:30,006 --> 00:42:33,366
of the web camera and do things

876
00:42:33,366 --> 00:42:35,356
with the lens, integrated
wallet.

877
00:42:35,356 --> 00:42:37,426
Of course, if you're
a game developer,

878
00:42:37,656 --> 00:42:41,916
there's an opportunity
to be branded Xbox.

879
00:42:42,276 --> 00:42:45,896
All right, so we work with
independent game developers,

880
00:42:45,896 --> 00:42:49,786
game studios and if--
you can always reach

881
00:42:49,786 --> 00:42:52,266
out to the Xbox team
and say, "Hey,

882
00:42:52,266 --> 00:42:53,586
could you take a
look at my game."

883
00:42:53,586 --> 00:42:57,226
And if they like it, they
license it, you get to brand--

884
00:42:57,276 --> 00:43:00,456
you get that nice
little Xbox green bar

885
00:43:00,456 --> 00:43:02,066
across the top of your game.

886
00:43:03,656 --> 00:43:07,476
That will push more
downloads than anything else.

887
00:43:07,476 --> 00:43:10,076
It's that, you know,
that little sort

888
00:43:10,076 --> 00:43:14,526
of "attaboy" from the Xbox team.

889
00:43:14,796 --> 00:43:16,666
So you'll drive a lot
of attention to your app

890
00:43:16,666 --> 00:43:18,976
if it's tagged with Xbox.

891
00:43:19,386 --> 00:43:24,606
So, I'm going to dive back
into Visual Studio in a bit.

892
00:43:24,606 --> 00:43:28,266
What I want to go
over is building apps

893
00:43:28,266 --> 00:43:30,426
that use these Open Data APIs.

894
00:43:30,896 --> 00:43:37,406
We have discovered that mobile
developers who are learning

895
00:43:37,956 --> 00:43:41,316
to build for the various mobile
devices that are out there,

896
00:43:41,316 --> 00:43:43,936
a lot of times, you
need some ideas.

897
00:43:44,006 --> 00:43:47,686
And Open Data APIs
provide you a ton of ideas.

898
00:43:47,686 --> 00:43:48,316
Let me just-- I don't know

899
00:43:48,316 --> 00:43:49,686
if you've ever been
out to this site.

900
00:43:50,276 --> 00:43:57,186
Let me go to apihub.com.

901
00:43:58,136 --> 00:44:03,256
You go to apihub.com
and you could search

902
00:44:03,256 --> 00:44:04,926
or you could browse by category.

903
00:44:05,496 --> 00:44:08,316
You know, they've got

904
00:44:08,316 --> 00:44:11,936
over 13,000 Open Data
APIs registered here.

905
00:44:12,246 --> 00:44:13,926
So if you're looking for data,

906
00:44:13,926 --> 00:44:17,146
because the data is really what
makes an app interesting, right?

907
00:44:17,896 --> 00:44:21,636
And so, if you're interested in
building an app for healthcare

908
00:44:21,636 --> 00:44:24,636
or education, or you know,
you want to use, you know,

909
00:44:24,636 --> 00:44:26,766
government data, you want to--

910
00:44:26,846 --> 00:44:31,696
you know, you want to integrate
maps into your Mashup App,

911
00:44:32,246 --> 00:44:33,576
this is the place to go

912
00:44:33,576 --> 00:44:35,976
and at least get started finding
what you're interested in.

913
00:44:35,976 --> 00:44:39,996
So, I want to build an
educational application.

914
00:44:40,246 --> 00:44:44,146
I want to use REST protocol.

915
00:44:44,256 --> 00:44:47,916
I'd like it to return
JSON because that's--

916
00:44:47,916 --> 00:44:49,146
and there I've got, you know,

917
00:44:49,146 --> 00:44:50,926
I've got the Khan
Academy has an API.

918
00:44:51,736 --> 00:44:57,036
DonorsChoose API, Google Books
API, TED API, hey-- I'll start--

919
00:44:57,036 --> 00:45:00,396
you're starting to
get some great ideas.

920
00:45:00,646 --> 00:45:02,386
Yeah, I'd like to
build a TED app, right?

921
00:45:02,386 --> 00:45:08,026
So, maybe I want to mash that
up with Bing Maps or Google Maps

922
00:45:08,026 --> 00:45:09,026
or something like that, right?

923
00:45:09,026 --> 00:45:11,196
You create a really
interesting application.

924
00:45:11,816 --> 00:45:14,046
The data is what
makes it interesting.

925
00:45:14,896 --> 00:45:18,576
So, learning how to develop

926
00:45:18,576 --> 00:45:22,496
against these Open Data APIs is
another very marketable skill.

927
00:45:23,516 --> 00:45:25,726
[ Pause ]

928
00:45:26,226 --> 00:45:28,376
Once you've identified--
where do I [inaudible].

929
00:45:29,106 --> 00:45:32,796
Let's go here to Mashery.

930
00:45:33,326 --> 00:45:35,846
Mashery is a partner of ours.

931
00:45:37,376 --> 00:45:42,226
They-- there was
called an API curator.

932
00:45:43,746 --> 00:45:45,636
Go ahead and sign in.

933
00:45:46,516 --> 00:45:51,456
[ Pause ]

934
00:45:51,956 --> 00:45:54,166
They've got over 50 APIs

935
00:45:54,166 --> 00:45:57,566
that they helped
customers build and host.

936
00:45:58,546 --> 00:46:02,586
And one of the ones that I've
worked with is Rotten Tomatoes.

937
00:46:03,406 --> 00:46:04,656
So I've just logged in.

938
00:46:05,066 --> 00:46:06,736
You can see all the
different API keys I have.

939
00:46:06,736 --> 00:46:09,016
So once you start to work
with these Open Data APIs,

940
00:46:09,016 --> 00:46:10,566
there's some things
you need to know about.

941
00:46:12,316 --> 00:46:14,646
them. Many of them require
you to get a developer key.

942
00:46:14,646 --> 00:46:15,986
It usually doesn't
cost anything.

943
00:46:15,986 --> 00:46:18,146
You just have to register
and then they give you a key.

944
00:46:18,486 --> 00:46:22,006
So, for example, if I go to
the dynamic documentation here

945
00:46:22,006 --> 00:46:24,366
for Rotten Tomatoes, which
is movie information,

946
00:46:24,606 --> 00:46:27,696
I've logged in so they
know what my key is

947
00:46:27,696 --> 00:46:29,636
and I've just selected
my developer key.

948
00:46:29,966 --> 00:46:33,316
And now I can use
this API Explorer

949
00:46:33,316 --> 00:46:34,266
which is in the browser.

950
00:46:34,466 --> 00:46:38,316
It's just a browser app and I
can say, "OK, I'm interested

951
00:46:38,316 --> 00:46:41,036
in building an app using
the "In Theaters Data".

952
00:46:41,036 --> 00:46:42,476
Let me go ahead and try it.

953
00:46:42,586 --> 00:46:44,366
I want to see how this works.

954
00:46:44,866 --> 00:46:50,676
So I try it out and what
I see is-- zoom in here.

955
00:46:51,216 --> 00:46:57,956
You can actually see what
the API that they just fired,

956
00:46:57,956 --> 00:47:01,946
what it looks like, it's a URL
and it's got some parameters

957
00:47:01,946 --> 00:47:05,016
on it and it ends
with my developer key

958
00:47:05,386 --> 00:47:07,856
so they know who's
making this call.

959
00:47:08,426 --> 00:47:08,896
And--

960
00:47:10,516 --> 00:47:13,796
[ Pause ]

961
00:47:14,296 --> 00:47:17,826
-- they send you back, you
know, what the data would look

962
00:47:17,826 --> 00:47:19,226
like which is right here.

963
00:47:19,796 --> 00:47:21,786
So again, I'll zoom in so we
can see it a little better.

964
00:47:23,336 --> 00:47:27,346
This is the data coming back
and it's coming back as JSON,

965
00:47:27,586 --> 00:47:29,146
JavaScript Object Notation.

966
00:47:30,076 --> 00:47:31,396
So, why does it do that?

967
00:47:32,266 --> 00:47:38,256
Well, APIs that are on the
internet are architected

968
00:47:38,256 --> 00:47:40,106
to return very chunky data.

969
00:47:41,226 --> 00:47:43,486
Think of this, if you wanted
to write an app that went

970
00:47:43,486 --> 00:47:48,366
and built a list of movies
that someone could go see

971
00:47:48,366 --> 00:47:51,656
in a theater, would you want
to make a call and say, "OK,

972
00:47:51,656 --> 00:47:53,506
give a movie," and
that's one call.

973
00:47:53,506 --> 00:47:55,256
Now, make another call,
give me the second movie.

974
00:47:55,976 --> 00:47:57,426
Now, give me the third
movie, and you're doing

975
00:47:57,426 --> 00:48:00,556
that on the internet and you
know how internet connectivity

976
00:48:01,216 --> 00:48:04,326
is, you know, only
at the very beginning

977
00:48:04,326 --> 00:48:06,136
of what the capabilities
of that are

978
00:48:06,486 --> 00:48:08,046
from an infrastructure
perspective.

979
00:48:08,336 --> 00:48:10,076
It's not always perfect.

980
00:48:10,076 --> 00:48:11,016
It's not always fast.

981
00:48:11,916 --> 00:48:12,916
It's not always there.

982
00:48:13,506 --> 00:48:16,546
So, chunky data makes
a lot more sense.

983
00:48:16,586 --> 00:48:22,536
Go get me 16 movies, all right,
at a time or 20 movies at a time

984
00:48:22,716 --> 00:48:24,676
and not only that, not
just the name of the movie,

985
00:48:24,676 --> 00:48:28,206
give me the title,
the year, the rating.

986
00:48:28,556 --> 00:48:30,786
Give me critics' consensus.

987
00:48:31,206 --> 00:48:32,366
Give me the release date.

988
00:48:32,736 --> 00:48:34,176
Give me a synopsis.

989
00:48:34,176 --> 00:48:36,546
Give me movie poster thumbnails.

990
00:48:36,986 --> 00:48:39,296
So, it's pulling back
a ton of information.

991
00:48:39,296 --> 00:48:41,636
Who are all the actors
in the film, right?

992
00:48:41,636 --> 00:48:42,876
That's chunky data.

993
00:48:43,136 --> 00:48:48,096
That way, you can make one
API call on this, you know,

994
00:48:48,096 --> 00:48:51,516
not very reliable
internet connection.

995
00:48:52,126 --> 00:48:55,076
Get back a lot of data
and now use it in the app.

996
00:48:56,116 --> 00:48:57,386
That makes a lot more sense.

997
00:48:57,736 --> 00:48:58,826
So, this is the classic,

998
00:48:58,826 --> 00:49:01,946
they used to call it
chunky versus chatty, right?

999
00:49:02,536 --> 00:49:05,046
We want our Open Data
APIs to be chunky.

1000
00:49:05,506 --> 00:49:06,796
Another thing you
need to be aware

1001
00:49:06,796 --> 00:49:10,866
of about these APIs is they
are sometimes throttled,

1002
00:49:11,436 --> 00:49:16,136
which means the folks who
are hosting these APIs

1003
00:49:16,506 --> 00:49:18,476
and they're providing
all these data for free,

1004
00:49:18,476 --> 00:49:20,986
you get a developer key
but they might tell you,

1005
00:49:20,986 --> 00:49:24,416
you can only make two calls
per second and no more

1006
00:49:24,416 --> 00:49:26,196
than 10,000 calls a day.

1007
00:49:26,706 --> 00:49:28,236
That might be one
level of threshold.

1008
00:49:28,736 --> 00:49:31,306
Another one might be
you can make, you know,

1009
00:49:31,306 --> 00:49:34,006
five calls per second
but you're limited

1010
00:49:34,006 --> 00:49:35,136
to a hundred calls a day.

1011
00:49:35,136 --> 00:49:37,536
And if you want to do more
than a hundred calls a day,

1012
00:49:37,536 --> 00:49:38,796
you need to pay us, right?

1013
00:49:39,036 --> 00:49:42,556
So there're those kinds
of scenarios as well.

1014
00:49:42,916 --> 00:49:46,666
So do your research into the
APIs you're interested in using,

1015
00:49:46,926 --> 00:49:50,446
determine if they are
bottlenecked in anyway,

1016
00:49:50,446 --> 00:49:51,996
there's a threshold, a cap.

1017
00:49:52,436 --> 00:49:53,126
Is there a cost?

1018
00:49:53,316 --> 00:49:56,866
You know, what do you have
to do to get a developer key?

1019
00:49:57,566 --> 00:49:59,456
But then, once you figured
that out, you say, yeah,

1020
00:49:59,456 --> 00:50:00,856
this is a reasonable API.

1021
00:50:01,096 --> 00:50:01,786
It's open.

1022
00:50:01,786 --> 00:50:02,396
It's free.

1023
00:50:02,396 --> 00:50:03,816
It's not throttled, you know.

1024
00:50:03,956 --> 00:50:07,056
I can build an app and I can get
a thousand people using my app

1025
00:50:07,456 --> 00:50:09,336
and all calling that API
and I shouldn't have,

1026
00:50:09,336 --> 00:50:10,976
I shouldn't exceed
any threshold.

1027
00:50:11,066 --> 00:50:16,106
That's kind of where you want
to be to leverage these APIs.

1028
00:50:16,236 --> 00:50:17,406
So, I found my API.

1029
00:50:18,276 --> 00:50:21,206
I'm happy with the
threshold limit.

1030
00:50:21,546 --> 00:50:22,616
Now I want to build an app.

1031
00:50:23,516 --> 00:50:30,246
[ Pause ]

1032
00:50:30,746 --> 00:50:32,776
So, the place to start.

1033
00:50:33,516 --> 00:50:35,646
[ Pause ]

1034
00:50:36,146 --> 00:50:38,156
When I go ahead and
run this application,

1035
00:50:38,156 --> 00:50:39,496
at least you'll see
what it looks like.

1036
00:50:39,496 --> 00:50:41,486
Then I'm going to come back
and we'll walk through it.

1037
00:50:41,486 --> 00:50:42,996
We'll probably set
some breakpoints.

1038
00:50:43,786 --> 00:50:45,456
So, another thing I'm
pointing out here,

1039
00:50:45,656 --> 00:50:48,416
this is the Windows 8 emulator.

1040
00:50:48,416 --> 00:50:52,736
So this is another way to run
and debug your Windows 8 app

1041
00:50:52,736 --> 00:50:54,476
so we have a phone emulator,

1042
00:50:54,476 --> 00:50:58,686
we also have a tablet emulator
that's built into the tools.

1043
00:50:58,866 --> 00:50:59,946
So, you can run the app.

1044
00:50:59,946 --> 00:51:02,196
I could run this app
locally on my machine

1045
00:51:02,376 --> 00:51:05,936
but I could also test
it in this simulator.

1046
00:51:06,196 --> 00:51:11,356
So again, I can make sure
that I could simulate touch

1047
00:51:11,356 --> 00:51:12,946
and I could change
the resolution.

1048
00:51:12,946 --> 00:51:16,796
That's another nice
feature of this.

1049
00:51:17,016 --> 00:51:20,476
Windows runs on a lot
of different devices.

1050
00:51:20,476 --> 00:51:22,366
You want to make sure that
if you're building an app

1051
00:51:22,366 --> 00:51:26,676
for Windows that it will work
on anything from the size

1052
00:51:26,676 --> 00:51:28,426
of a surface all the
way up, you know,

1053
00:51:28,426 --> 00:51:29,496
to one of these, all right?

1054
00:51:29,956 --> 00:51:33,436
So, built into the
simulator is the ability

1055
00:51:33,436 --> 00:51:36,746
to change the screen resolution
so you could actually see

1056
00:51:36,746 --> 00:51:38,956
if your layout is
working regardless

1057
00:51:38,956 --> 00:51:41,466
of what monitor the user
happens to be using.

1058
00:51:41,466 --> 00:51:43,046
So, here I am.

1059
00:51:43,046 --> 00:51:47,036
I just made that API
call to Rotten Tomatoes

1060
00:51:47,386 --> 00:51:50,646
and I got back a bunch of
movies which are in theaters

1061
00:51:51,256 --> 00:51:55,716
and I could select one of
those movies and now I can see,

1062
00:51:55,716 --> 00:51:58,956
you know, before I got a
thumbnail of the poster, now,

1063
00:51:58,956 --> 00:52:01,456
I can actually see
this movie poster

1064
00:52:01,776 --> 00:52:04,066
and I'm getting a
synopsis and the rating

1065
00:52:04,066 --> 00:52:04,906
and the audience score.

1066
00:52:04,906 --> 00:52:07,626
So I didn't have-- I pulled that
data all the way back, right?

1067
00:52:07,626 --> 00:52:08,966
So, it came back.

1068
00:52:09,266 --> 00:52:10,276
It's in my app.

1069
00:52:10,276 --> 00:52:11,656
I'm now running-- you know,

1070
00:52:11,656 --> 00:52:13,476
working with this data
completely locally

1071
00:52:13,476 --> 00:52:14,216
on the device.

1072
00:52:14,516 --> 00:52:16,436
And I can say, now I'm
interested in some reviews.

1073
00:52:16,676 --> 00:52:18,606
Now, I'm going back
out to the internet.

1074
00:52:18,826 --> 00:52:21,586
As soon as I said, I want to,
you know, look at some reviews

1075
00:52:21,586 --> 00:52:28,306
of this movie, what Rotten
Tomatoes gave me back was a link

1076
00:52:28,406 --> 00:52:33,436
to another API that I can
invoke to get a list of reviews.

1077
00:52:33,966 --> 00:52:37,436
And then, for each review,
now it's actually a webpage.

1078
00:52:37,916 --> 00:52:40,656
So I'm trying to connect
to the New Yorker right now

1079
00:52:41,186 --> 00:52:43,956
and hopefully, that will
come up in a second.

1080
00:52:44,096 --> 00:52:46,746
But I can see the
list of reviews here

1081
00:52:47,386 --> 00:52:50,636
on the left hand side then I
can actually read the review

1082
00:52:50,636 --> 00:52:54,176
of the Despicable Me now in
the New Yorker, all right?

1083
00:52:54,176 --> 00:52:55,596
So that's what the app does.

1084
00:52:56,516 --> 00:53:03,096
[ Pause ]

1085
00:53:03,596 --> 00:53:08,636
So the way I built
this app is I--

1086
00:53:08,636 --> 00:53:10,696
one of the nice things
about Rotten Tomatoes,

1087
00:53:11,936 --> 00:53:16,126
they actually give you nine
different APIs that you can use.

1088
00:53:17,116 --> 00:53:19,176
The way they design them
though is pretty clever.

1089
00:53:19,366 --> 00:53:23,006
Every API returns the
same format of data.

1090
00:53:23,486 --> 00:53:25,496
So this is an interesting thing.

1091
00:53:25,496 --> 00:53:27,416
Another interesting thing you'll
find when you start to dig

1092
00:53:27,416 --> 00:53:32,016
into these Open Data APIs,
some of them are well designed,

1093
00:53:32,806 --> 00:53:36,526
some of them are not, or
some of them just have--

1094
00:53:36,526 --> 00:53:39,576
they weren't able to do
something maybe based

1095
00:53:39,576 --> 00:53:40,606
on the data they're returning.

1096
00:53:40,606 --> 00:53:43,576
That is as clean as this.

1097
00:53:44,056 --> 00:53:46,716
So each one of these APIs
and I've got them documented

1098
00:53:46,716 --> 00:53:50,196
in my code returns
the same structure.

1099
00:53:50,196 --> 00:53:52,096
It's a list of movies
as you saw before

1100
00:53:52,096 --> 00:53:53,846
in that JSON that I showed you.

1101
00:53:54,206 --> 00:53:59,246
I've also written a sample
app that uses Edmunds which is

1102
00:53:59,246 --> 00:54:00,926
if you've ever been
to Edmunds.com,

1103
00:54:01,186 --> 00:54:02,846
that's where you
can go look up new

1104
00:54:02,846 --> 00:54:04,926
and used car information, right?

1105
00:54:04,926 --> 00:54:06,296
So they have a developer API.

1106
00:54:07,096 --> 00:54:10,016
Their developer API is one of
the most complex that I've seen

1107
00:54:10,526 --> 00:54:13,496
because they have a vehicle
API, they have a dealer API,

1108
00:54:13,786 --> 00:54:20,036
they have a deals API and they
have, I believe, a reviews API.

1109
00:54:20,036 --> 00:54:23,466
And then, so each one of those
APIs is actually a collection

1110
00:54:23,466 --> 00:54:26,296
of calls and each one
of their calls returns a

1111
00:54:26,296 --> 00:54:27,286
different format.

1112
00:54:27,836 --> 00:54:30,626
So you actually have to
study each individual API

1113
00:54:31,356 --> 00:54:33,986
and determine what the
structure of it is to be able

1114
00:54:33,986 --> 00:54:34,686
to deal with the data.

1115
00:54:35,016 --> 00:54:37,866
So again, just be aware of that.

1116
00:54:38,086 --> 00:54:43,276
So, I have defined the
APIs for Rotten Tomatoes.

1117
00:54:43,526 --> 00:54:44,886
I've got them all
defined in here

1118
00:54:44,886 --> 00:54:48,556
so I can actually change
this application to not show

1119
00:54:48,556 --> 00:54:49,786
in theaters information.

1120
00:54:49,786 --> 00:54:52,616
I could change it to
show DVD top rentals.

1121
00:54:53,236 --> 00:54:54,176
So, how would I do that?

1122
00:54:55,516 --> 00:55:04,376
[ Pause ]

1123
00:55:04,876 --> 00:55:07,696
Well, let's see, the best
way to understand this is

1124
00:55:07,696 --> 00:55:09,686
to probably set a
few breakpoints.

1125
00:55:12,336 --> 00:55:13,886
So let's see, we're going

1126
00:55:13,886 --> 00:55:20,806
to set a breakpoint right
there, and right there.

1127
00:55:20,806 --> 00:55:24,516
So this is the point in code
where I'm actually going

1128
00:55:24,516 --> 00:55:27,916
to invoke the In Theaters API.

1129
00:55:28,736 --> 00:55:32,656
It's defined as a string.

1130
00:55:33,086 --> 00:55:36,896
The next thing that
happens is we take that

1131
00:55:36,896 --> 00:55:42,816
and we use an object in
the Win RT class library

1132
00:55:42,816 --> 00:55:44,456
called HttpClient.

1133
00:55:45,746 --> 00:55:48,566
That's the class that
allows me to invoke a URL.

1134
00:55:49,346 --> 00:55:54,986
So I simply instantiate that
and I call the GetStringAsync

1135
00:55:54,986 --> 00:55:56,876
that makes that API call.

1136
00:55:57,196 --> 00:55:58,746
We'll set a breakpoint
here as well

1137
00:55:58,746 --> 00:55:59,936
so we can see what comes back.

1138
00:56:00,996 --> 00:56:03,156
The next thing I do-- now
remember that comes back

1139
00:56:03,156 --> 00:56:05,426
as JavaScript object notation.

1140
00:56:05,976 --> 00:56:10,636
It's going to come back as
a string, a giant string

1141
00:56:11,086 --> 00:56:13,386
that has all that movie
information on it.

1142
00:56:14,046 --> 00:56:16,346
So how do I deal with
it in my application?

1143
00:56:16,816 --> 00:56:18,696
The first step I have to
do is just something called

1144
00:56:18,696 --> 00:56:22,716
deserialization and there's a
library that does it for me.

1145
00:56:23,176 --> 00:56:26,356
It takes that string and
it will deserialize it

1146
00:56:26,356 --> 00:56:28,916
into an object model
in memory for me.

1147
00:56:29,456 --> 00:56:31,706
So, the only extra work I had

1148
00:56:31,706 --> 00:56:34,336
to do is actually define
what that object model is.

1149
00:56:34,636 --> 00:56:37,176
Well there are tools that do
that for you automatically.

1150
00:56:37,176 --> 00:56:38,826
So you don't have to
necessarily write that code.

1151
00:56:38,826 --> 00:56:43,436
But once that code is generated,
you end up with a class

1152
00:56:43,436 --> 00:56:45,236
that looks something like this.

1153
00:56:45,236 --> 00:56:51,206
So I've got Rotten Tomatoes
movies, has a collection

1154
00:56:51,206 --> 00:56:56,496
of type movie and a movie is
made up of an ID and a title

1155
00:56:56,496 --> 00:56:59,036
and a year and a
rating and a run-time.

1156
00:56:59,036 --> 00:57:01,426
This is as all that
same information you saw

1157
00:57:01,426 --> 00:57:03,046
in the JSON, right?

1158
00:57:03,316 --> 00:57:06,386
But now it's represented
as a C# class.

1159
00:57:07,526 --> 00:57:11,366
And so the deserialization
process takes the string of JSON

1160
00:57:11,806 --> 00:57:16,106
and turns it into a
run-time object model based

1161
00:57:16,106 --> 00:57:18,086
on this class structure here.

1162
00:57:18,966 --> 00:57:21,476
One line of code
does that, all right?

1163
00:57:21,526 --> 00:57:23,166
You simply have to have
the class to define

1164
00:57:23,166 --> 00:57:24,976
and there are tools
that generate it for you

1165
00:57:25,406 --> 00:57:29,346
and it's this line
of code right there

1166
00:57:29,716 --> 00:57:34,836
that actually does
the work, all right,

1167
00:57:34,836 --> 00:57:36,886
so we'll walk through that.

1168
00:57:36,886 --> 00:57:42,906
Now when a-- remember we're
using Model View ViewModel,

1169
00:57:42,906 --> 00:57:43,246
right?

1170
00:57:43,246 --> 00:57:46,736
But what I get back from Rotten
Tomatoes is not a ViewModel,

1171
00:57:46,766 --> 00:57:47,886
it's a data model.

1172
00:57:49,726 --> 00:57:52,256
So now that I have all
this movie information,

1173
00:57:52,256 --> 00:57:56,186
it's extremely rich, it's more
information than I want to put

1174
00:57:56,186 --> 00:58:00,286
on the screen and it's not
in the format that's bindable

1175
00:58:00,286 --> 00:58:02,296
to the user interface controls.

1176
00:58:02,356 --> 00:58:06,526
So I have to map from the data
model to a ViewModel and then

1177
00:58:06,526 --> 00:58:08,996
after that one line of
code binds it to the UI.

1178
00:58:10,086 --> 00:58:13,436
So I have to define
my ViewModel.

1179
00:58:15,776 --> 00:58:18,046
So a ViewModel would
look something like this.

1180
00:58:18,446 --> 00:58:19,186
It's a movie.

1181
00:58:19,186 --> 00:58:20,866
Well, and this is the
reviews, let me scroll down,

1182
00:58:20,866 --> 00:58:23,146
I'll get to the movie,
information will start there.

1183
00:58:24,526 --> 00:58:25,666
I have a movie item.

1184
00:58:26,466 --> 00:58:28,856
It's derived from
this base class.

1185
00:58:28,856 --> 00:58:30,556
Now what-- why is that?

1186
00:58:30,556 --> 00:58:32,786
Let me scroll up because I
scrolled passed it already.

1187
00:58:34,676 --> 00:58:37,916
On Windows, what makes
a class bindable is

1188
00:58:37,916 --> 00:58:41,006
that it implements the interface
INotifyPropertyChanged.

1189
00:58:41,356 --> 00:58:46,326
Model View ViewModel means that
you put your data in the form

1190
00:58:46,326 --> 00:58:49,626
of a ViewModel, you bind
it to the UI control,

1191
00:58:49,626 --> 00:58:51,806
it could be a list view,
it could be a drop down,

1192
00:58:51,806 --> 00:58:55,616
a combo box, a grid
control, something like that.

1193
00:58:55,616 --> 00:58:58,696
If the user interacts
with it and changes it,

1194
00:58:59,276 --> 00:59:02,426
you want your ViewModel
to be notified

1195
00:59:02,686 --> 00:59:04,176
that the data has changed.

1196
00:59:04,646 --> 00:59:08,146
If your program changes
the ViewModel,

1197
00:59:08,146 --> 00:59:13,096
you want the Model View to be
notified that the data's changed

1198
00:59:13,096 --> 00:59:14,176
and update automatically.

1199
00:59:14,616 --> 00:59:18,156
All of that machinery of
keeping the Model View in synch

1200
00:59:18,156 --> 00:59:20,646
with the View Model,
the Model View in sync

1201
00:59:20,646 --> 00:59:24,626
with the View Model, is handled
automatically by the platform,

1202
00:59:25,336 --> 00:59:28,836
whether your HTML 5 and
JavaScript or your C# XAML,

1203
00:59:28,996 --> 00:59:30,956
C++ that's handled
automatically.

1204
00:59:32,136 --> 00:59:34,296
You simply have to derive
from the right, you know,

1205
00:59:34,296 --> 00:59:35,356
implement the right interface.

1206
00:59:35,356 --> 00:59:37,556
In this case it's
INotifyPropertyChanged.

1207
00:59:37,966 --> 00:59:41,276
And there's the implementation.

1208
00:59:41,586 --> 00:59:45,096
So now that that's implemented,
I can now derive classes

1209
00:59:45,096 --> 00:59:49,646
from this base class that are
my ViewModel and that's all

1210
00:59:49,646 --> 00:59:52,836
that that's going on in this
particular file right here.

1211
00:59:52,836 --> 00:59:57,676
So if I come down, where was I?

1212
00:59:57,676 --> 00:59:58,866
Movie item, all right?

1213
01:00:00,406 --> 01:00:05,706
So here's my movie item that's
bindable and it simply got--

1214
01:00:05,706 --> 01:00:09,466
it defines the data that I want
to be able to put on the screen

1215
01:00:09,466 --> 01:00:12,016
and then accessors,
get and set accessors.

1216
01:00:12,816 --> 01:00:14,916
That's it, very straight
forward code.

1217
01:00:15,436 --> 01:00:21,266
And I'm being instant message
by someone out at corporate.

1218
01:00:21,266 --> 01:00:23,736
So I'll just ignore that.

1219
01:00:24,616 --> 01:00:27,776
So let's see, so
that's the ViewModel.

1220
01:00:28,626 --> 01:00:32,306
The last thing I want to show
you is, OK, now every thing's

1221
01:00:32,306 --> 01:00:34,786
in the ViewModel
then what happens?

1222
01:00:36,956 --> 01:00:39,736
Well, when that call returns
all the way back up to the--

1223
01:00:39,736 --> 01:00:42,366
to my user interface layer,
I'm going to end up here

1224
01:00:42,896 --> 01:00:44,716
in the response from the call.

1225
01:00:45,256 --> 01:00:46,616
I'm going to get the data.

1226
01:00:46,756 --> 01:00:49,956
I'm going to copy it from the
data model to the ViewModel

1227
01:00:50,196 --> 01:00:58,216
and this is the line of code
that binds it to the UI.

1228
01:00:58,406 --> 01:01:00,436
We take all the movie data

1229
01:01:00,436 --> 01:01:04,606
and we simply say it's the
default ViewModel for this--

1230
01:01:05,086 --> 01:01:12,386
let me bring up this
particular UI layout

1231
01:01:12,386 --> 01:01:13,706
which is implemented in XAML.

1232
01:01:14,516 --> 01:01:22,936
[ Pause ]

1233
01:01:23,436 --> 01:01:25,446
There's the binding
definition right there,

1234
01:01:26,336 --> 01:01:27,346
collection view source.

1235
01:01:28,096 --> 01:01:30,396
So that's one of
the nice features

1236
01:01:30,396 --> 01:01:33,636
about the platform is
a lot of that plumbing,

1237
01:01:33,636 --> 01:01:37,616
all that capability that
you expect these types

1238
01:01:37,616 --> 01:01:41,516
of applications to have it's
build into the framework,

1239
01:01:41,686 --> 01:01:43,986
the class libraries that
we provide in Win RT.

1240
01:01:43,986 --> 01:01:46,436
You just need to know
how to wire it up.

1241
01:01:47,196 --> 01:01:48,956
When dealing with
open data APIs.

1242
01:01:49,156 --> 01:01:50,666
You're going to make
a call, you're going

1243
01:01:50,666 --> 01:01:52,336
to get back that string of JSON.

1244
01:01:52,336 --> 01:01:55,186
You're going to deserialize
it into a data model.

1245
01:01:55,566 --> 01:01:58,686
You're going to map the
data model to a ViewModel

1246
01:01:59,106 --> 01:02:02,976
and then simply-- and then your
binding code will pick up after

1247
01:02:02,976 --> 01:02:03,916
that and you've got
it on the screen.

1248
01:02:04,516 --> 01:02:11,886
[ Pause ]

1249
01:02:12,386 --> 01:02:16,876
Now, I wanted to show an
app that was built that way,

1250
01:02:17,446 --> 01:02:19,706
but it's in an HTML
5 and JavaScript.

1251
01:02:20,206 --> 01:02:25,346
Now, this is not my code, I'm
going to do my best to try

1252
01:02:25,346 --> 01:02:35,096
to at least point out a couple
of interesting parts here.

1253
01:02:35,386 --> 01:02:40,856
Interesting in JavaScript
that whole, you know,

1254
01:02:41,936 --> 01:02:47,356
invoking the API and getting
back that string of JSON

1255
01:02:47,356 --> 01:02:49,406
that doesn't happen
in JavaScript, why?

1256
01:02:49,406 --> 01:02:51,536
It's coming back in
JavaScript logic notation.

1257
01:02:51,956 --> 01:02:54,476
So the nice thing about
calling these APIs

1258
01:02:54,476 --> 01:02:57,826
from JavaScript is you get back
an object model by default.

1259
01:02:58,076 --> 01:03:01,066
In C#, I have to map the
string to an object model.

1260
01:03:01,066 --> 01:03:03,346
So it's one extra step
in the implementation.

1261
01:03:04,066 --> 01:03:09,036
So here's an example of invoking
the Meetup API in JavaScript.

1262
01:03:09,036 --> 01:03:10,536
Let's see if I can
find the call.

1263
01:03:11,516 --> 01:03:14,546
[ Pause ]

1264
01:03:15,046 --> 01:03:17,466
I'll make sure I'm
in the right places

1265
01:03:17,466 --> 01:03:19,016
and so this is not
my code, here we go.

1266
01:03:20,056 --> 01:03:21,516
Get upcoming meetings.

1267
01:03:22,906 --> 01:03:26,706
So here's the API call that we
want to make in our app, right?

1268
01:03:26,706 --> 01:03:28,856
It's in-- it's just a URL.

1269
01:03:29,346 --> 01:03:34,656
And we're setting
up the parameters

1270
01:03:35,126 --> 01:03:39,576
and this is the built-in--
you could use, obviously,

1271
01:03:40,256 --> 01:03:43,826
you could use jQuery to
do this using Ajax call.

1272
01:03:43,826 --> 01:03:47,626
But if you're using the Win RT
JavaScript libraries you can

1273
01:03:47,626 --> 01:03:49,736
just use WinJS.xhr.

1274
01:03:50,566 --> 01:03:53,556
You give it the URL,
the response type,

1275
01:03:53,556 --> 01:03:57,676
and then of course what
code follows is the code

1276
01:03:57,676 --> 01:04:00,586
that is going to deal
with the response.

1277
01:04:00,586 --> 01:04:05,586
So you can see we're just
dropping into a foreach loop

1278
01:04:05,586 --> 01:04:07,176
and then we're just
gathering the info--

1279
01:04:07,176 --> 01:04:09,086
he's just gathering the
information about each

1280
01:04:09,086 --> 01:04:13,626
of the Meetups and he's putting
it into the right collections

1281
01:04:13,936 --> 01:04:18,256
that will be bound to the UI
controls is exactly the same

1282
01:04:18,256 --> 01:04:21,166
pattern that we did
in C# and XAML

1283
01:04:21,546 --> 01:04:26,206
but this is just using HTML 5
controls, CSS, and JavaScript

1284
01:04:26,206 --> 01:04:27,206
to do the implementation.

1285
01:04:27,656 --> 01:04:29,976
If I go ahead and run this--

1286
01:04:30,516 --> 01:04:36,476
[ Pause ]

1287
01:04:36,976 --> 01:04:42,636
Here we go, so he's gotten back
Meetups near Boston filtered

1288
01:04:42,636 --> 01:04:44,346
by keyword JavaScript.

1289
01:04:45,856 --> 01:04:49,586
And if I click on one of
this it gives me a nice map

1290
01:04:50,126 --> 01:04:52,426
and is also going
out and he's using,

1291
01:04:52,426 --> 01:04:53,836
this is a feature of Bing Maps.

1292
01:04:53,976 --> 01:04:57,746
So he's-- he is going to mash
up between Meetup and Bing.

1293
01:04:58,626 --> 01:05:04,416
And so the Bing Map is showing
you all of the coffee shops

1294
01:05:04,866 --> 01:05:09,396
that are near where the Meetup
is happening, all right.

1295
01:05:09,616 --> 01:05:12,376
And so Bing has points
of interest API.

1296
01:05:13,116 --> 01:05:15,286
So once you have the
geolocation of the Meetup,

1297
01:05:15,286 --> 01:05:16,946
Meetup will give
you a longitude,

1298
01:05:16,946 --> 01:05:20,906
latitude for the Meetup, you
can use that with Bing to say,

1299
01:05:20,906 --> 01:05:23,026
give me back a list
of points of interest.

1300
01:05:23,646 --> 01:05:25,326
And so that's the mash
up he's doing here.

1301
01:05:25,706 --> 01:05:29,426
So again, interesting data makes
for interesting applications.

1302
01:05:30,516 --> 01:05:35,586
[ Pause ]

1303
01:05:36,086 --> 01:05:40,906
And the last thing I'll show you
before I go into the last part

1304
01:05:40,906 --> 01:05:50,636
of the talk here is--
that same pattern,

1305
01:05:51,126 --> 01:05:53,746
same capability is
available on Windows phone

1306
01:05:53,956 --> 01:05:55,746
because I told you I
did an implementation

1307
01:05:55,746 --> 01:05:57,996
for Edmunds, car data.

1308
01:05:58,386 --> 01:06:00,376
So that's what this
application is doing.

1309
01:06:00,726 --> 01:06:02,016
It's going to go out to Edmunds.

1310
01:06:02,016 --> 01:06:10,726
It's going to get first
a list of makes Acura,

1311
01:06:10,726 --> 01:06:13,236
Aston Martin, Audi and so on.

1312
01:06:14,576 --> 01:06:17,476
And if I'm interested in
Audis I can click that

1313
01:06:17,476 --> 01:06:21,046
and I'll get a list of the
models, so that came back

1314
01:06:21,636 --> 01:06:24,376
from Edmunds, and I say, you
know, I'm interested in A8.

1315
01:06:24,376 --> 01:06:26,886
It's then going to show me--

1316
01:06:26,886 --> 01:06:30,866
hopefully it will go back out
to Edmunds and get me the images

1317
01:06:31,256 --> 01:06:37,576
of an Audi A8 so I can
salivate over them.

1318
01:06:37,796 --> 01:06:41,796
My ultimate goal is to start
a transportation business

1319
01:06:41,796 --> 01:06:44,576
like Jason Statham that's
just a dream of mine

1320
01:06:45,376 --> 01:06:46,706
to be a transporter so anyway.

1321
01:06:46,706 --> 01:06:49,826
You have to know that movie
I guess to get the joke.

1322
01:06:50,186 --> 01:06:50,626
No problem.

1323
01:06:52,066 --> 01:06:56,206
So we have the same capability
in Windows phone, any questions?

1324
01:06:56,416 --> 01:06:56,826
Very good.

1325
01:06:58,416 --> 01:07:04,856
So this is just a visual of that
pattern that I talked about.

1326
01:07:04,926 --> 01:07:05,756
We invoke the API.

1327
01:07:05,756 --> 01:07:07,396
It's an asynchronous call.

1328
01:07:08,006 --> 01:07:09,296
That's also important.

1329
01:07:09,296 --> 01:07:11,466
These calls you make
this open data APIs

1330
01:07:11,466 --> 01:07:13,936
and we fully support
an asynchronous model

1331
01:07:13,936 --> 01:07:15,926
on the phone and on Windows.

1332
01:07:15,926 --> 01:07:18,486
It's an asynchronous
call that means you're--

1333
01:07:18,856 --> 01:07:22,386
the user is not waiting
for that call to return.

1334
01:07:22,386 --> 01:07:25,506
They can keep using your app,
they can go use another app,

1335
01:07:26,086 --> 01:07:27,816
and then when the call returns,

1336
01:07:28,186 --> 01:07:31,116
your application
will be notified.

1337
01:07:31,146 --> 01:07:32,946
That's where you'll do
the deserialization.

1338
01:07:32,946 --> 01:07:36,036
If necessary copy
to the ViewModel

1339
01:07:36,036 --> 01:07:36,896
and then bind to the UI.

1340
01:07:37,646 --> 01:07:39,696
And we did all of that.

1341
01:07:40,576 --> 01:07:41,786
So now I'm just going to dive

1342
01:07:41,786 --> 01:07:43,876
into this cross-platform
app development

1343
01:07:43,876 --> 01:07:45,436
landscape discussion.

1344
01:07:47,166 --> 01:07:53,296
For C# developers, this is one
of the best options you have

1345
01:07:53,296 --> 01:07:58,086
out there for a cross-platform
support for iOS, for Android,

1346
01:07:58,086 --> 01:08:04,316
for Windows is with the tools
and the frameworks from Xamarin.

1347
01:08:04,766 --> 01:08:07,556
They're actually based--
they're headquartered here

1348
01:08:07,626 --> 01:08:10,026
at Harvard Square.

1349
01:08:10,576 --> 01:08:13,696
The founder of this
company is Miguel de Icaza,

1350
01:08:14,346 --> 01:08:20,986
he many years ago when Microsoft
open sourced the .net framework

1351
01:08:20,986 --> 01:08:24,846
and the C# language and
standardized it, he took that

1352
01:08:24,846 --> 01:08:27,366
and he created that
implementation from Linux.

1353
01:08:28,216 --> 01:08:31,966
And so he's been making his
living building cross-platform

1354
01:08:32,416 --> 01:08:37,766
tools and libraries based on
C# and the .net framework for--

1355
01:08:37,766 --> 01:08:39,656
it's going to be
10 or 12 years now.

1356
01:08:40,386 --> 01:08:43,596
And the latest incarnation
is Xamarin

1357
01:08:44,146 --> 01:08:50,226
and they provide a
cross platform framework

1358
01:08:50,436 --> 01:08:53,776
for targeting, you know,
all the mobile platforms

1359
01:08:54,876 --> 01:08:58,856
and the nice thing here is--
to our discussion earlier,

1360
01:08:59,386 --> 01:09:03,236
you can get 60, 70
percent code reuse.

1361
01:09:03,456 --> 01:09:07,256
Their model is, you know,
port the business logic,

1362
01:09:07,306 --> 01:09:10,316
the cloud integration, the
database access, that's portable

1363
01:09:10,666 --> 01:09:13,396
but do your user
interface natively for each

1364
01:09:13,986 --> 01:09:16,086
because there's no substitute

1365
01:09:16,086 --> 01:09:17,796
for a native UI,
there just isn't.

1366
01:09:18,756 --> 01:09:20,616
This has been something
we've been trying to solve

1367
01:09:20,616 --> 01:09:21,926
and computer science
for many years.

1368
01:09:21,926 --> 01:09:23,276
You can go back to the '80s.

1369
01:09:23,276 --> 01:09:25,136
There were companies
that were trying to spin

1370
01:09:25,786 --> 01:09:30,716
up cross-platform UI,
frameworks, and tools

1371
01:09:30,716 --> 01:09:33,106
and they began to be called--

1372
01:09:33,106 --> 01:09:36,706
they were referred to as least
common denominator or LCD

1373
01:09:37,066 --> 01:09:40,116
which meant they were the
poorest implementation

1374
01:09:40,116 --> 01:09:42,796
on every platform they
ran on, all right?

1375
01:09:43,156 --> 01:09:44,556
So that's not where
you want to be.

1376
01:09:44,556 --> 01:09:45,876
You don't want to
be least common.

1377
01:09:45,876 --> 01:09:47,716
You want your app to sing

1378
01:09:47,716 --> 01:09:50,536
and to just be the most
fantastic experience

1379
01:09:51,106 --> 01:09:52,616
on whatever mobile
device that's on.

1380
01:09:52,926 --> 01:09:56,786
But at the same time, if you
want to have the farthest reach,

1381
01:09:56,986 --> 01:10:00,296
the most opportunity for
downloads and for monetization

1382
01:10:00,296 --> 01:10:03,346
and all of that, you want to
be on as many mobile platforms

1383
01:10:03,346 --> 01:10:05,466
as possible so you
need a strategy.

1384
01:10:05,926 --> 01:10:08,606
It might be native on each
platform, that's a strategy.

1385
01:10:09,046 --> 01:10:11,506
Could be crossed platform
with something like Xamarin

1386
01:10:11,506 --> 01:10:13,816
which means you're
going to develop in C#

1387
01:10:13,816 --> 01:10:16,506
and you can actually do
debugging in Visual Studio

1388
01:10:16,506 --> 01:10:20,176
for Android, and for
Apple, and for Windows

1389
01:10:20,176 --> 01:10:21,816
so it's a great development
experience.

1390
01:10:22,016 --> 01:10:23,036
They've got a great
product here.

1391
01:10:23,036 --> 01:10:27,886
A lot of applications are
beginning to take advantage

1392
01:10:28,326 --> 01:10:34,006
of that, earlier stated, your
HTML5 developer, phone gap,

1393
01:10:34,006 --> 01:10:39,546
fantastic option for a cross
platform solution, all right.

1394
01:10:40,516 --> 01:10:42,836
[ Pause ]

1395
01:10:43,336 --> 01:10:44,926
If you're a game developer,

1396
01:10:46,396 --> 01:10:50,706
Unity just released their
Windows 8 Windows phone support

1397
01:10:50,706 --> 01:10:51,456
for Unity.

1398
01:10:51,736 --> 01:10:54,866
So you can now, you
know, take your--

1399
01:10:55,036 --> 01:10:57,766
we're actually told by Unity
that about half the games

1400
01:10:57,766 --> 01:10:59,706
in the iOS store are
built with Unity.

1401
01:11:00,366 --> 01:11:02,416
So we know there's a lot of
Unity developers out there.

1402
01:11:02,416 --> 01:11:03,586
It's a great tool.

1403
01:11:03,586 --> 01:11:06,686
It's on the high
end but, you know,

1404
01:11:06,686 --> 01:11:11,046
under the covers it's C #.
It's actually using the cross

1405
01:11:11,046 --> 01:11:13,036
platform implementation of C#

1406
01:11:13,036 --> 01:11:15,436
that Miguel has it
designed years ago.

1407
01:11:15,976 --> 01:11:17,386
So it's called the
Mono Framework.

1408
01:11:17,956 --> 01:11:23,176
And so you can build games
that target all the platforms.

1409
01:11:24,996 --> 01:11:28,246
There's another framework,
this one's very interesting.

1410
01:11:28,406 --> 01:11:33,086
It's called MonoGame, again same
community, you see those kind

1411
01:11:33,086 --> 01:11:34,816
of a-- when the C# world,

1412
01:11:34,816 --> 01:11:37,356
if you want to go cross
platform you're working

1413
01:11:37,356 --> 01:11:38,296
in what's called Mono.

1414
01:11:38,296 --> 01:11:40,986
So it's MonoGame or it's the
Mono Framework which is used

1415
01:11:40,986 --> 01:11:43,696
by Unity or it's Zemuron
which is using Mono

1416
01:11:43,696 --> 01:11:45,876
and its implementation.

1417
01:11:46,446 --> 01:11:48,546
So it's having a lot of impact.

1418
01:11:49,096 --> 01:11:51,896
MonoGame is a cross
platform implementation

1419
01:11:51,896 --> 01:11:54,186
of Microsoft's XNA Framework.

1420
01:11:54,186 --> 01:11:57,536
So if you're familiar with
building games for Xbox

1421
01:11:57,536 --> 01:12:00,996
or for Windows or Windows Phone,
the framework was called XNA.

1422
01:12:02,146 --> 01:12:04,876
The cross platform
version of that is MonoGame

1423
01:12:05,236 --> 01:12:07,016
and there are games like ARMED!

1424
01:12:07,016 --> 01:12:09,806
that are in the Windows 8 store
that are built on MonoGame.

1425
01:12:09,806 --> 01:12:11,776
I'd built one myself
and put it in the store,

1426
01:12:12,006 --> 01:12:13,336
works incredibly well.

1427
01:12:13,416 --> 01:12:18,986
It's very straightforward
way of doing game development

1428
01:12:18,986 --> 01:12:24,766
and it supports Android
and iOS and Xbox

1429
01:12:24,766 --> 01:12:26,746
and Windows and you name it.

1430
01:12:27,516 --> 01:12:29,596
[ Pause ]

1431
01:12:30,096 --> 01:12:34,416
If you're an HTML developer
and you're a game developer,

1432
01:12:34,416 --> 01:12:35,976
you might want to
look at something

1433
01:12:35,976 --> 01:12:39,616
like GameMaker Studio
from YoYo Games.

1434
01:12:40,526 --> 01:12:44,706
This is a cross platform
game development tool.

1435
01:12:45,066 --> 01:12:48,486
It will generate HTML5 and
JavaScript and allow you

1436
01:12:48,486 --> 01:12:51,776
to target all the
different mobile platforms.

1437
01:12:52,516 --> 01:12:54,756
[ Pause ]

1438
01:12:55,256 --> 01:12:58,726
There's another one like that,
that's called Construct 2

1439
01:12:58,726 --> 01:13:00,336
from a company called Scirra.

1440
01:13:02,396 --> 01:13:05,806
We actually use this in
all of our game workshops.

1441
01:13:05,946 --> 01:13:09,146
With students and professionals
we use Construct 2.

1442
01:13:09,486 --> 01:13:13,646
That's because the free
version is very, very powerful

1443
01:13:13,646 --> 01:13:17,276
and you can publish to
Windows Phone and to Windows 8

1444
01:13:17,486 --> 01:13:18,956
with their free edition.

1445
01:13:18,956 --> 01:13:20,966
You have to understand
that each one

1446
01:13:20,966 --> 01:13:23,756
of these tools showing
you has a cost to it.

1447
01:13:24,546 --> 01:13:27,036
This one, what's
nice about is no cost

1448
01:13:27,426 --> 01:13:29,856
for targeting Windows at least.

1449
01:13:29,856 --> 01:13:32,616
If you get into iOS and
Android then there maybe a cost

1450
01:13:32,936 --> 01:13:37,976
to getting that export
capability turned on, all right.

1451
01:13:38,081 --> 01:13:40,081
[ Pause ]

1452
01:13:40,146 --> 01:13:41,626
Another one's called Gamesolid.

1453
01:13:42,986 --> 01:13:46,116
You see there's several of
these, all very similar.

1454
01:13:46,116 --> 01:13:48,876
They're all leveraging
HTML5 in JavaScript

1455
01:13:48,876 --> 01:13:51,446
in the code generation.

1456
01:13:51,796 --> 01:13:54,616
But the act of building
the game is drag and drop,

1457
01:13:54,966 --> 01:13:56,396
that's one of the nice
things about these tools.

1458
01:13:56,396 --> 01:13:58,716
You're not in the code, you're--

1459
01:13:58,716 --> 01:14:01,246
if you're a game developer you
want to focus on the artwork,

1460
01:14:01,246 --> 01:14:05,446
the assets, the sound, the
gameplay, the heads up display,

1461
01:14:05,446 --> 01:14:07,696
the layers things like that.

1462
01:14:07,836 --> 01:14:09,896
That's what these tools are
good at, they give you an IDE,

1463
01:14:09,896 --> 01:14:13,596
you lay everything out, you say
what the rules are of the game,

1464
01:14:13,976 --> 01:14:16,266
and then you test
it in the browser,

1465
01:14:16,566 --> 01:14:18,296
and when something
doesn't work just right,

1466
01:14:18,336 --> 01:14:20,976
you don't go change code,
you're back into their tool

1467
01:14:20,976 --> 01:14:22,806
and you're modifying
properties of objects,

1468
01:14:22,806 --> 01:14:24,246
some things with that,
so it's all visual.

1469
01:14:24,716 --> 01:14:30,956
If you are into the code then
another choice is create JS.

1470
01:14:31,346 --> 01:14:33,456
This is a suite of
JavaScript libraries

1471
01:14:33,456 --> 01:14:34,666
that help you build games.

1472
01:14:34,666 --> 01:14:36,156
There's one example out there

1473
01:14:36,466 --> 01:14:39,486
that does a complete
implementation of which is got

1474
01:14:39,486 --> 01:14:42,866
to be about 15 or 20
different Atari games.

1475
01:14:43,376 --> 01:14:45,986
All done in the-- they
run in the browser,

1476
01:14:46,236 --> 01:14:49,856
they've also imported to Windows
8 and this is the bit.ly.

1477
01:14:49,856 --> 01:14:51,186
It's kind of cryptic.

1478
01:14:51,186 --> 01:14:54,586
I didn't come up with a proper
name but it's bit.ly/R--

1479
01:14:54,586 --> 01:15:01,596
capital R3, lower case
v2, capital D capital H.

1480
01:15:01,986 --> 01:15:04,356
And at least you'll get to
the website and you can check

1481
01:15:04,356 --> 01:15:09,316
out all the apps there that
have been built with CreateJS.

1482
01:15:09,706 --> 01:15:11,216
There's also one of-- a member

1483
01:15:11,216 --> 01:15:18,356
of the team built the Catapult
Wars and did it with CreateJS

1484
01:15:18,356 --> 01:15:21,066
and put that into the Windows
8 store and there's the bit.ly

1485
01:15:21,066 --> 01:15:23,686
for that if you're interested in
reading up on how that was done.

1486
01:15:24,516 --> 01:15:26,946
[ Pause ]

1487
01:15:27,446 --> 01:15:30,796
I'll make these slides
available too after.

1488
01:15:31,026 --> 01:15:35,596
Another game development
framework is impactJS

1489
01:15:36,026 --> 01:15:39,446
and a guy-- I told you about him
earlier, Jesse Freeman who is

1490
01:15:39,446 --> 01:15:42,076
on my team, he's on New York,

1491
01:15:42,296 --> 01:15:44,856
he wrote the book called
'HTML5 Game Development.

1492
01:15:44,856 --> 01:15:50,316
Iit's all about how to build
HTML5 games using ImpactJS.

1493
01:15:50,356 --> 01:15:54,396
He's built-- he's just got
tons of sample code online,

1494
01:15:54,396 --> 01:15:58,736
he's got a book, he's quite
good and he has a bunch of games

1495
01:15:58,736 --> 01:15:59,826
in the store right now.

1496
01:15:59,826 --> 01:16:03,316
His favorite is, you got that
he likes that old 8 bit look

1497
01:16:03,316 --> 01:16:04,356
and feel to the artwork.

1498
01:16:04,826 --> 01:16:07,376
So he creates a lot
of his own artwork

1499
01:16:07,376 --> 01:16:11,446
and builds these games
using HTML5 and JavaScript.

1500
01:16:11,446 --> 01:16:12,996
And he gets them
running in the browser

1501
01:16:12,996 --> 01:16:14,816
and then he gets them
running on Windows

1502
01:16:15,206 --> 01:16:17,816
and now he's forwarding
them to the phone.

1503
01:16:18,516 --> 01:16:20,616
[ Pause ]

1504
01:16:21,116 --> 01:16:24,146
So just to close out,
so I'm right at time,

1505
01:16:25,206 --> 01:16:28,516
is I want to make sure
you know about DreamSpark.

1506
01:16:28,516 --> 01:16:31,466
Now if you go to DreamSpark.com,
you could register there

1507
01:16:31,466 --> 01:16:34,856
but it sounds like what you
should do is find out the URL

1508
01:16:34,856 --> 01:16:37,996
or the Harvard DreamSpark site.

1509
01:16:38,696 --> 01:16:41,196
And if you go in there,
you can get Windows,

1510
01:16:41,196 --> 01:16:44,446
you can get Visual Studio, you
can get SQL Server, you can get,

1511
01:16:44,876 --> 01:16:47,196
you know, everything
but an Xbox all right?

1512
01:16:47,196 --> 01:16:49,216
You can get basically
all of our stuff there.

1513
01:16:49,506 --> 01:16:51,756
So download the development
tools, download the SDKs.

1514
01:16:51,756 --> 01:16:53,706
You also get a free Windows 8

1515
01:16:53,706 --> 01:16:56,716
and a free Windows Phone
developer account that's a 150

1516
01:16:56,716 --> 01:16:57,416
dollar value.

1517
01:16:58,056 --> 01:17:00,296
All right, so students
get account for free.

1518
01:17:00,296 --> 01:17:02,216
I want to make sure you
guys get access to that.

1519
01:17:03,026 --> 01:17:05,166
App builders are
site for developers.

1520
01:17:05,416 --> 01:17:09,306
If you go there and register
build.windowsstore.com,

1521
01:17:09,706 --> 01:17:12,906
there's-- you can earn points,
you can register your apps,

1522
01:17:12,906 --> 01:17:15,936
they can send you on some quests
and you'll earn, you know,

1523
01:17:15,936 --> 01:17:17,866
you'll earn points to
be able to win stuff.

1524
01:17:17,936 --> 01:17:22,426
There's also a ton-- a ton
of training material up there

1525
01:17:22,656 --> 01:17:25,056
if you're looking for
either apps or games.

1526
01:17:25,056 --> 01:17:28,166
Some other training I found
that might me, you know,

1527
01:17:28,256 --> 01:17:30,856
really applicable to what you're
doing now is there is a C#

1528
01:17:30,856 --> 01:17:35,056
fundamentals online
course set of videos

1529
01:17:35,526 --> 01:17:38,086
and then there's also
Windows Phone 8 for beginners.

1530
01:17:38,346 --> 01:17:41,036
So if you're just getting into
the space, you just want "Hey,

1531
01:17:41,036 --> 01:17:43,526
I just need to learn some C#
and I need to just get started

1532
01:17:43,526 --> 01:17:47,096
with Windows Phone," those
two resources are fantastic.

1533
01:17:47,096 --> 01:17:50,336
And then the work I was
showing you is a project

1534
01:17:50,336 --> 01:17:55,736
that my team did called APIMASH
which is at aka.ms/apimash

1535
01:17:55,736 --> 01:17:58,526
and that will take
you to GitHub.

1536
01:17:59,716 --> 01:18:02,926
So we post all of our
stuff up on GitHub.

1537
01:18:04,336 --> 01:18:06,406
So we've got a bunch of
StarterKits up there.

1538
01:18:06,756 --> 01:18:09,576
If you scroll down, we have
StarterKits for Windows

1539
01:18:09,576 --> 01:18:12,456
and for Windows phone and we're
actually expanding this list.

1540
01:18:12,456 --> 01:18:14,956
So everything you see here is
being ported over the phone.

1541
01:18:14,956 --> 01:18:19,076
But we've got active access
on Chuck Norris StarterKit,

1542
01:18:19,076 --> 01:18:22,476
Earthquakes and Bing Maps,
Edmunds, Facebook, Foursquare,

1543
01:18:22,476 --> 01:18:25,846
Instagram, Meetup, Messier
Sky Objects, Rotten Tomatoes,

1544
01:18:26,146 --> 01:18:30,726
Stack Exchange, Tumblr,
Twitter, Univision, Wikipedia,

1545
01:18:30,726 --> 01:18:34,036
World of Warcraft,
Yelp and ESPN.

1546
01:18:34,036 --> 01:18:38,836
All of these are all functional
Windows 8 apps with the code.

1547
01:18:39,326 --> 01:18:41,066
And everything I showed you,

1548
01:18:41,066 --> 01:18:42,986
that's the pattern
they're all using.

1549
01:18:42,986 --> 01:18:47,106
That whole open data API call
deserialize bind to the UI.

1550
01:18:47,276 --> 01:18:50,726
If you're interested in seeing
how you get started building

1551
01:18:50,726 --> 01:18:52,516
for Windows 8 and
for Windows phone,

1552
01:18:52,836 --> 01:18:55,766
these are fantastic resources
here all built by my team.

1553
01:18:56,306 --> 01:18:58,966
So it's all creates
up on GitHub.

1554
01:18:59,296 --> 01:19:01,056
The way to do it is you
just go to that site

1555
01:19:01,056 --> 01:19:05,346
and click the download zip file.

1556
01:19:06,296 --> 01:19:09,876
So we also include
a Lab Workbook,

1557
01:19:10,356 --> 01:19:12,686
there's three Lab Workbooks in
there just to kind of take you

1558
01:19:12,686 --> 01:19:14,966
through how to get started
with this stuff, all right.

1559
01:19:15,826 --> 01:19:18,616
So I want to make sure you
are aware of that and with

1560
01:19:18,616 --> 01:19:19,976
that thank you very much.

1561
01:19:20,516 --> 01:19:25,996
[ Applause ]

1562
01:19:26,496 --> 01:19:27,326
>> Thank you so much Bob.

1563
01:19:27,326 --> 01:19:30,896
We've been deposted at
C76.net, an instructions

1564
01:19:30,896 --> 01:19:32,566
for how you can get access
to a DreamSpark account--

1565
01:19:32,566 --> 01:19:32,906
>> Beautiful.

1566
01:19:32,906 --> 01:19:33,856
>> -- so actually
you can get that

1567
01:19:33,856 --> 01:19:35,476
and then we'll post the
slides later tonight.

1568
01:19:35,556 --> 01:19:36,126
>> Fantastic.

1569
01:19:36,226 --> 01:19:36,806
>> Thank you so much.

1570
01:19:36,806 --> 01:19:37,156
>> Thank you.

1571
01:19:37,156 --> 01:19:38,246
>> Why don't we go ahead

1572
01:19:38,246 --> 01:19:40,076
and take few minute break
here while Dan get set up

1573
01:19:40,076 --> 01:19:42,286
and then we'll transition to
the third and final platform

1574
01:19:42,286 --> 01:19:43,526
for the evening, Android.

1575
01:19:44,016 --> 01:19:45,396
[ Pause ]

1576
01:19:45,396 --> 01:19:50,166
All right, we're back so the
third act here is Dan Armendariz

1577
01:19:50,166 --> 01:19:52,256
who actually started this
class several years ago.

1578
01:19:52,256 --> 01:19:55,896
What's the origin of C76
can be traced back to him

1579
01:19:56,706 --> 01:19:58,616
and a colleague of
his and it was--

1580
01:19:58,616 --> 01:20:01,066
I came along a year
or so after that

1581
01:20:01,066 --> 01:20:02,256
that I finally got involved.

1582
01:20:02,256 --> 01:20:05,846
So everything you've seen thus
far is all traces back to Dan.

1583
01:20:05,946 --> 01:20:08,016
So, Dan is going to look
at Android develop fellows

1584
01:20:08,346 --> 01:20:10,536
and without further
ado, Dan Armendariz.

1585
01:20:11,046 --> 01:20:11,326
>> Thanks.

1586
01:20:12,016 --> 01:20:14,356
Hi everyone, it's
nice to be back.

1587
01:20:14,436 --> 01:20:16,716
So, speaking a note
in a contact and from

1588
01:20:16,716 --> 01:20:18,416
where you're sitting it
doesn't really seem that way.

1589
01:20:18,756 --> 01:20:20,436
The cause is very
different back then.

1590
01:20:20,826 --> 01:20:24,496
Just like mobile development has
really evolved over the years.

1591
01:20:24,496 --> 01:20:26,696
In fact in the best
years since the last time

1592
01:20:26,696 --> 01:20:29,686
that I actually co-talked
this class with David.

1593
01:20:30,376 --> 01:20:35,436
Android development has gotten
a lot better in at least

1594
01:20:35,436 --> 01:20:36,306
in the initial set up.

1595
01:20:36,306 --> 01:20:39,506
So, we're going to talk
about as quickly as we can.

1596
01:20:39,506 --> 01:20:41,936
We're going to try to
shoehorn what I use

1597
01:20:41,936 --> 01:20:46,816
to put four weeks worth
of content into 1 hour.

1598
01:20:46,816 --> 01:20:49,126
So, please allow me simply way

1599
01:20:49,126 --> 01:20:50,546
as I go a little quickly
through some things.

1600
01:20:50,546 --> 01:20:51,726
Of course if you
have any questions,

1601
01:20:51,726 --> 01:20:54,836
you can interrupt it anytime
and hopefully we'll be able

1602
01:20:54,836 --> 01:20:58,396
to get you guys comfortable in
such a way that you'll be able

1603
01:20:58,396 --> 01:21:02,166
to do some Android
development soon as you go home.

1604
01:21:02,166 --> 01:21:04,826
So, just that I can sort of get
a sense of where everybody is.

1605
01:21:05,116 --> 01:21:08,606
How many of you used
an iOS device

1606
01:21:08,686 --> 01:21:11,036
as your say primary
phone in iPhone?

1607
01:21:12,416 --> 01:21:14,326
That's just about everybody.

1608
01:21:14,876 --> 01:21:18,016
Now, is-- are there any of
you that using Android device

1609
01:21:18,016 --> 01:21:18,916
as your primary phone?

1610
01:21:19,746 --> 01:21:22,426
OK. So, for those of you
that have your hands up,

1611
01:21:22,426 --> 01:21:25,686
is that constant,
do you always use

1612
01:21:25,686 --> 01:21:28,016
that device rather
than an iOS device?

1613
01:21:28,016 --> 01:21:30,646
All right, so, for those of
you that had your hands up,

1614
01:21:30,646 --> 01:21:32,756
you probably are familiar
with the differences

1615
01:21:32,756 --> 01:21:35,226
between the experience

1616
01:21:35,226 --> 01:21:37,106
of an android device
and an iOS device.

1617
01:21:37,106 --> 01:21:38,826
And this is actually
really important is that.

1618
01:21:38,826 --> 01:21:43,226
In order to develop on
one of these platforms,

1619
01:21:43,226 --> 01:21:46,746
it really is useful to
have a sense of what

1620
01:21:46,886 --> 01:21:48,976
that platform is actually
liked to be able to use it.

1621
01:21:49,396 --> 01:21:50,876
And so, if you are serious

1622
01:21:50,876 --> 01:21:53,036
about actually doing
cross platform work just

1623
01:21:53,036 --> 01:21:56,736
to reiterate comments that the
[inaudible] the first hour,

1624
01:21:57,126 --> 01:22:00,396
it's really helpful to get
a sense of that experience

1625
01:22:00,396 --> 01:22:02,386
at how you actually
want to replicate

1626
01:22:02,386 --> 01:22:04,016
that on this other device.

1627
01:22:04,616 --> 01:22:08,086
And even though Android
is considered

1628
01:22:08,086 --> 01:22:11,106
to be the primary competitor
to iOS, it's really difficult

1629
01:22:11,106 --> 01:22:15,646
to put them I think on that same
sort of comparison, they operate

1630
01:22:15,646 --> 01:22:16,436
in very different ways,

1631
01:22:16,436 --> 01:22:20,486
they have very different
reasonings behind very different

1632
01:22:20,486 --> 01:22:22,516
decision that went into
their implementation.

1633
01:22:23,036 --> 01:22:26,506
And there's a lot
of maybe let's see,

1634
01:22:26,796 --> 01:22:28,436
what is the proper
word to use here.

1635
01:22:28,706 --> 01:22:30,326
There's perhaps a
lot of difference

1636
01:22:30,326 --> 01:22:33,666
between the two that's in a
large confusion between the two

1637
01:22:34,016 --> 01:22:37,706
that really just arise from
this sort of basic differences,

1638
01:22:37,706 --> 01:22:41,016
this basic differences
that arose initially

1639
01:22:41,016 --> 01:22:43,956
from when Google was first
started developing the Android

1640
01:22:43,956 --> 01:22:48,076
and when Apple first started
developing iPhone and iOS.

1641
01:22:48,846 --> 01:22:52,016
So, this is actually
pretty important for us

1642
01:22:52,016 --> 01:22:54,456
as well as developers.

1643
01:22:55,236 --> 01:23:00,476
So, for us as developers, what
are some of the differences

1644
01:23:00,476 --> 01:23:02,486
that we typically
hear about the--

1645
01:23:02,576 --> 01:23:05,316
about developing for iOS
versus developing for Android?

1646
01:23:05,846 --> 01:23:12,256
If you were to go out unto a
tech blog and read the comments

1647
01:23:12,256 --> 01:23:14,206
that people always
post whenever Apple

1648
01:23:14,206 --> 01:23:17,386
or whenever Google updates
one of their hardware devices.

1649
01:23:17,386 --> 01:23:19,726
People always complain about
the same sorts of things, right?

1650
01:23:19,726 --> 01:23:20,796
What are these differences?

1651
01:23:21,766 --> 01:23:24,766
What do Android users
dislike about iPhones

1652
01:23:24,766 --> 01:23:27,396
and what do iPhone users dislike
about Android, any ideas?

1653
01:23:27,396 --> 01:23:27,486
Yes.

1654
01:23:27,486 --> 01:23:28,866
>> [Inaudible] you know just
like how as a [inaudible],

1655
01:23:28,866 --> 01:23:30,216
you have much limited
perspective on iOS rather

1656
01:23:30,216 --> 01:23:41,376
than Android before
functionality that [inaudible].

1657
01:23:41,376 --> 01:23:44,066
>> So, perhaps if I could
summarize that in a way to say

1658
01:23:44,066 --> 01:23:45,636
that people consider Android

1659
01:23:45,636 --> 01:23:49,736
to be a little bit
more open than iOS.

1660
01:23:49,736 --> 01:23:52,556
And so, that is certainly true
in many respective in for us

1661
01:23:52,556 --> 01:23:55,566
as developers when you'd
create the developer account

1662
01:23:55,946 --> 01:23:58,756
with Google, you pay a
one time 25 dollar fee,

1663
01:23:58,756 --> 01:24:01,896
you have an account with them
basically that 25 dollar fee is

1664
01:24:01,896 --> 01:24:05,406
to weed out to people that
just want to create, you know,

1665
01:24:05,406 --> 01:24:07,506
flood the store with spam.

1666
01:24:07,906 --> 01:24:10,086
It's not a terribly high fee

1667
01:24:10,086 --> 01:24:11,476
but it is one fee
that you have to do.

1668
01:24:11,476 --> 01:24:14,886
But then after that, you're
free to submit your applications

1669
01:24:14,886 --> 01:24:16,676
to the store, there's
no review process

1670
01:24:17,206 --> 01:24:20,516
and you basically create your
application, you publish it

1671
01:24:20,516 --> 01:24:22,326
to the store and then
that's it, it's up and ready

1672
01:24:22,366 --> 01:24:23,656
for people to download.

1673
01:24:23,656 --> 01:24:24,736
That's just one sense

1674
01:24:24,736 --> 01:24:28,076
that Google might be a little
bit more open than Apple

1675
01:24:28,366 --> 01:24:29,826
but there's others
other ways as well,

1676
01:24:29,826 --> 01:24:31,576
you have a little bit more
control over your phone,

1677
01:24:31,576 --> 01:24:34,496
some people would argue a little
bit more customization whereas

1678
01:24:34,496 --> 01:24:37,556
in iOS they tried to really
funnel you towards a certain

1679
01:24:37,556 --> 01:24:40,906
types of experience which
in itself I'm trimming not

1680
01:24:40,906 --> 01:24:43,076
in the sense this is a negative
but in fact that is a very--

1681
01:24:43,076 --> 01:24:44,866
again, a very different
way of thinking about this.

1682
01:24:45,536 --> 01:24:48,636
Google allows you to have a
lot more options, and so it can

1683
01:24:48,916 --> 01:24:51,486
to people who are mot
familiar with the system appear

1684
01:24:51,486 --> 01:24:52,816
to be a little bit more complex.

1685
01:24:54,076 --> 01:24:56,676
And so, again, this is just that
same sort of idea that we want

1686
01:24:56,726 --> 01:24:58,556
to point out the
differences between the two,

1687
01:24:58,886 --> 01:25:01,876
you have a question
or a difference?

1688
01:25:02,416 --> 01:25:05,126
>> [Inaudible] are the
open source in any way?

1689
01:25:05,346 --> 01:25:09,316
>> So, for the longest time
Android was open source

1690
01:25:09,316 --> 01:25:11,946
but they have in fact to
close source to some of them.

1691
01:25:11,946 --> 01:25:13,956
So, a lot of the code
is in fact open source

1692
01:25:13,956 --> 01:25:16,516
but I think a lot some of that
now more basic functions are

1693
01:25:16,516 --> 01:25:18,816
in fact closed source
from Google.

1694
01:25:19,366 --> 01:25:22,336
Yeah, that was also a primary
difference between Apple

1695
01:25:22,416 --> 01:25:26,616
and Android again, part we
could perhaps include this

1696
01:25:26,616 --> 01:25:28,146
within this openness aspect.

1697
01:25:28,146 --> 01:25:31,336
What about other things,
anything else as developers

1698
01:25:31,336 --> 01:25:32,436
that might be different?

1699
01:25:32,436 --> 01:25:32,546
Yes.

1700
01:25:32,606 --> 01:25:33,056
>> iOS [inaudible] might say

1701
01:25:33,056 --> 01:25:37,806
that Androids were
fragmented [inaudible]?

1702
01:25:37,806 --> 01:25:39,896
>> Right. So, there's--
this is definitely a big one

1703
01:25:39,896 --> 01:25:42,006
that we hear a lot is
that this fragmentation

1704
01:25:42,426 --> 01:25:43,536
in Android devices.

1705
01:25:43,536 --> 01:25:45,996
And in fact this is a very
important point that I want

1706
01:25:45,996 --> 01:25:49,196
to bring up right a way, is
that's there is some truth

1707
01:25:49,196 --> 01:25:52,346
to this in what is
actually fragmented.

1708
01:25:52,346 --> 01:25:56,036
There are many different types
of hardware devices available

1709
01:25:56,136 --> 01:25:59,426
for with the Google
operating system

1710
01:25:59,426 --> 01:26:00,746
with the Android
operating system

1711
01:26:00,746 --> 01:26:01,996
from different manufactures

1712
01:26:01,996 --> 01:26:05,346
where as Apple only is the only
manufacture of iPhone and iPad.

1713
01:26:05,816 --> 01:26:07,516
There are many different
manufacturers

1714
01:26:07,516 --> 01:26:09,776
that use Android as a platform.

1715
01:26:10,286 --> 01:26:12,416
And even within that context,

1716
01:26:12,896 --> 01:26:17,166
many people don't update
their software as much as we

1717
01:26:17,166 --> 01:26:18,606
as developers might
want them to.

1718
01:26:19,076 --> 01:26:20,946
And there's a variety
of reasons for this.

1719
01:26:20,946 --> 01:26:23,476
Some of them may not be aware
that there is an update.

1720
01:26:23,476 --> 01:26:28,096
Some of them-- but I think one
of the more pressing problems is

1721
01:26:28,096 --> 01:26:31,926
that with many of the third
party phones that come

1722
01:26:31,926 --> 01:26:35,166
out that have Android on them,
they have a lot of stuff to it.

1723
01:26:35,166 --> 01:26:38,766
Sort of like when you buy a PC
and has a lot of stuff installed

1724
01:26:38,766 --> 01:26:41,906
and my friend just bought an
Asus and he said they would have

1725
01:26:41,906 --> 01:26:45,246
like a-- on my gosh, I wish I
could remember exactly what it

1726
01:26:45,246 --> 01:26:48,996
was but it was like an Asus
internet connection help wizard

1727
01:26:48,996 --> 01:26:51,536
or some sort of very specific
thing that he was kind

1728
01:26:51,536 --> 01:26:53,296
of surprised that they
actually bother this one,

1729
01:26:53,566 --> 01:26:54,946
[inaudible] company
actually bother

1730
01:26:54,946 --> 01:26:56,266
to create the software report

1731
01:26:56,266 --> 01:26:57,706
and it's sort of
a similar thing.

1732
01:26:57,706 --> 01:26:58,956
A lot of these companies will

1733
01:26:58,956 --> 01:27:02,326
in fact add their own
additional UI components on top

1734
01:27:02,326 --> 01:27:07,406
of the Android base OS which
further adds to perhaps some

1735
01:27:07,406 --> 01:27:09,546
of the confusion between
different users when you pick

1736
01:27:09,546 --> 01:27:11,756
up an android device
from say Samsung

1737
01:27:12,086 --> 01:27:16,086
versus one that's Google create
with just the base Android.

1738
01:27:16,086 --> 01:27:18,566
OS it might actually look
different even though it has the

1739
01:27:18,566 --> 01:27:22,046
same version of the OS because
of these additional little

1740
01:27:22,046 --> 01:27:24,626
flares, you know, the
additional pieces of software

1741
01:27:24,626 --> 01:27:26,506
that they will actually
add on to this.

1742
01:27:26,946 --> 01:27:30,316
Now, I don't want to confuse the
issue with all that stuff aside,

1743
01:27:30,716 --> 01:27:34,326
one of the base issues in this
fragmentation argument is the

1744
01:27:34,326 --> 01:27:37,586
bit-- just the wide range of
versions that were installed

1745
01:27:37,586 --> 01:27:39,056
on hardware devices right now.

1746
01:27:39,726 --> 01:27:42,286
So, this is a chart that
Google actually created.

1747
01:27:42,286 --> 01:27:45,676
They released a similar chart
every half month or every month

1748
01:27:45,676 --> 01:27:49,116
or so, showing the distribution
of devices that connect

1749
01:27:49,116 --> 01:27:51,106
to the Google play store
which is the equivalence

1750
01:27:51,106 --> 01:27:53,006
of the App store on iOS.

1751
01:27:53,006 --> 01:27:58,446
And as we can see here, there's
really no one slice of this pie

1752
01:27:58,446 --> 01:28:01,006
that makes up the
majority of the devices.

1753
01:28:01,236 --> 01:28:04,866
It really runs the gamut
from ginger bread right here

1754
01:28:04,866 --> 01:28:07,706
which is a version
two of Android OS

1755
01:28:07,706 --> 01:28:11,716
which is now several years old
all the way up to jelly bean

1756
01:28:11,716 --> 01:28:15,706
which is one of the later
versions, version 4.1 and 4.2

1757
01:28:15,706 --> 01:28:18,206
and now there's an even newer
version 4.3 but I'm not sure

1758
01:28:18,206 --> 01:28:19,826
that any devices
have been released

1759
01:28:19,826 --> 01:28:20,946
to actually have
that through that.

1760
01:28:20,946 --> 01:28:22,346
It's actually been
released at this point.

1761
01:28:23,076 --> 01:28:27,576
Now, sort of the saving
grace here with this is

1762
01:28:27,576 --> 01:28:33,506
that if you did want to
target a lot of this users,

1763
01:28:33,746 --> 01:28:36,636
you can actually create
of course an application

1764
01:28:36,936 --> 01:28:39,896
that is targeted at one of this
APIs, one of this earlier APIs

1765
01:28:39,896 --> 01:28:43,996
and be able to get a large
portion of the market.

1766
01:28:44,356 --> 01:28:47,906
And by the market I mean
the available market

1767
01:28:47,906 --> 01:28:49,316
for your application.

1768
01:28:49,316 --> 01:28:52,566
Of course if you wanted to use
some API that's only available

1769
01:28:52,756 --> 01:28:54,646
in some later version of the OS,

1770
01:28:54,646 --> 01:28:57,536
then you will perhaps limit
yourself in terms of the market

1771
01:28:57,536 --> 01:28:58,756
that is available for that.

1772
01:28:59,166 --> 01:29:03,086
But the Android OS isn't the
only reason why this system

1773
01:29:03,156 --> 01:29:06,416
might be considered fragmented.

1774
01:29:07,206 --> 01:29:11,216
We also have things such as the
screen size and the density.

1775
01:29:11,636 --> 01:29:14,476
Like I s aid the actual
hardware devices are very,

1776
01:29:14,476 --> 01:29:15,216
very different.

1777
01:29:15,496 --> 01:29:18,486
And this is just-- I
intentionally left out some

1778
01:29:18,486 --> 01:29:20,486
of the explanation of some
of this but just to show you

1779
01:29:20,486 --> 01:29:22,506
that this is really
all over the place.

1780
01:29:22,756 --> 01:29:26,276
That screen size on the left
and screen density on the right

1781
01:29:26,656 --> 01:29:30,596
and Google goes through on the
web site on differentiating all

1782
01:29:30,596 --> 01:29:33,516
of this and sorts of the
exact pixel dimensions

1783
01:29:33,516 --> 01:29:37,086
and the exact number of
dots per inch in each

1784
01:29:37,086 --> 01:29:38,166
of the densities here.

1785
01:29:38,426 --> 01:29:42,026
But really we can see that
we have a problem and that is

1786
01:29:42,026 --> 01:29:45,256
that if you want to
create an application

1787
01:29:45,506 --> 01:29:48,346
for an Android device
that should work

1788
01:29:48,346 --> 01:29:49,786
on a multitude of devices.

1789
01:29:49,786 --> 01:29:51,816
You do have to contend
with this issue

1790
01:29:52,546 --> 01:29:54,726
that there are many
different types

1791
01:29:54,726 --> 01:29:56,696
of devices running many
different types of OS's

1792
01:29:57,166 --> 01:29:59,786
that have very different
hardware capabilities.

1793
01:30:00,646 --> 01:30:03,876
Now, to Google's credit,
they have done everything

1794
01:30:03,876 --> 01:30:06,756
that they can to try
to combat this issue.

1795
01:30:07,606 --> 01:30:12,286
They really try hard to
make it possible for you

1796
01:30:12,286 --> 01:30:16,556
to create an application
that can run on a lot

1797
01:30:16,556 --> 01:30:18,176
of this sorts of devices.

1798
01:30:18,916 --> 01:30:22,006
And in fact, one of the
ways that they are able

1799
01:30:22,046 --> 01:30:26,336
to do this is is through
this inclusion of resources

1800
01:30:26,826 --> 01:30:28,496
within an application.

1801
01:30:29,326 --> 01:30:31,776
So, there is an-- we're going
to get a little bit technical

1802
01:30:31,776 --> 01:30:34,526
at this moment before we kind
of come back a little bit wider

1803
01:30:34,526 --> 01:30:38,496
and talk about what exactly--
how exactly this works.

1804
01:30:38,866 --> 01:30:40,696
Oh, and looks like a
font is missing here.

1805
01:30:41,146 --> 01:30:45,856
So basically, application
resources are stored

1806
01:30:45,856 --> 01:30:47,906
in a resource folder,
so it says RES.

1807
01:30:47,906 --> 01:30:50,486
And there's a variety
of different folders,

1808
01:30:50,486 --> 01:30:53,866
it's a hierarchy of folders, and
within that, there's a variety

1809
01:30:53,866 --> 01:30:55,426
of other directories
that you can include

1810
01:30:55,426 --> 01:30:56,836
like a drawable directory

1811
01:30:57,116 --> 01:30:59,556
which will include bitmap
graphics or XML graphics.

1812
01:30:59,556 --> 01:31:01,776
And there's also a layout

1813
01:31:02,156 --> 01:31:05,586
so that you can actually add
layout information in XML form

1814
01:31:05,586 --> 01:31:07,706
or you can also add
many definitions

1815
01:31:07,706 --> 01:31:11,826
in a menu directory as well.

1816
01:31:12,266 --> 01:31:17,296
And what's really neat about
this set of directories is

1817
01:31:17,296 --> 01:31:19,706
that not only can
you localize strings,

1818
01:31:19,866 --> 01:31:23,976
but also you can modify the
name of the directory itself

1819
01:31:24,146 --> 01:31:27,246
to [inaudible] OS of what sort

1820
01:31:27,536 --> 01:31:29,856
of resources are
included in there.

1821
01:31:30,226 --> 01:31:33,346
So, let's say that you
create a game for instance.

1822
01:31:33,826 --> 01:31:38,796
And in that game, you have
perhaps a variety of assets,

1823
01:31:38,946 --> 01:31:42,086
a variety of graphics that you
created for different devices.

1824
01:31:42,086 --> 01:31:43,286
Perhaps you've created some--

1825
01:31:43,436 --> 01:31:45,426
well, it's something
low resolution graphics

1826
01:31:45,426 --> 01:31:49,546
for the lower DPI--
the lower DPI devices

1827
01:31:49,546 --> 01:31:51,616
or perhaps you created some
really high risk resolution

1828
01:31:51,616 --> 01:31:54,266
graphics for the larger
screens or for the devices

1829
01:31:54,266 --> 01:31:57,166
that have very, very
high DPI available.

1830
01:31:57,636 --> 01:32:01,746
And what you can do is very much
in the style of a CSS selector,

1831
01:32:01,876 --> 01:32:04,396
which you might remember from
your token web developments,

1832
01:32:04,696 --> 01:32:08,476
can you actually add some
properties to these folders

1833
01:32:08,476 --> 01:32:10,726
which are again not
intentionally masked here

1834
01:32:10,726 --> 01:32:14,126
but you-- we'll hope we see
them when you download the PDF

1835
01:32:14,126 --> 01:32:16,136
when it is posted
on the website.

1836
01:32:16,526 --> 01:32:19,416
But you can actually add
CSS style selectors or--

1837
01:32:19,716 --> 01:32:22,406
I don't actually don't
want to say that.

1838
01:32:22,406 --> 01:32:25,816
There are selectors in style
of sort of CSS in the way

1839
01:32:25,816 --> 01:32:27,556
that you can have these
different selectors

1840
01:32:28,286 --> 01:32:33,196
to target specific hardware
devices or specific OS versions

1841
01:32:33,576 --> 01:32:35,606
within each of these folders.

1842
01:32:36,506 --> 01:32:38,886
So, it becomes a
little bit better.

1843
01:32:39,116 --> 01:32:41,756
You don't have to
release different versions

1844
01:32:41,756 --> 01:32:45,206
of the same application, but
you do as you can imagine how

1845
01:32:45,206 --> 01:32:47,506
to create different
versions of these assets

1846
01:32:47,766 --> 01:32:49,246
for these different devices.

1847
01:32:49,846 --> 01:32:53,036
And even though there's
the arguments, well,

1848
01:32:53,166 --> 01:32:56,646
iOS is now fragmented between
the iPad, the iPad mini,

1849
01:32:56,986 --> 01:33:00,396
and the iPhone and
the older versions

1850
01:33:00,396 --> 01:33:01,976
which did not have
the retina displays.

1851
01:33:01,976 --> 01:33:03,696
And all of these different
things is really not quite

1852
01:33:04,216 --> 01:33:08,646
as bad as we have here on
Android, this is an attempt

1853
01:33:09,126 --> 01:33:12,936
on Google's part to make
it a little bit better.

1854
01:33:14,376 --> 01:33:17,696
Now, these resources
are in fact included

1855
01:33:17,836 --> 01:33:19,876
within the file that's
called an APK file.

1856
01:33:20,336 --> 01:33:23,996
An APK file is in fact
your Android application.

1857
01:33:24,876 --> 01:33:27,086
And what's neat about
this APK files

1858
01:33:27,086 --> 01:33:30,726
that you can actually download
an APK file on to your computer,

1859
01:33:30,976 --> 01:33:35,236
you can rename APK
to .ZIP, unzip it

1860
01:33:35,236 --> 01:33:38,966
and see what the contents of
that application actually is.

1861
01:33:38,966 --> 01:33:40,386
It's kind of an interesting
thing,

1862
01:33:40,386 --> 01:33:41,726
you can actually
see the resources

1863
01:33:41,726 --> 01:33:42,416
that are available there,

1864
01:33:42,656 --> 01:33:44,196
anything that is
not been compiled

1865
01:33:44,196 --> 01:33:45,506
that becomes very
easy to look at.

1866
01:33:45,506 --> 01:33:47,686
You can't look at the
original source code of course

1867
01:33:47,686 --> 01:33:49,806
because it's been
compiled and then included

1868
01:33:49,806 --> 01:33:52,826
within that ZIP file and
package into this Android format

1869
01:33:53,316 --> 01:33:55,446
but you can in fact look
at some of the resources

1870
01:33:55,766 --> 01:33:59,196
that are available
within that one file.

1871
01:33:59,316 --> 01:34:03,096
So, this is important to realize
that we have this APK file

1872
01:34:03,096 --> 01:34:04,976
which is in fact
this application

1873
01:34:05,156 --> 01:34:07,396
that we want to ultimately
create.

1874
01:34:08,866 --> 01:34:11,196
Within an application,
we have these resources.

1875
01:34:11,416 --> 01:34:15,046
Again there's-- you can create
resources that are generic

1876
01:34:15,046 --> 01:34:17,636
so that it would apply
to all hardware devices

1877
01:34:17,636 --> 01:34:19,316
or you could even make
them very specific

1878
01:34:19,316 --> 01:34:21,746
by having multiple
drawable directories

1879
01:34:21,746 --> 01:34:26,746
for different resolutions or
for different density screens.

1880
01:34:27,276 --> 01:34:29,746
And you can create
different strings directories

1881
01:34:29,746 --> 01:34:33,356
for localization, international
localization and so on.

1882
01:34:33,756 --> 01:34:39,186
But really, the heart of all of
the Android applications comes

1883
01:34:39,186 --> 01:34:43,176
from this one XML file
called Android Manifest file.

1884
01:34:44,136 --> 01:34:48,186
The Android Manifest file
basically tells the system,

1885
01:34:48,186 --> 01:34:52,056
the Android system when it is
launching your application,

1886
01:34:52,316 --> 01:34:56,186
what it should expect, what is
the name of this application,

1887
01:34:56,186 --> 01:34:58,536
what is the minimum
version of the OS

1888
01:34:59,056 --> 01:35:01,146
that I can run this application,

1889
01:35:01,146 --> 01:35:03,536
what are the different
screens called activities

1890
01:35:03,956 --> 01:35:05,696
that might be available,
what are the permissions

1891
01:35:05,696 --> 01:35:07,666
that this app requires, does
it require phone access,

1892
01:35:07,666 --> 01:35:09,906
does it require access
to my contacts,

1893
01:35:09,906 --> 01:35:13,896
does it require GPS access,
all of those sorts of things.

1894
01:35:13,896 --> 01:35:15,826
So, the OS parses
this information

1895
01:35:16,396 --> 01:35:17,826
and will make a determination,

1896
01:35:17,826 --> 01:35:21,426
the OS will actually decide
whether or not it can install

1897
01:35:21,426 --> 01:35:25,356
and run this application based
on the limits that you set

1898
01:35:25,596 --> 01:35:27,966
in this XML file and also
the limits of the device.

1899
01:35:28,936 --> 01:35:31,476
So, perhaps the user
rejects your permissions

1900
01:35:31,476 --> 01:35:35,786
because you want to do all sorts
of things on the user's device,

1901
01:35:35,786 --> 01:35:37,776
you have-- your permissions
are too lose

1902
01:35:38,116 --> 01:35:41,726
and they decided that's actually
not quite a good thing to do.

1903
01:35:42,006 --> 01:35:44,776
Well, you can modify all
of this information here

1904
01:35:44,776 --> 01:35:47,196
in your own application
towards that end.

1905
01:35:48,066 --> 01:35:51,136
Now, one of the things that
is really important to realize

1906
01:35:51,136 --> 01:35:55,836
about this as well is that
you'll notice that here, we're--

1907
01:35:55,836 --> 01:36:00,286
we define variety of things,
but within this application,

1908
01:36:00,286 --> 01:36:02,386
we actually have
some components.

1909
01:36:02,826 --> 01:36:05,136
Now, in this simplified
version of the XML file,

1910
01:36:05,476 --> 01:36:07,876
we have a single component
called an activity.

1911
01:36:08,396 --> 01:36:11,636
And this-- when we start
to talk about activities,

1912
01:36:11,636 --> 01:36:14,686
this is where really
starts deviate from the way

1913
01:36:14,686 --> 01:36:17,926
that we would expect it to work

1914
01:36:17,976 --> 01:36:21,196
if we only are familiar
with iOS devices.

1915
01:36:22,366 --> 01:36:26,526
In Android, it's really
difficult for us to talk

1916
01:36:26,526 --> 01:36:33,576
about an application as
a single all enclosed app

1917
01:36:34,516 --> 01:36:36,406
that runs entirely
with your code.

1918
01:36:37,386 --> 01:36:42,236
It is possible for
instance, if I am creating a--

1919
01:36:42,236 --> 01:36:45,886
let's say that I want
to create an application

1920
01:36:45,986 --> 01:36:50,866
that perhaps uploads some
photos from your phone

1921
01:36:50,866 --> 01:36:52,526
up into-- up to the web.

1922
01:36:52,696 --> 01:36:55,056
Perhaps I have a photo sharing
services some [inaudible]

1923
01:36:55,056 --> 01:36:57,186
and I want to be able to take
your photos from your phone,

1924
01:36:57,556 --> 01:37:01,356
user selected of course, upload
them and share them on the web.

1925
01:37:01,686 --> 01:37:03,606
So, perhaps we would
create this application

1926
01:37:03,846 --> 01:37:05,956
to actually pull
the user's photos

1927
01:37:05,956 --> 01:37:07,936
which everyone they select
from their photos app

1928
01:37:08,826 --> 01:37:14,176
and then upload those on behalf
of the user to the internet.

1929
01:37:15,256 --> 01:37:16,456
What's interesting about this is

1930
01:37:16,456 --> 01:37:22,676
that we can actually have a very
simple UI that presents the user

1931
01:37:22,716 --> 01:37:26,006
with a couple of options saying,
OK, we'll what, log in first

1932
01:37:26,006 --> 01:37:31,176
and tells what album you
want to add these photos to.

1933
01:37:31,846 --> 01:37:35,286
But when the user actually
goes to select the photo,

1934
01:37:35,616 --> 01:37:37,616
we could in fact
launch an activity

1935
01:37:37,616 --> 01:37:39,426
from an entirely
different application,

1936
01:37:39,426 --> 01:37:43,936
perhaps the photo application,
and have the user select one

1937
01:37:43,936 --> 01:37:45,826
of those photos in
that other application.

1938
01:37:46,836 --> 01:37:48,166
Is this relatively transparent?

1939
01:37:48,196 --> 01:37:50,516
What the user sees is that
they open up your app,

1940
01:37:50,996 --> 01:37:53,266
there's a couple of options,
you have to have to log in

1941
01:37:53,266 --> 01:37:56,266
or do whatever then they click
a little Choose Photo button

1942
01:37:56,906 --> 01:37:59,556
and it appears seamless to them
and that there's another window

1943
01:37:59,556 --> 01:38:01,406
that appears on top of that UI

1944
01:38:01,406 --> 01:38:02,946
that they are previously
interacting with.

1945
01:38:02,946 --> 01:38:04,716
So, it appears as though
it's one application,

1946
01:38:05,046 --> 01:38:05,946
but now all of a sudden,

1947
01:38:05,946 --> 01:38:08,286
it's a photo selector
probably different application

1948
01:38:08,286 --> 01:38:09,006
all together.

1949
01:38:09,406 --> 01:38:13,546
Now, this sounds
kind of convoluted

1950
01:38:13,986 --> 01:38:15,826
but there's a great
power to this

1951
01:38:16,236 --> 01:38:19,206
and that we can generalize
them, we can have this--

1952
01:38:19,206 --> 01:38:22,726
this become very generalized
if you wanted to include,

1953
01:38:22,726 --> 01:38:26,186
say drop box support
in your application.

1954
01:38:26,186 --> 01:38:27,026
You could actually make sure

1955
01:38:27,026 --> 01:38:30,096
that the drop box application
was installed and asked drop box

1956
01:38:30,096 --> 01:38:32,176
to run the log in activity

1957
01:38:32,346 --> 01:38:34,796
and have the drop box
application deal entirely

1958
01:38:34,796 --> 01:38:37,926
with the authentication
mechanism or perhaps you want

1959
01:38:37,926 --> 01:38:41,616
to have your users be
able to select one contact

1960
01:38:41,616 --> 01:38:43,546
out of their contact list rather

1961
01:38:43,546 --> 01:38:46,326
than fetching all the contact
information and displaying it

1962
01:38:46,326 --> 01:38:49,736
to them, you can in fact ask
the contact application itself

1963
01:38:50,266 --> 01:38:51,666
to show the contact list

1964
01:38:51,666 --> 01:38:53,956
and have the user select
one of those context.

1965
01:38:55,216 --> 01:38:58,116
So, we have to differentiate
between this idea

1966
01:38:58,116 --> 01:39:00,766
of an application which
is what we would create

1967
01:39:00,766 --> 01:39:02,986
and would be always
self-contained

1968
01:39:03,516 --> 01:39:05,346
and what the user
would actually run.

1969
01:39:05,346 --> 01:39:07,196
When the user actually
runs this application,

1970
01:39:07,196 --> 01:39:09,866
it becomes a slightly
different turn that Google likes

1971
01:39:09,866 --> 01:39:10,736
to use called the task.

1972
01:39:12,366 --> 01:39:14,866
And the reason that is called
a task [inaudible] applications

1973
01:39:14,866 --> 01:39:18,676
because this task could actually
run multiple applications

1974
01:39:18,956 --> 01:39:19,996
[inaudible] to the user.

1975
01:39:20,536 --> 01:39:23,696
Again, in the same context
whereby they start your

1976
01:39:23,696 --> 01:39:28,606
application and in this
application, we want the user

1977
01:39:28,606 --> 01:39:30,426
to be able to select a photo.

1978
01:39:30,736 --> 01:39:32,386
So now, we have our
application running

1979
01:39:32,386 --> 01:39:33,776
and they see this one activity.

1980
01:39:33,936 --> 01:39:38,046
By the way, an activity is just
a screen interface to the user

1981
01:39:38,046 --> 01:39:39,806
that the user have
actually interact

1982
01:39:39,806 --> 01:39:42,746
with one screen is
essentially one activity.

1983
01:39:43,436 --> 01:39:45,366
So, we have our own
activity here.

1984
01:39:45,366 --> 01:39:47,796
Now, our application request

1985
01:39:47,876 --> 01:39:50,266
from the photos app,
the photo selector.

1986
01:39:50,646 --> 01:39:53,776
And so now, another activity
comes over then masks the one

1987
01:39:53,776 --> 01:39:58,146
that we had below but, we
have two applications running.

1988
01:39:59,206 --> 01:39:59,936
So, this is the difference

1989
01:39:59,936 --> 01:40:01,476
between the task
in an application.

1990
01:40:01,476 --> 01:40:03,886
Application is what we are
creating and is something

1991
01:40:03,886 --> 01:40:07,916
that we are-- that we are
eventually going to run.

1992
01:40:08,386 --> 01:40:12,716
But you have to realize that
activities are not necessarily

1993
01:40:13,026 --> 01:40:15,386
so specific to your
application that it's only run

1994
01:40:15,386 --> 01:40:19,446
by your application, depending
on the properties that you apply

1995
01:40:19,636 --> 01:40:22,906
to this activity it's possible
for you to create an activity

1996
01:40:23,086 --> 01:40:25,876
that someone else's
application could then run.

1997
01:40:27,036 --> 01:40:32,796
So, again the example here would
be say, a contacts application

1998
01:40:32,796 --> 01:40:36,856
or let's say that I am creating
the new social media platform

1999
01:40:36,856 --> 01:40:39,576
or what have you and I actually
want the user to be able

2000
01:40:39,576 --> 01:40:43,446
to select one of their
contacts from the Android device

2001
01:40:44,176 --> 01:40:46,846
and rather than create
a contact list

2002
01:40:46,846 --> 01:40:50,766
on my own I can just request
from the contacts app to show

2003
01:40:50,766 --> 01:40:53,186
that contact selector,
that contact list

2004
01:40:53,186 --> 01:40:56,106
and have it return the
data to my application.

2005
01:40:56,646 --> 01:41:01,176
So, this is just a difference
in terminology, a difference

2006
01:41:01,176 --> 01:41:07,136
in implementation, already
this provides quite a lot of,

2007
01:41:07,136 --> 01:41:08,976
a lot of power and
a lot of openness.

2008
01:41:09,586 --> 01:41:12,396
Notice that in-- I
never said that--

2009
01:41:12,626 --> 01:41:15,366
well, maybe I did say
but I didn't mean to say

2010
01:41:15,366 --> 01:41:19,226
that there is the contacts
app, there is one built

2011
01:41:19,226 --> 01:41:21,136
in contacts app that
you always have to use.

2012
01:41:21,136 --> 01:41:25,796
Due to this sort of open
nature of Android it's possible

2013
01:41:25,796 --> 01:41:29,526
to create a competing
contacts app place it

2014
01:41:29,526 --> 01:41:31,746
on the Google Play
store and that's--

2015
01:41:31,746 --> 01:41:33,676
and then your users
could then interface

2016
01:41:33,676 --> 01:41:37,176
with that contacts app, with
that new contact app instead.

2017
01:41:37,986 --> 01:41:42,506
So, rather than when my
application request a contact

2018
01:41:42,506 --> 01:41:44,326
from the contact
list, rather than go

2019
01:41:44,326 --> 01:41:48,456
to necessarily the default
application it could provide the

2020
01:41:48,456 --> 01:41:49,436
user with the choice.

2021
01:41:49,436 --> 01:41:53,036
Well, I see you how multiple
contacts apps installed

2022
01:41:53,326 --> 01:41:57,216
on your device how or rather
which application do you want

2023
01:41:57,216 --> 01:42:00,536
to use to select this contact?

2024
01:42:00,536 --> 01:42:04,166
Perhaps another example would be
let's say that you just have a--

2025
01:42:04,166 --> 01:42:08,176
an activity that's very
simple which has URL on it,

2026
01:42:08,636 --> 01:42:10,416
you click on that URL,
you don't want to--

2027
01:42:10,416 --> 01:42:14,636
you don't want to implement an
entire web browser yourself,

2028
01:42:14,876 --> 01:42:17,866
and so you figure OK, well now
I can just launch a web browser

2029
01:42:17,866 --> 01:42:21,586
activity from another program to
show that webpage to the user,

2030
01:42:22,546 --> 01:42:24,556
you can imagine this-- you
can envision the scenario

2031
01:42:24,556 --> 01:42:27,886
where there's multiple browsers
installed on this computer

2032
01:42:28,086 --> 01:42:32,356
or a computer yes, but
also on this device,

2033
01:42:32,666 --> 01:42:34,886
there's multiple browsers
installed and perhaps Chrome,

2034
01:42:34,886 --> 01:42:37,506
perhaps Opera, maybe
some others as well

2035
01:42:37,886 --> 01:42:39,856
and you could provide the user

2036
01:42:39,856 --> 01:42:43,746
and by you I mean this
happens automatically the--

2037
01:42:44,016 --> 01:42:47,326
by the user clicking on
that URL and you requesting

2038
01:42:47,326 --> 01:42:49,576
from the Google operating system

2039
01:42:49,576 --> 01:42:51,586
from the Android operating
system that you want

2040
01:42:51,586 --> 01:42:56,486
to open a URL it might realize,
oh hey, there's two programs,

2041
01:42:56,866 --> 01:43:00,446
there's two applications that
actually support this type

2042
01:43:00,446 --> 01:43:02,406
of data, which one
do you want to use?

2043
01:43:02,406 --> 01:43:04,366
Do you want to use Chrome
or do you want to use Opera?

2044
01:43:05,096 --> 01:43:08,666
This can then select one of
those two options and proceed

2045
01:43:08,666 --> 01:43:14,246
to show that that information,
that webpage or that webpage

2046
01:43:14,246 --> 01:43:16,746
in whatever browser they
choose and again it appears

2047
01:43:16,746 --> 01:43:17,766
to be relatively seamless,

2048
01:43:17,766 --> 01:43:21,256
it doesn't look its swaps
applications to this other--

2049
01:43:21,256 --> 01:43:25,146
to this other web browser it
instead just loads an activity

2050
01:43:25,146 --> 01:43:28,046
in front of the one
that you are using.

2051
01:43:28,886 --> 01:43:33,126
So, there's a variety of--
there's a variety of components

2052
01:43:33,126 --> 01:43:35,556
that can be part of
your application,

2053
01:43:35,776 --> 01:43:39,316
the activity is sort of the
simplest one in the sense

2054
01:43:39,316 --> 01:43:42,846
that it-- this is that UI that
the user is going to interface

2055
01:43:42,846 --> 01:43:45,516
with and what we are going
to see in some code examples

2056
01:43:45,516 --> 01:43:48,436
in little while or just
various forms of activities,

2057
01:43:48,716 --> 01:43:52,106
but there's also different
types of components that exist

2058
01:43:52,106 --> 01:43:54,206
in an Android device as well.

2059
01:43:54,656 --> 01:43:57,906
So, these activities, single
screen with the user interface

2060
01:43:58,136 --> 01:44:00,516
if you want have multiple
screens you certainly can

2061
01:44:00,516 --> 01:44:02,846
but that means that you're going
to have multiple activities,

2062
01:44:03,556 --> 01:44:05,526
that's not that big of
a deal it's just sort

2063
01:44:05,526 --> 01:44:07,156
of an interesting thing to note.

2064
01:44:07,616 --> 01:44:10,256
Another type of component that
you could have is a service

2065
01:44:10,256 --> 01:44:11,876
which would be just
the background task

2066
01:44:12,276 --> 01:44:14,286
for long running operations,
let's say that you want

2067
01:44:14,286 --> 01:44:17,606
to upload some information
to your web server,

2068
01:44:17,766 --> 01:44:20,266
let's say let's go back
to that earlier example

2069
01:44:20,266 --> 01:44:23,146
of having this photo
sharing website and I want

2070
01:44:23,146 --> 01:44:26,276
to have the user selective
photo and be able to upload it

2071
01:44:26,466 --> 01:44:29,806
to my website, if it's a big
photo we can run a service

2072
01:44:29,976 --> 01:44:30,616
that uploads it

2073
01:44:30,616 --> 01:44:33,606
in the background while
the user does other things,

2074
01:44:33,796 --> 01:44:35,756
we don't have to
be bother with it.

2075
01:44:35,756 --> 01:44:38,086
Another example of a service
might be music player,

2076
01:44:38,606 --> 01:44:41,636
you might have an activity
that actually is the interface

2077
01:44:41,676 --> 01:44:45,706
to that music player with play,
pause, stop, volume, control,

2078
01:44:45,706 --> 01:44:49,246
forward, backward, so on, and
so forth but the actual playing

2079
01:44:49,246 --> 01:44:52,216
of the music occurs in
the service which occurs

2080
01:44:52,216 --> 01:44:54,796
in the background which
allow you to change tasks,

2081
01:44:55,016 --> 01:44:58,126
again this word tasks which
would allow you to change task

2082
01:44:58,126 --> 01:45:00,106
so they could go their web
browser and continue listening

2083
01:45:00,316 --> 01:45:01,946
to music from your same player.

2084
01:45:02,506 --> 01:45:03,866
Now, there's a couple
of other things

2085
01:45:04,346 --> 01:45:08,566
that that could a little bit
more specific but just listed

2086
01:45:08,566 --> 01:45:12,026
in the interest of completeness
the content provider is a way,

2087
01:45:12,026 --> 01:45:14,166
it's just of a standard
interface

2088
01:45:14,496 --> 01:45:16,696
for applications to
access your data.

2089
01:45:17,436 --> 01:45:19,676
So, if I actually
wanted to pull some data

2090
01:45:19,676 --> 01:45:22,236
from a common application
like contacts

2091
01:45:22,306 --> 01:45:25,736
or photos this is separate from
the idea of actually bringing

2092
01:45:25,736 --> 01:45:28,476
up activities, but maybe
there is some interface

2093
01:45:28,476 --> 01:45:32,276
that I actually want to expose
to allow other applications

2094
01:45:32,646 --> 01:45:35,266
to access the data that my
application will actually

2095
01:45:35,266 --> 01:45:37,266
create, content provider
is the way do that,

2096
01:45:37,616 --> 01:45:42,226
broadcast receivers response
to system-wide announcements.

2097
01:45:42,226 --> 01:45:45,056
So, the tone will
actually broadcast to all

2098
01:45:45,056 --> 01:45:47,356
of the applications that
the screen has gone,

2099
01:45:47,356 --> 01:45:49,856
the screen has gone dim or that
the battery is running low,

2100
01:45:49,856 --> 01:45:52,356
or that the white Wi-Fi has been
turned on of off, or a variety

2101
01:45:52,356 --> 01:45:55,526
of other things and even
applications themselves can send

2102
01:45:55,526 --> 01:45:59,526
broadcast to the entire system
as a whole and you can define

2103
01:45:59,846 --> 01:46:02,176
which if any of these
that you're interested

2104
01:46:02,176 --> 01:46:05,496
in actually respond
to them which is kind

2105
01:46:05,496 --> 01:46:09,066
of an interesting thing,
allows certainly a bit of power

2106
01:46:09,396 --> 01:46:11,136
in what your application can do.

2107
01:46:11,506 --> 01:46:13,356
Now, activity is meant to--

2108
01:46:13,356 --> 01:46:16,176
because it's user facing
it's going to be given a lot

2109
01:46:16,176 --> 01:46:20,276
of priority by the Android OS
whenever is actually being run.

2110
01:46:20,276 --> 01:46:24,116
So, this would get a fair
amount of CPU time as, you know,

2111
01:46:24,306 --> 01:46:27,986
Android OS has been-- has
allowed background applications

2112
01:46:27,986 --> 01:46:31,366
and background task to be run
for quite a while now and one

2113
01:46:31,366 --> 01:46:32,176
of their solutions was

2114
01:46:32,176 --> 01:46:35,256
to prioritize what the user
is actually interfacing with.

2115
01:46:35,636 --> 01:46:40,716
Services, they'd also tend to be
prioritized relatively compared

2116
01:46:40,716 --> 01:46:43,066
to some other things
but not quite as much

2117
01:46:43,066 --> 01:46:45,996
as the user facing activity
if they're running out of RAM

2118
01:46:45,996 --> 01:46:48,586
for example perhaps it
will free up some services

2119
01:46:48,586 --> 01:46:50,986
that were running
stale or running

2120
01:46:51,666 --> 01:46:53,256
that the user wasn't
actually using.

2121
01:46:53,676 --> 01:46:56,946
Content providers and broadcast
receivers these are smaller

2122
01:46:56,946 --> 01:46:59,266
things, but they're meant to be
very lightweight, they're meant

2123
01:46:59,266 --> 01:47:02,676
to be-- this is something
that's happening as a result

2124
01:47:02,676 --> 01:47:06,276
of this system call, so
let's get it done quickly

2125
01:47:06,476 --> 01:47:09,766
and be done with it.

2126
01:47:10,776 --> 01:47:13,996
Are there any questions
on this so far?

2127
01:47:13,996 --> 01:47:18,356
I realized this a little
abstract, mostly in attempts

2128
01:47:18,356 --> 01:47:20,826
to point out some of the
differences between the way

2129
01:47:20,826 --> 01:47:25,146
that iOS would work compared to
how Android actually function.

2130
01:47:26,796 --> 01:47:31,386
Oops, so how then do
we actually create one

2131
01:47:31,616 --> 01:47:33,696
of these applications?

2132
01:47:34,206 --> 01:47:39,406
Well, the short answer is that
you go to developer.android.com

2133
01:47:39,406 --> 01:47:40,866
and this actually for you

2134
01:47:40,866 --> 01:47:43,236
as an Android developers
you're home based,

2135
01:47:43,636 --> 01:47:45,866
there's an enormous
amount of information here,

2136
01:47:46,156 --> 01:47:48,126
the API documentation,
there's a lot

2137
01:47:48,126 --> 01:47:51,986
of updates whenever new versions
come out, there's a lot--

2138
01:47:51,986 --> 01:47:55,056
I mean there's just a wealth of
information that's fantastic,

2139
01:47:55,056 --> 01:47:58,846
you can also download the
SDK from this website.

2140
01:47:59,196 --> 01:48:01,956
You'll notice if you go
to the website though

2141
01:48:01,956 --> 01:48:03,846
that there's two
versions of the SDK,

2142
01:48:03,846 --> 01:48:05,646
there's software
development kit, the SDK

2143
01:48:05,646 --> 01:48:08,456
and the native development
kit, the NDK.

2144
01:48:09,146 --> 01:48:12,066
The native development kit is a
bit lower level, it allows you

2145
01:48:12,066 --> 01:48:17,106
to write high performance
applications in C or C++

2146
01:48:17,716 --> 01:48:21,906
and basically embed them
within an Android application.

2147
01:48:21,906 --> 01:48:25,496
We're going to essentially
ignore the NDK,

2148
01:48:25,736 --> 01:48:27,236
but if you are interested

2149
01:48:27,236 --> 01:48:30,626
in high performance native
applications because you need

2150
01:48:30,626 --> 01:48:32,726
to create a game for example

2151
01:48:32,726 --> 01:48:35,706
of very graphics intensive
game then you might pay more

2152
01:48:35,706 --> 01:48:38,106
attention to the NDK,
but for the vast majority

2153
01:48:38,106 --> 01:48:40,516
of us we don't really care about
that, it's nice that it's there

2154
01:48:40,516 --> 01:48:42,126
but we're not going
to quite use it,

2155
01:48:42,126 --> 01:48:44,886
the software development
kit is the way to go.

2156
01:48:45,306 --> 01:48:47,636
So, there's a couple of
things to note about the SDK,

2157
01:48:47,636 --> 01:48:51,056
first when we create an Android
application we're actually

2158
01:48:51,056 --> 01:48:55,186
writing code in Java, the end
result isn't the Java program

2159
01:48:55,186 --> 01:48:57,916
and I'll explain more about that
in just a moment, but the code

2160
01:48:57,916 --> 01:49:00,986
that we write is
actually in Java.

2161
01:49:00,986 --> 01:49:05,096
We use and we can use if
we want, again as part

2162
01:49:05,096 --> 01:49:11,566
of this openness, that slightly
more open idea we could use a

2163
01:49:11,566 --> 01:49:15,266
variety of different
development environments,

2164
01:49:15,546 --> 01:49:18,256
the one that's recommended in
that would actually include

2165
01:49:18,256 --> 01:49:20,186
with the SDK if you
download it as a clips,

2166
01:49:20,436 --> 01:49:22,996
you could just use plain text
files if you wanted you can kind

2167
01:49:22,996 --> 01:49:24,626
of do it however you
want but you'll notice

2168
01:49:24,626 --> 01:49:27,336
that using a clips
tends to be the fastest

2169
01:49:27,536 --> 01:49:29,326
and the best option for us.

2170
01:49:30,366 --> 01:49:33,666
So, what then-- how then--

2171
01:49:33,876 --> 01:49:38,946
what is the process for us to
build an Android application?

2172
01:49:38,946 --> 01:49:41,376
I mentioned that we have
to write the code in Java

2173
01:49:42,406 --> 01:49:45,896
and there is a few
important things that are--

2174
01:49:45,896 --> 01:49:48,476
that distinguish this from
Java and I'll point those

2175
01:49:48,476 --> 01:49:51,086
out when we actually look
at a hello world example,

2176
01:49:51,656 --> 01:49:55,616
then we have to compile this
into some Java bite code just

2177
01:49:55,616 --> 01:49:58,036
as we would a regular
Java program,

2178
01:49:58,536 --> 01:50:02,976
but Android itself doesn't
actually run Java code.

2179
01:50:03,706 --> 01:50:07,686
In fact the Android platform
is a modified version of Linux

2180
01:50:07,956 --> 01:50:11,136
that runs something called
the Dalvik Virtual Machine.

2181
01:50:11,556 --> 01:50:14,926
So, whereas in Java, it actually
runs a Java Virtual Machine

2182
01:50:14,926 --> 01:50:16,936
to run and execute
the Java bytecode

2183
01:50:16,936 --> 01:50:19,926
that has been compiled
by the Java compiler.

2184
01:50:21,236 --> 01:50:24,186
Google has created a
slightly different version

2185
01:50:24,446 --> 01:50:30,556
of this virtual machine
that is a little bit more--

2186
01:50:30,836 --> 01:50:33,626
well, it pays more attention
to things like memory usage

2187
01:50:33,626 --> 01:50:37,886
and CPU time and is a little
bit more fair with regard to all

2188
01:50:37,886 --> 01:50:40,916
of those things because in
this mobile environment we have

2189
01:50:40,916 --> 01:50:44,076
to be very careful about battery
usage and the amount of time

2190
01:50:44,076 --> 01:50:48,066
that we spent in each
of these applications.

2191
01:50:48,506 --> 01:50:53,896
So this bytecode is converted to
a Dalvik compatible executable

2192
01:50:53,896 --> 01:50:56,756
which is basically just
the modified version,

2193
01:50:56,756 --> 01:50:58,246
again, of this bytecode.

2194
01:50:58,406 --> 01:51:01,306
It is running in
essence Java bytecode

2195
01:51:01,306 --> 01:51:02,236
but it's been converted,

2196
01:51:02,236 --> 01:51:03,476
some things have
actually been changed

2197
01:51:03,476 --> 01:51:05,316
to be compatible
with this Dalvik VM.

2198
01:51:06,166 --> 01:51:10,646
So, it's derived from Java
but it's not exactly the same.

2199
01:51:11,626 --> 01:51:14,226
But this process allows us
to write the code in Java

2200
01:51:14,546 --> 01:51:17,396
and then creates and compiles it

2201
01:51:17,396 --> 01:51:20,686
into an application that's
actually run and understood

2202
01:51:20,736 --> 01:51:24,146
by this Dalvik VM within
the Android Platform.

2203
01:51:24,986 --> 01:51:26,466
Now after that we
have to package it

2204
01:51:26,466 --> 01:51:31,326
up in a special way using
Zip in a tool called AAPT

2205
01:51:31,326 --> 01:51:33,266
which actually includes
some of the--

2206
01:51:33,266 --> 01:51:36,106
well actually pre-compiles
some of the information

2207
01:51:36,106 --> 01:51:38,086
that we have including
the Android manifest file

2208
01:51:38,086 --> 01:51:38,966
and variety of other things

2209
01:51:38,966 --> 01:51:41,806
and actually creates
an Android package.

2210
01:51:42,326 --> 01:51:44,436
So, you might remember that--

2211
01:51:44,436 --> 01:51:47,836
I said before that this
has gotten a bit easier.

2212
01:51:48,086 --> 01:51:51,016
Well, it's always been a
little bit easier than is,

2213
01:51:51,016 --> 01:51:53,046
as if you are kind of the hard--

2214
01:51:53,276 --> 01:51:56,676
the hardcore hacker person that
loves to do everything manually,

2215
01:51:56,676 --> 01:51:57,696
you can certainly do this.

2216
01:51:58,316 --> 01:52:02,066
But for the rest of us you
can just download the SDK

2217
01:52:02,066 --> 01:52:04,596
which includes Eclipse, the IDE,

2218
01:52:04,596 --> 01:52:07,626
and also the Android tools
plug-in, the ATT plug-in

2219
01:52:08,046 --> 01:52:10,166
and allows you basically
just to go straight

2220
01:52:10,166 --> 01:52:15,356
from the code directly to the
end result, the Android package.

2221
01:52:15,826 --> 01:52:22,936
You can find all of these on
developer.Android.com and one

2222
01:52:22,936 --> 01:52:24,826
of the ways that it
is much easier now is

2223
01:52:24,826 --> 01:52:29,036
that they actually package all
of these up into one download,

2224
01:52:29,106 --> 01:52:29,956
that means so much easier.

2225
01:52:29,956 --> 01:52:31,336
Before it was really a pain.

2226
01:52:31,666 --> 01:52:33,766
You just download Eclipse and
then you had to download the SDK

2227
01:52:33,766 --> 01:52:37,516
and you had to download the
Eclipse plug-in and you get all

2228
01:52:37,516 --> 01:52:39,826
to work together but luckily we
don't have to do that anymore.

2229
01:52:40,036 --> 01:52:42,836
It comes in just one nice
package, makes it very easy

2230
01:52:42,836 --> 01:52:44,936
for us to do development.

2231
01:52:45,466 --> 01:52:48,316
So, again, if you're
actually interested in this,

2232
01:52:48,316 --> 01:52:52,816
go to the website
developer.Android.com/sdk/index.

2233
01:52:53,326 --> 01:52:55,126
Download the SDK and that's it,

2234
01:52:55,476 --> 01:52:58,996
you pretty much can get
started with it right away.

2235
01:52:59,486 --> 01:53:03,466
So from here, how do we
actually create an application?

2236
01:53:03,466 --> 01:53:07,406
Well, of course, the
HelloWorldApp is the--

2237
01:53:07,406 --> 01:53:09,616
well, the simplest
thing that we can do

2238
01:53:09,616 --> 01:53:11,566
to actually create
an application.

2239
01:53:11,566 --> 01:53:13,386
And there's a couple of
things that I want to point

2240
01:53:13,386 --> 01:53:18,166
out about the code in this
HelloWorldApp and I'm going

2241
01:53:18,166 --> 01:53:26,146
to switch here to
this other screen

2242
01:53:27,476 --> 01:53:31,266
because it has better text color

2243
01:53:31,336 --> 01:53:32,976
and it makes it a
little bit easier

2244
01:53:32,976 --> 01:53:34,726
to take a look at
what's going on.

2245
01:53:34,726 --> 01:53:39,346
So, the very top of this Java
file, we basically have a couple

2246
01:53:39,346 --> 01:53:42,206
of things, one is
package information.

2247
01:53:42,206 --> 01:53:45,976
How many of you have developed
for Java in the past or at all?

2248
01:53:46,456 --> 01:53:48,466
Pretty much everybody, OK.

2249
01:53:48,466 --> 01:53:52,966
So for those of you that
haven't, it's very similar

2250
01:53:52,966 --> 01:53:55,436
in syntax to C or C++,

2251
01:53:55,436 --> 01:53:57,276
but of course there's a
variety of differences.

2252
01:53:57,276 --> 01:54:00,026
It's going to be very
heavily object-oriented.

2253
01:54:00,356 --> 01:54:02,586
I'll try to point out as
many differences as I can.

2254
01:54:02,586 --> 01:54:05,906
But I don't really want to
do a Java primer right now.

2255
01:54:06,466 --> 01:54:09,906
There's-- If you do a search

2256
01:54:09,906 --> 01:54:13,716
for Java tutorials you will find
some very excellent tutorials

2257
01:54:13,716 --> 01:54:17,046
by Oracle that talked a
little bit more about this.

2258
01:54:17,546 --> 01:54:20,966
But we have to put all of
this code into the scope

2259
01:54:20,966 --> 01:54:24,406
of a package, into a
particular name space,

2260
01:54:24,406 --> 01:54:25,966
and so that's what we are
doing in this first line.

2261
01:54:26,386 --> 01:54:29,026
Then we're going to import
a variety of libraries

2262
01:54:29,026 --> 01:54:32,276
that actually make it possible
for us to run this code--

2263
01:54:32,686 --> 01:54:36,486
the activity library which we
just talked about and couple

2264
01:54:36,486 --> 01:54:39,366
of other things we're sure
actually required for us

2265
01:54:39,366 --> 01:54:43,016
to run this, the bundle
is required by the OS.

2266
01:54:43,016 --> 01:54:45,936
This log one-- is it really
required unless we're doing

2267
01:54:45,936 --> 01:54:48,646
logging which there's some very
basic logging at the very bottom

2268
01:54:48,646 --> 01:54:50,166
of this of code which will occur

2269
01:54:50,166 --> 01:54:52,476
in just a second
and also a widget.

2270
01:54:52,476 --> 01:54:56,656
You can maybe guess by the
name what this actually does

2271
01:54:56,656 --> 01:54:58,486
but it's essentially
this, it allows you

2272
01:54:58,486 --> 01:55:02,416
to place a text object on
the activity and allow you

2273
01:55:02,416 --> 01:55:05,836
to view some text on
that, on the screen.

2274
01:55:06,296 --> 01:55:11,706
So, that's just all sorts of
some initial setup that we have

2275
01:55:11,706 --> 01:55:15,336
to do and this is the
contents of the code.

2276
01:55:15,336 --> 01:55:16,916
Now one thing that you'll
notice for those of you

2277
01:55:16,916 --> 01:55:18,476
that are Java developers
that's very different

2278
01:55:18,476 --> 01:55:21,666
from other things is that
there's no main method.

2279
01:55:22,586 --> 01:55:25,596
There is no method that
makes it very obvious

2280
01:55:25,946 --> 01:55:30,436
where we're actually starting
the application and the reason

2281
01:55:30,436 --> 01:55:33,746
for that is that the
main method is done

2282
01:55:33,746 --> 01:55:36,826
by the operating system itself.

2283
01:55:36,826 --> 01:55:40,486
What the OS does is it
looks at the manifest file

2284
01:55:40,766 --> 01:55:41,986
that we've actually created.

2285
01:55:41,986 --> 01:55:47,016
And so this is a full-pledged
Android manifest file

2286
01:55:47,316 --> 01:55:50,576
that has been not
reducted for simplicity.

2287
01:55:50,856 --> 01:55:53,106
So we can actually see how
some of these things work.

2288
01:55:53,476 --> 01:55:56,106
Again, notice that this is
the manifest XML element,

2289
01:55:56,566 --> 01:55:59,736
uses a minimum SDK version
of 3 which is now ancient.

2290
01:55:59,736 --> 01:56:02,046
There's no need for
you to use version 3,

2291
01:56:02,046 --> 01:56:03,846
just like Android
1.5 or something.

2292
01:56:04,256 --> 01:56:06,996
So, only if you want maximum
compatibility do you really need

2293
01:56:06,996 --> 01:56:07,456
to do that.

2294
01:56:07,656 --> 01:56:11,286
But even then there's problems
using minimum SDK version of 3.

2295
01:56:11,596 --> 01:56:13,656
It implies certain permissions

2296
01:56:13,656 --> 01:56:17,516
that are not necessarily
what you would want.

2297
01:56:17,516 --> 01:56:21,166
I think it wants full access to
contacts and some other stuff

2298
01:56:21,206 --> 01:56:25,226
that if you just upgrade the
minimum SDK version to 4 or 5,

2299
01:56:25,596 --> 01:56:28,776
then you lose a lot of these
problems that actually existed.

2300
01:56:28,776 --> 01:56:31,606
But this is meant for
maximum compatibility here.

2301
01:56:32,026 --> 01:56:34,846
Now, the application within
the 3 actually defined

2302
01:56:35,066 --> 01:56:36,676
where the icon is for that app

2303
01:56:36,676 --> 01:56:38,336
on the home screen
of the device.

2304
01:56:38,856 --> 01:56:40,956
It's within-- You'll
notice at Drupal [phonetic].

2305
01:56:40,956 --> 01:56:43,686
Remember I mentioned that Drupal
directory within our resources.

2306
01:56:44,056 --> 01:56:46,686
We can have various
resolutions of our icons

2307
01:56:46,686 --> 01:56:49,316
to support the different
density and different size

2308
01:56:49,316 --> 01:56:51,926
of the screens that might exist.

2309
01:56:51,926 --> 01:56:55,126
Similarly, can we actually
apply a label to the name

2310
01:56:55,126 --> 01:56:59,416
of that application within the
string resource and provide--

2311
01:56:59,726 --> 01:57:02,126
you'll notice that here we're
looking for specific resource

2312
01:57:02,126 --> 01:57:05,946
within the string directory
called an app name which--

2313
01:57:06,866 --> 01:57:11,296
you'll just have to-- you'll
just have to trust me for now

2314
01:57:11,296 --> 01:57:13,556
that says something in English.

2315
01:57:13,976 --> 01:57:16,646
Now, if we skip this
and go down to activity,

2316
01:57:16,646 --> 01:57:19,246
notice that we have
defined one activity here.

2317
01:57:19,246 --> 01:57:23,796
And within it, we have this
idea of an intent filter.

2318
01:57:24,386 --> 01:57:29,036
And what this intent filter
actually does is it notifies the

2319
01:57:29,036 --> 01:57:32,816
OS what's this activity should
actually do and there's variety

2320
01:57:32,816 --> 01:57:34,766
of filters that we
can apply to it.

2321
01:57:34,766 --> 01:57:38,506
Perhaps we want to restrict
this activity from being open

2322
01:57:38,836 --> 01:57:40,036
in other applications.

2323
01:57:40,036 --> 01:57:41,696
Remember that I mentioned
that we can task,

2324
01:57:41,696 --> 01:57:45,026
we can have other applications
request in activity.

2325
01:57:45,696 --> 01:57:47,616
We can explicitly
disallow or allow

2326
01:57:47,616 --> 01:57:51,446
that with this intent filters
but also we apply these

2327
01:57:51,446 --> 01:57:55,396
to elements to this intent
filter telling the OS

2328
01:57:55,396 --> 01:57:58,796
that this is the main
activity and this is the one

2329
01:57:58,796 --> 01:58:01,106
that I launched on boot.

2330
01:58:01,386 --> 01:58:04,976
Or on boot is opening
the application itself.

2331
01:58:05,506 --> 01:58:08,176
And so really there's
no main method that is

2332
01:58:08,176 --> 01:58:11,666
because we've hold the Android
OS that we have this activity

2333
01:58:11,666 --> 01:58:14,386
and this is the one
that we want to run.

2334
01:58:15,626 --> 01:58:17,486
Now, the activity
itself-- excuse me--

2335
01:58:17,486 --> 01:58:21,236
the activity itself goes
through a life cycles of sorts.

2336
01:58:21,236 --> 01:58:24,796
There're a variety of methods
that allow you to run some code

2337
01:58:24,796 --> 01:58:28,066
when the activity is first been
called upon to actually open

2338
01:58:28,436 --> 01:58:30,686
and then things have been
rendered on the screen

2339
01:58:30,686 --> 01:58:33,046
and then it's finally
ready for use by the user.

2340
01:58:33,256 --> 01:58:37,086
We're going to ignore a lot of
those for now and I'll defer

2341
01:58:37,086 --> 01:58:39,286
to the Android documentation
for you

2342
01:58:39,286 --> 01:58:40,576
to get more information on that.

2343
01:58:41,806 --> 01:58:46,336
But now we can take a look
again at our HelloWorld code

2344
01:58:46,796 --> 01:58:49,336
and realize how this
is actually working.

2345
01:58:49,626 --> 01:58:51,256
We have a public class Code One.

2346
01:58:51,306 --> 01:58:55,306
This is just the class for this
one activity, extends activity

2347
01:58:55,306 --> 01:58:58,676
because this is in fact an
object of type activity.

2348
01:58:58,676 --> 01:59:01,226
I actually want to create some
code that launches activity

2349
01:59:01,226 --> 01:59:03,046
and display something
to the user.

2350
01:59:03,736 --> 01:59:07,326
And within that we have
this one method on create.

2351
01:59:08,126 --> 01:59:10,206
This method is invoked by the OS

2352
01:59:10,206 --> 01:59:14,306
within this activity object
whenever this activity is

2353
01:59:14,306 --> 01:59:15,116
about to be started.

2354
01:59:15,316 --> 01:59:18,426
Let's say, "OK, I am about
to display this activity

2355
01:59:18,426 --> 01:59:21,686
so I'm going to create it
and display it on the screen.

2356
01:59:21,686 --> 01:59:22,646
What do you want me to do?"

2357
01:59:22,646 --> 01:59:24,376
It's asking this code,

2358
01:59:24,376 --> 01:59:26,516
and by asking means
invoking this method,

2359
01:59:26,736 --> 01:59:32,046
which allows our code to
actually create the layout

2360
01:59:32,976 --> 01:59:34,936
and apply a layout
on to this activity

2361
01:59:34,936 --> 01:59:36,766
and then display it to the user.

2362
01:59:37,926 --> 01:59:43,036
So, the next few lines-- this
super.uncreate, we just have

2363
01:59:43,036 --> 01:59:45,506
to make sure that we
actually invoked the act--

2364
01:59:45,886 --> 01:59:49,346
the main activity classes
on create method just

2365
01:59:49,346 --> 01:59:50,406
to do any house cleaning,

2366
01:59:50,406 --> 01:59:52,646
otherwise you will
get a very nasty error

2367
01:59:52,716 --> 01:59:56,976
from the Android plug-in or
from the SDK when you do this.

2368
01:59:57,436 --> 01:59:59,946
And then programatically
we are actually going

2369
01:59:59,946 --> 02:00:03,926
to create a TextView
that says some text.

2370
02:00:04,286 --> 02:00:06,056
We're going to create
a TextView object.

2371
02:00:06,056 --> 02:00:09,856
It's just basically instantiated
in this first highlighted line.

2372
02:00:10,226 --> 02:00:11,846
Next, we're going
to set the text

2373
02:00:12,066 --> 02:00:13,696
to be displayed by
this TextView.

2374
02:00:14,086 --> 02:00:16,146
And then, we are going
to set the content view

2375
02:00:16,146 --> 02:00:19,426
which is the content
displayed within this activity.

2376
02:00:19,426 --> 02:00:23,916
So, this is not necessarily
a mysterious function call.

2377
02:00:24,116 --> 02:00:26,386
This is actually a function
call that's implemented

2378
02:00:26,386 --> 02:00:30,586
by the Android activity
class that allows us

2379
02:00:30,586 --> 02:00:33,396
to set the layout
for this activity.

2380
02:00:34,036 --> 02:00:36,116
It's basically the layout for
this activity will be what?

2381
02:00:36,506 --> 02:00:39,396
Any guess?

2382
02:00:39,616 --> 02:00:41,936
This based on this code.

2383
02:00:42,516 --> 02:00:47,496
[ Pause ]

2384
02:00:47,996 --> 02:00:48,096
Yeah.

2385
02:00:49,016 --> 02:00:50,636
[ Inaudible Remark ]

2386
02:00:50,636 --> 02:00:51,466
That's right.

2387
02:00:51,466 --> 02:00:55,016
So, all-- the only thing
that will be on the screen,

2388
02:00:55,016 --> 02:00:56,696
when we actually
run this activity,

2389
02:00:56,906 --> 02:00:58,176
will just be a TextView.

2390
02:00:58,546 --> 02:01:00,826
But that TextView
itself is invisible.

2391
02:01:00,826 --> 02:01:02,316
We don't actually
see its bounds.

2392
02:01:02,316 --> 02:01:04,076
We just see the text
that's contained within it

2393
02:01:04,436 --> 02:01:06,696
so we should expect to
see the text, oh high.

2394
02:01:07,596 --> 02:01:09,736
You know, there's some logging
capabilities stuff down here

2395
02:01:10,066 --> 02:01:11,526
which if we have a
little bit more time,

2396
02:01:11,896 --> 02:01:16,656
I would explain is very useful
for us to actually get messages

2397
02:01:16,656 --> 02:01:20,756
from our code back in to this
really cool, little section

2398
02:01:20,756 --> 02:01:23,516
down here, log caps which
allows you to actually run.

2399
02:01:23,516 --> 02:01:27,906
It's sort of a consul-like way
of actually being able to look

2400
02:01:27,976 --> 02:01:29,906
at errors from your activity.

2401
02:01:29,906 --> 02:01:32,126
In fact, you can see, it
says, "This is an error,"

2402
02:01:32,546 --> 02:01:36,936
which [inaudible] or which
replicates what we see here is a

2403
02:01:36,936 --> 02:01:39,376
very good for debugging
in the Android world.

2404
02:01:40,216 --> 02:01:43,956
But if I actually run this
code, this is what we would see.

2405
02:01:45,266 --> 02:01:48,366
So, very much like in Xcode how
you have an emulator for iOS,

2406
02:01:48,366 --> 02:01:52,596
you have an emulator for
Android devices as well.

2407
02:01:53,486 --> 02:01:55,466
So, what's cool about this is

2408
02:01:55,466 --> 02:01:58,546
that this is actually an
emulator, the Android device,

2409
02:01:58,546 --> 02:02:02,196
since so I can go to
the-- I can't see the--

2410
02:02:02,196 --> 02:02:04,766
oh, we've been bitten
by the resolution bug.

2411
02:02:05,056 --> 02:02:07,566
There's some buttons down
here that allow me to go

2412
02:02:07,566 --> 02:02:09,366
to the home screen and
we can sort of play

2413
02:02:09,366 --> 02:02:11,926
around with this version
of the Android device.

2414
02:02:11,926 --> 02:02:13,526
But personally, it's cutoff.

2415
02:02:13,526 --> 02:02:15,166
So, rest assured, it's there.

2416
02:02:15,266 --> 02:02:17,346
You can click on it,
but not right now.

2417
02:02:17,766 --> 02:02:21,296
But what this allows us to is
our HelloWorld application.

2418
02:02:21,606 --> 02:02:23,896
We have here our
activity which takes

2419
02:02:23,896 --> 02:02:25,236
up the entirety of the screen.

2420
02:02:25,666 --> 02:02:27,136
By default, the theme was black.

2421
02:02:27,336 --> 02:02:30,356
We didn't get to see that, but
it's elsewhere actually in--

2422
02:02:30,516 --> 02:02:33,556
within the package itself.

2423
02:02:33,866 --> 02:02:34,996
We have our one TextView,

2424
02:02:34,996 --> 02:02:36,446
this is our text,
and that's about it.

2425
02:02:36,746 --> 02:02:40,016
Up here, this is just a title
bar for the application itself.

2426
02:02:40,136 --> 02:02:43,356
It's a little confusing at first
when expect to only see this

2427
02:02:43,356 --> 02:02:47,506
and you also see the title of
the application but realize

2428
02:02:47,866 --> 02:02:50,866
that that is actually just the
Android OS displaying a little

2429
02:02:50,866 --> 02:02:52,746
title above the application
itself.

2430
02:02:52,746 --> 02:02:56,726
We could give a flag in the
manifest that would request

2431
02:02:56,726 --> 02:02:59,366
that this activity become full
screen and hide everything.

2432
02:02:59,636 --> 02:03:00,716
We haven't set that flag.

2433
02:03:00,716 --> 02:03:03,416
We've just done a very
simple manifest file here.

2434
02:03:03,646 --> 02:03:07,816
And of course, we have
our systemwide status bar

2435
02:03:07,816 --> 02:03:09,336
at the very top here.

2436
02:03:10,696 --> 02:03:12,046
Now, there're few other
things that I want

2437
02:03:12,046 --> 02:03:13,406
to show you about this.

2438
02:03:13,976 --> 02:03:17,086
I'm going to make a few of
these activities available

2439
02:03:17,086 --> 02:03:18,626
in the source code
for you to download

2440
02:03:18,626 --> 02:03:19,736
and actually play around with.

2441
02:03:19,896 --> 02:03:21,486
We don't really have a lot
of time to go through them.

2442
02:03:21,486 --> 02:03:23,976
But hopefully, if you just
go through them on in a time,

2443
02:03:24,476 --> 02:03:27,826
they'll progress in such a
way that you will be able

2444
02:03:27,856 --> 02:03:29,346
to hopefully start
following along

2445
02:03:29,346 --> 02:03:32,356
as we make slightly more
complicated layouts,

2446
02:03:32,626 --> 02:03:34,876
start adding second activities

2447
02:03:34,876 --> 02:03:37,196
and start doing other
things with the Android OS.

2448
02:03:37,476 --> 02:03:39,086
But there're a couple
of things that I want

2449
02:03:39,086 --> 02:03:41,016
to point about the SDK itself.

2450
02:03:41,596 --> 02:03:44,756
One of them is that this
IDE again is Eclipse.

2451
02:03:45,016 --> 02:03:47,276
This is not written
by Google but is

2452
02:03:47,276 --> 02:03:49,666
in fact is a larger
open source project.

2453
02:03:49,666 --> 02:03:51,696
If you already have
Eclipse downloaded

2454
02:03:51,696 --> 02:03:55,536
because you do development in
other languages or even in Java,

2455
02:03:55,766 --> 02:03:57,236
you can actually
download the SDK

2456
02:03:57,236 --> 02:03:58,816
without including
the IDE itself.

2457
02:03:58,816 --> 02:04:03,866
You can just download the SDK
to plug-in and follow some steps

2458
02:04:03,866 --> 02:04:06,006
on the developer website
to get all of that working

2459
02:04:06,276 --> 02:04:08,236
in your own version of Eclipse

2460
02:04:08,236 --> 02:04:09,286
which you might have
already installed.

2461
02:04:09,286 --> 02:04:12,026
But if you don't have installed
already, don't worry about it,

2462
02:04:12,026 --> 02:04:14,606
you can just download everything
and work out of the box.

2463
02:04:15,176 --> 02:04:19,126
Once you have everything set up
though, if you go to this menu,

2464
02:04:19,126 --> 02:04:21,936
the Window menu, you'll
notice that you have a couple

2465
02:04:21,936 --> 02:04:23,596
of new Android options.

2466
02:04:23,596 --> 02:04:25,416
And I'll zoom in here so
that you can see them.

2467
02:04:25,946 --> 02:04:27,836
You have Android
as the key manager,

2468
02:04:27,836 --> 02:04:29,466
Android virtual device manager

2469
02:04:29,976 --> 02:04:33,966
and Android lint
which is a checker.

2470
02:04:34,446 --> 02:04:36,766
But, it's these two that
we are worried about now,

2471
02:04:36,766 --> 02:04:38,976
the SDK manager and the
virtual device manager.

2472
02:04:39,236 --> 02:04:42,166
The SDK manager allows you

2473
02:04:42,166 --> 02:04:45,226
to download different
versions of the SDK.

2474
02:04:45,576 --> 02:04:48,486
So, if you want to
build an application

2475
02:04:48,726 --> 02:04:52,006
against a specific API
number, you have to make sure

2476
02:04:52,006 --> 02:04:55,276
that you have downloaded
that SDK.

2477
02:04:55,276 --> 02:04:56,796
So, if you download all
of this, this is going

2478
02:04:56,796 --> 02:04:57,896
to take of a lot of space.

2479
02:04:57,896 --> 02:04:59,506
It's several gigabytes with--

2480
02:04:59,876 --> 02:05:02,086
of information that has to be
downloaded on to your computer.

2481
02:05:02,086 --> 02:05:04,796
But then you could compile
your application against anyone

2482
02:05:05,186 --> 02:05:10,026
of these API targets and
it will work just fine.

2483
02:05:10,456 --> 02:05:13,336
In this case because
I had set the--

2484
02:05:13,336 --> 02:05:17,696
in the manifest file the
minimum SDK version-- oops--

2485
02:05:17,906 --> 02:05:20,016
of 3 as we can see here.

2486
02:05:21,176 --> 02:05:24,626
Let's make sure that I in fact
have that version installed.

2487
02:05:24,626 --> 02:05:29,286
And as you can see, Android
1.5 which is an API level of 3,

2488
02:05:29,286 --> 02:05:31,006
so realized that there're
two different versions.

2489
02:05:31,486 --> 02:05:36,216
The public facing version
is the string Android 1.5,

2490
02:05:36,216 --> 02:05:39,656
but the API level is in
always incrementing integer

2491
02:05:39,656 --> 02:05:43,186
which started at one
basically that earliest version

2492
02:05:43,186 --> 02:05:45,546
that was released through
consumers was API Level 3

2493
02:05:45,546 --> 02:05:49,216
and it just has been
going up ever since then.

2494
02:05:49,626 --> 02:05:52,306
So, here, we can see that I
in fact have the SDK platform

2495
02:05:52,306 --> 02:05:54,076
and the APIs installed.

2496
02:05:54,076 --> 02:05:55,546
You can do that on your own

2497
02:05:55,546 --> 02:05:57,306
for whatever version
you want to run.

2498
02:05:57,306 --> 02:06:00,266
But the for more fun
one, I would say,

2499
02:06:00,676 --> 02:06:03,446
is the virtual device
manager which allows you

2500
02:06:03,686 --> 02:06:08,016
to create virtual devices,
emulated devices in just

2501
02:06:08,016 --> 02:06:10,796
about any configuration
that you can imagine.

2502
02:06:10,796 --> 02:06:14,386
So, if we were to create a new
device here, what this is going

2503
02:06:14,386 --> 02:06:17,856
to allow us to do is to
create a new emulator of sorts

2504
02:06:18,296 --> 02:06:20,926
that replicates certain
features of a device.

2505
02:06:21,066 --> 02:06:23,646
So, we can specify
a variety of things.

2506
02:06:23,876 --> 02:06:24,756
We can give it a name.

2507
02:06:24,816 --> 02:06:28,476
So I'll just say Android
2.4 just for example.

2508
02:06:28,816 --> 02:06:32,076
Now, we can see here that when I
click on device, we have a list

2509
02:06:32,076 --> 02:06:34,636
of different device sizes.

2510
02:06:35,656 --> 02:06:38,926
Pick your Poison, it goes
all the way from the Nexus 10

2511
02:06:38,926 --> 02:06:43,266
which has an enormous 10 inches
screen all the way down to some

2512
02:06:43,346 --> 02:06:47,976
of the earliest Android devices
including a 240 by 320 screen.

2513
02:06:48,836 --> 02:06:49,626
It's pretty small.

2514
02:06:49,746 --> 02:06:54,116
We can select any of these
and actually create emulators

2515
02:06:54,116 --> 02:06:56,726
that you can actually
test your application

2516
02:06:56,726 --> 02:06:58,066
across the wide variety

2517
02:06:58,066 --> 02:06:59,676
of devices before
you even release it

2518
02:06:59,676 --> 02:07:01,066
to the Google Play Store.

2519
02:07:01,066 --> 02:07:04,616
I'm just going to [inaudible]
so I connect Nexus 10.

2520
02:07:05,346 --> 02:07:06,916
I can select the target.

2521
02:07:06,916 --> 02:07:09,516
So, this is the API, this is--

2522
02:07:09,516 --> 02:07:11,726
basically, the OS version
that this should run

2523
02:07:11,806 --> 02:07:14,036
that this hardware
device should run.

2524
02:07:14,356 --> 02:07:17,636
Now, it is possible for you to
get yourself into trouble here

2525
02:07:17,876 --> 02:07:21,076
and run an ancient version
of a target on a new device

2526
02:07:21,076 --> 02:07:23,156
that would not ever
have that installed.

2527
02:07:23,646 --> 02:07:25,426
So, you have to sort
of be careful here

2528
02:07:25,426 --> 02:07:28,426
that you select ones that
would make sense for that.

2529
02:07:29,326 --> 02:07:31,816
Sometimes, you get the ability
to change the CPU if there's

2530
02:07:31,816 --> 02:07:34,316
in fact an option
between ARM and Intel.

2531
02:07:34,616 --> 02:07:36,936
Hardware keyboard
would be emulating

2532
02:07:36,936 --> 02:07:39,906
and actual hardware
keyboard on this device,

2533
02:07:40,596 --> 02:07:42,836
hopefully the rest are
somewhat self-explanatory.

2534
02:07:42,836 --> 02:07:44,906
You do-- would get to set
things like the RAM size,

2535
02:07:45,356 --> 02:07:47,536
the amounts of heap that your
virtual machine would have

2536
02:07:47,856 --> 02:07:51,556
for this application, the
amount of internal storage

2537
02:07:51,556 --> 02:07:54,536
if that device actually
has to emulate an SD card.

2538
02:07:55,276 --> 02:07:57,296
And notice a couple
of options down here,

2539
02:07:57,296 --> 02:08:02,176
snapshots which if you've
used virtualization software

2540
02:08:02,176 --> 02:08:05,096
elsewhere like VMware or
Parallels or any sort of thing,

2541
02:08:05,096 --> 02:08:07,886
we actually close that
virtualized window.

2542
02:08:08,176 --> 02:08:10,306
It saves the state of the
memory and will allow you

2543
02:08:10,306 --> 02:08:11,486
to restart it from there.

2544
02:08:11,736 --> 02:08:14,566
Similar thing here
with snapshots,

2545
02:08:14,776 --> 02:08:18,246
you can actually save the state
between times that you close

2546
02:08:18,246 --> 02:08:22,306
and then we open the
emulator which is pretty good

2547
02:08:22,306 --> 02:08:23,586
because sometimes,
it takes a while

2548
02:08:23,586 --> 02:08:25,196
for this emulators to load.

2549
02:08:25,516 --> 02:08:32,976
And, they now have also hardware
accelerated GPU which is great

2550
02:08:33,096 --> 02:08:35,106
because before was software

2551
02:08:35,106 --> 02:08:37,176
and it was just-- it
was jut the worst.

2552
02:08:37,176 --> 02:08:37,856
It's so slow.

2553
02:08:38,546 --> 02:08:39,906
OK, so you can create
one of these

2554
02:08:39,906 --> 02:08:41,586
and you can have actually
a variety of them.

2555
02:08:41,846 --> 02:08:43,846
Now, in order for you
test your application

2556
02:08:43,846 --> 02:08:47,386
on an emulated device, you have
to first-- here's the steps,

2557
02:08:47,756 --> 02:08:50,196
make sure that you
download-- oops--

2558
02:08:50,676 --> 02:08:54,146
make sure that you download the
appropriate SDK and SDK manager

2559
02:08:54,146 --> 02:08:58,186
and then create a virtual device
in the virtual device manager.

2560
02:08:58,576 --> 02:09:02,166
Then you have an emulator
that you can actually run.

2561
02:09:02,166 --> 02:09:06,196
So, in this case, I actually
have my Android 2.3.3 running,

2562
02:09:06,196 --> 02:09:07,246
as you can see right here.

2563
02:09:07,246 --> 02:09:11,976
So, I'm emulating an Android
2.3.3 device in this emulator.

2564
02:09:12,426 --> 02:09:14,986
There're a couple more
things I want to point out.

2565
02:09:14,986 --> 02:09:16,556
One of them is that
there's this number

2566
02:09:16,746 --> 02:09:20,366
to the left of the name, 5554.

2567
02:09:20,456 --> 02:09:21,756
Now, this is pretty cool.

2568
02:09:21,756 --> 02:09:27,376
What this allows
us to do is to log

2569
02:09:27,376 --> 02:09:31,406
in to the emulated
device from our computer.

2570
02:09:31,406 --> 02:09:35,306
So, in this case, I can
open up a terminal Window.

2571
02:09:35,306 --> 02:09:38,126
Type in "Telnet localhost"
and then that port number.

2572
02:09:38,126 --> 02:09:41,316
That number actually coincides
with the port that's running

2573
02:09:41,526 --> 02:09:44,326
within our computer
or within the emulator

2574
02:09:44,326 --> 02:09:46,016
and is exposed to our computer.

2575
02:09:46,306 --> 02:09:49,456
When I hit Enter, notice that
I connect to this emulator

2576
02:09:49,456 --> 02:09:51,456
and this is something that
you can really only do

2577
02:09:51,456 --> 02:09:52,736
to the emulated devices.

2578
02:09:53,166 --> 02:09:56,766
Now, you can type "help" and
you actually get a variety

2579
02:09:56,766 --> 02:09:57,976
of things that you can do.

2580
02:09:58,056 --> 02:10:03,466
So, you can actually force the
emulator to change its state.

2581
02:10:03,466 --> 02:10:05,446
And there are variety
of interesting ways.

2582
02:10:05,656 --> 02:10:09,166
You can have, for example,
it follows a set of GeoTracks

2583
02:10:09,166 --> 02:10:12,826
or maybe your application
is actually really dependent

2584
02:10:12,826 --> 02:10:13,916
on geolocation.

2585
02:10:13,916 --> 02:10:15,566
So, you could actually
provide it some GeoTracks

2586
02:10:15,566 --> 02:10:21,986
and observe how your application
reacts as the phone is not taken

2587
02:10:21,986 --> 02:10:24,666
in a physical sense
but it's taken in a--

2588
02:10:25,746 --> 02:10:29,406
in an emulated sense though
that geolocation track.

2589
02:10:29,726 --> 02:10:32,936
You can also do a variety
of things like what happens

2590
02:10:33,216 --> 02:10:36,926
when I changed the network
settings on it and say

2591
02:10:36,926 --> 02:10:40,476
that the user loses cellphone
signal and they only have WiFi

2592
02:10:40,476 --> 02:10:43,396
or vice versa, how does my
application actually react

2593
02:10:43,396 --> 02:10:45,546
to any of this-- to all
this sorts of things.

2594
02:10:45,806 --> 02:10:50,326
You can also send the emulator
an SMS, just pretty funny.

2595
02:10:50,326 --> 02:10:52,866
But it is actually
useful especially

2596
02:10:52,866 --> 02:10:55,006
if you are creating an
application that is relevant

2597
02:10:55,006 --> 02:10:57,446
to that, a variety of other
things as you can see here.

2598
02:10:58,886 --> 02:11:01,746
Now, one of the really
neat things here is

2599
02:11:01,746 --> 02:11:05,016
that if you have
an Android device

2600
02:11:05,106 --> 02:11:07,366
and you are doing Android
development, you can plug

2601
02:11:07,366 --> 02:11:13,046
in that device using USB to your
computer and you will be able

2602
02:11:13,046 --> 02:11:15,056
to develop directly
on to that device.

2603
02:11:15,056 --> 02:11:17,806
You might actually have to check
all, check a few a settings

2604
02:11:17,866 --> 02:11:21,726
in the developer menu that
says allow development, mode,

2605
02:11:21,726 --> 02:11:22,536
and some other things.

2606
02:11:22,906 --> 02:11:26,246
But what this essentially allows
you to do really without having

2607
02:11:26,246 --> 02:11:28,496
to deal with any certificates
or any or anything like that is

2608
02:11:28,496 --> 02:11:32,376
that you can very quickly and
easily connect an Android device

2609
02:11:32,376 --> 02:11:35,586
to your computer and try
your program not only

2610
02:11:35,586 --> 02:11:39,176
on an emulated virtual device,
but also on your physical phone

2611
02:11:39,416 --> 02:11:41,286
or physical tablet as well.

2612
02:11:41,286 --> 02:11:46,436
And can you also run, you
can also connect to it

2613
02:11:46,436 --> 02:11:49,506
and run a variety of commands.

2614
02:11:49,506 --> 02:11:51,746
It's really limited in
these physical devices

2615
02:11:51,746 --> 02:11:53,046
because you don't
have root access

2616
02:11:53,046 --> 02:11:56,136
to the file system unless you
have actually rooted the device

2617
02:11:56,216 --> 02:11:58,546
which is an entirely
different issue.

2618
02:11:58,546 --> 02:12:04,086
But even though that is an
option, it's probably better

2619
02:12:04,086 --> 02:12:07,006
to test this out on an emulated
device and see how it behaves

2620
02:12:07,006 --> 02:12:09,916
on the physical one, but
then it certainly an option

2621
02:12:09,916 --> 02:12:11,526
for you there as well.

2622
02:12:12,086 --> 02:12:16,626
And one of the great things
about the Android SDK very much

2623
02:12:16,626 --> 02:12:21,166
like the iOS, the iOS
development in Xcode is

2624
02:12:21,166 --> 02:12:23,536
that once you understand
these simple principles,

2625
02:12:23,536 --> 02:12:27,136
once you've understand Java,
once you understand how

2626
02:12:27,136 --> 02:12:31,576
and APK is built and
what its hierarchy

2627
02:12:31,576 --> 02:12:34,876
of files actually looks like,
becomes very easy for you

2628
02:12:34,876 --> 02:12:38,046
to look up the APIs
that are given to you

2629
02:12:38,046 --> 02:12:42,706
in the API documentation and
quickly make an application

2630
02:12:42,706 --> 02:12:43,786
that you would want to run

2631
02:12:43,786 --> 02:12:46,246
or that you would want
to deploy to users.

2632
02:12:46,576 --> 02:12:52,906
And so, hopefully then,
this has been a good summary

2633
02:12:52,906 --> 02:12:54,656
of how you can actually
get started with it.

2634
02:12:55,106 --> 02:12:57,366
So, if you are interested
in this, go ahead and go

2635
02:12:57,366 --> 02:13:02,506
to the developer website,
download the SDK and get started

2636
02:13:02,506 --> 02:13:03,966
on Android development.

2637
02:13:04,306 --> 02:13:06,136
And until then, I want
to thank you very much.

2638
02:13:06,216 --> 02:13:08,756
I think David has
couple of last words.

2639
02:13:09,136 --> 02:13:11,516
But that you ought for you time.

2640
02:13:12,516 --> 02:13:17,016
[ Applause ]

2641
02:13:17,516 --> 02:13:18,376
>> [Inaudible] Dan and Rob.

2642
02:13:18,446 --> 02:13:19,636
We [inaudible] like
for a couple minutes

2643
02:13:19,676 --> 02:13:21,096
for one-on-one questions,
otherwise,

2644
02:13:21,096 --> 02:13:22,666
we post it all resources
from tonight.

2645
02:13:22,766 --> 02:13:25,406
The course's website
on Wednesday,

2646
02:13:25,436 --> 02:13:27,026
[inaudible] we're
going to dive some more

2647
02:13:27,026 --> 02:13:27,846
in advance, iOS [inaudible].

2648
02:13:27,846 --> 02:13:30,146
In Wednesday, we will
gather for one last time

2649
02:13:30,606 --> 02:13:32,976
for [inaudible] app, so
we will see you then.

2650
02:13:33,516 --> 02:13:40,030
[ Noise ]

