Tip:
Highlight text to annotate it
X
CHRIS CARTLAND: Welcome to Google+ Developers Live.
My name is Chris Cartland, and I'm a developer programs
engineer working on the Google+ platform.
WESLEY TARLE: And I'm Wes Tarle.
I'm an engineer on Google+.
CHRIS CARTLAND: Today we're excited to talk to you about
Google+ Sign-In on Android.
Google+ Sign-In allows developers to take advantage
of a lot of cool features, including interactive posts,
over the air installs, and app personalization.
Today we're going to talk about Sign-In using the Quick
Start that we put on our website for you to use.
WESLEY TARLE: The invite Google+ SDK is the fastest way
to get started with the sign-in
with Google+ on Android.
It's really easy.
I think the Quick Start is a great way to get started.
CHRIS CARTLAND: So let's do it.
We're going to look at my laptop right here.
I'm at developers.google.com/plus.
This is the home page for the Google+ platform.
We're going to just try a Quick Start right now, which
is on the left-hand side of the page, and we're going to
look at Android because that's what you're all here to see.
This Quick Start guide for Android is a step-by-step
guide that shows you exactly how to get started.
So we're going to do that today.
But you can go through, follow those instructions, and by the
end, you usually have the same application running on your
phone or your tablet, whatever device that you have.
So the first thing that I'm going to do is go to the API
console to make sure that I have everything configured for
this project.
Those of you that have used Google API before are very
familiar with this.
I'm going to create a new project for this demonstration
and I'm going to call Android Quick Start.
If you already have an application that you're using
for your website, your production applications should
use that same project.
And that's to be the same project if you're using the
web and Android.
You want to put them all in the same place so that the
features work well together.
I'm going to turn on the Google+ API.
The first time you do this you'll have to accept the
terms and conditions of the API.
And you notice that this page has a lot of different boxes
on it, and that's because you can turn on any API that
Google offers just by flipping a switch here.
So if your application does more than just sign-in, this
is the place you want to start.
Now I need to set up the API access by creating a client ID
for the standard application.
I click Create a Client ID, and this is now the branding
information that will be shown to your user.
So make sure to pick a good product name that they'll
understand who their authorizing with information.
And for testing this doesn't really matter, but for your
production application you'll want to put in a nice little
picture here so people know what your logo
is and who you are.
The type of client ID that we're going to create for
Android is an installed application, and it's going to
be for Android.
You will also set up your web application here, if you were
going to do a website.
WESLEY TARLE: So this part's really important, and I think
a lot of people miss it.
This package name, you have to enter the package name from
your Android manifest.
The signing certificates, fingerprints, that's the hash
of your signing certificates that you use to sign your
APKs, I think that we'll put in a debug certificate for
now, but you'll need to use your production one.
If you don't do this step then things won't work on Android.
CHRIS CARTLAND: Great.
So, let's do the package name first.
The sample application already comes with a package name
built-in to the manifest.
We're going to just copy that from our instructions and put
that into the API console.
For the signing certificate you'll need to use the key
tool utility.
I can also get that command from our documentation and
copy that into terminal.
WESLEY TARLE: So you're extracting the fingerprint
from your debug key store in Eclipse right now.
For production apps you'll have it somewhere else.
CHRIS CARTLAND: Correct.
So the debug key store, which Eclipse uses, is a stream that
you can copy.
And I'm going to run the key tool and enter the password.
WESLEY TARLE: And that password is Android for all
debug key stores.
CHRIS CARTLAND: I'm going to copy the SHA1 and put that
into the API console.
Great.
This is also where you would turn on deep linking, if you
were going to enable the application.
We're not going to do that today, but we'll talk about it
some other time.
Great.
So that was setting up the API access.
That means we'll be able to use Google+ in our
application.
I'm now going go look at Android in Eclipse.
The first thing I need to make sure I've done is updated all
of the SDK through the Android SDK Manager.
The things you need are updated Android SDK tools.
WESLEY TARLE: Yeah, so those two at the top are installed
by default.
You'll need to scroll down to extras and
find Google Play services.
That's the client code for Google Play services that
you'll want to include in your apps.
CHRIS CARTLAND: Great.
So, I've already installed that, because you only need to
do it once for all your applications.
And I'm ready to go.
So now I actually want the code, which is important.
So I'm going to import the Google+ sample.
So from Import, I choose Existing Android Code into
Workspace, and I have to browse for
this through Directory.
This will be in your Android SDK's extras folder under
Google and Google Play services.
And I can click Open, and this shows me a couple of projects.
WESLEY TARLE: So here at the top is the Google Play
services library project.
That includes code and resources that you'll include
in your app, or in the sample app in this case.
And you can see that once you've got Google Play
services installed, you have access to things like Plus and
Auth, and you see Maps there, too.
CHRIS CARTLAND: Great.
So for this example application, we only need the
Google Play services library, and the actual project for
this application.
So I've imported those.
And there's one more step that I need to do to configure
this, so I'm going to open up the Properties on the Plus
sample activity.
Wes, you wanted to point out here that there's an Android
section with the Google Play services library.
WESLEY TARLE: Yes.
So here we've, in the sample app, we already include the
Google Play services library project.
That's just to get you started quickly.
When you're adding Google Play services to your project,
you'll need to--
I think here we can actually click on it and
show them to remove.
CHRIS CARTLAND: Yeah.
WESLEY TARLE: And then this is what your project will look
like when you start, and if you click add, then you can
add it back, the Google Play services.
CHRIS CARTLAND: Great.
So that's why we had to import that in the last step so that
it's available here in the project.
WESLEY TARLE: It's slightly different than just a JAR
file, because we include strings and the Sign-In button
and resources like that.
CHRIS CARTLAND: Great.
So we also need to configure our build path, and to do that
we go to Java Build Path, and we're going to
add external JARs.
This JAR is available, like our documentation says, under
Android SDKs extras, Android support V4.
WESLEY TARLE: So this is an optional JAR for your
application that back-ports fragments and loaders to
Android 3.0 Plus.
We use it in our sample.
Most apps use it.
You can decide not to use it and still get everything you
want from Google Play services.
CHRIS CARTLAND: So we're going to use it, and in order to
make sure it gets into our project we're going
to export the JAR.
WESLEY TARLE: If you skip that step, you'll see lots of
errors in your log text.
CHRIS CARTLAND: So we want to make sure we've done that.
Under Order and Export, check the box.
And I'll click OK.
And now the application is ready to go in Eclipse, and I
can run it.
What this will do is build the project and actually push the
SDK onto the device and start it up.
So we're actually going to switch now to a Nexus 10 that
I have here that is running the Google+ SDK sample.
So, on the home screen I have the icon
for the Google+ sample.
I'm going to open it.
And we see a list here of different things you can do.
The application that we put in for the Quick Start is divided
up into all of the different features that you may want to
use with Google+ Sign-In, and they're separated, so you can
pick which ones are most interesting to you and try
them out independently.
WESLEY TARLE: Yeah, each one of these
is a different activity.
CHRIS CARTLAND: OK, great.
So we're going to look Sign-In--
that's the top activity here.
There are three buttons that you can see, and the first one
is Sign-In, and that's where a user
initiates the sign-in flow.
I quick sign-in, and I'm prompted with the consent flow
that tells the user what's going to happen when I agree
to sign-in using Google.
WESLEY TARLE: So, if you had skipped the dev console step,
then you wouldn't see this screen, you would just see an
error message.
So that's a pretty good sign that you need to go sign up at
dev console.
CHRIS CARTLAND: Great.
So since we've done this, we know that we configured the
console project correctly and we're able to sign-in.
Looking at consent screen, I'm giving information about me
like my basic--
my name, my profile photo, and also the people who are in my
circle are being given to the application.
The second thing is that people who know that I'm using
the app will be my circle, based on my choice.
I'm going to agree to this, click OK.
And this will complete the sign-in with Google.
I know that I was able to successfully sign-in because
the app says Welcome, and then my name, which for this test
account is Joe Tester.
And that means that I am now completely signed in to the
application, and the Android application can now make
requests to Google to find out information about me, and it
can do any of the other Google+ Sign-In
features that we want.
WESLEY TARLE: So we've got APIs for interactive posts and
writing moments, and they're all available in the other
activities that you showed.
CHRIS CARTLAND: Great.
So the other buttons on this screen show me how to sign-out
on Android, which means that if I click the Sign-In button,
I have to come back in.
If I had multiple accounts on this device it would ask me
which one I wanted.
The other thing that all applications need to do when
using Google+ Sign-In is allow a user to revoke access if
they no longer want to use Google+ with
your application anymore.
And so, you have a button that does that, so you can see
exactly how to integrate that into your application.
WESLEY TARLE: And there's a simple one-line API
behind that, too.
CHRIS CARTLAND: Yeah, it's all very easy.
WESLEY TARLE: So you can show your own UI
there, if you want.
CHRIS CARTLAND: Great.
So, that's the Quick Start for Android.
If you have any questions for us, please ask those on the
Google+ Event.
You can do that right now if you're watching live.
You can also ask on YouTube.
And we'll be looking at those to see if we can help clarify
anything or just help you with Google+ Sign-In in general.
I think there are also some questions that we
get a lot over time.
So, can you help us go through some of those, and maybe we
can help people before they even know
that they had a question.
WESLEY TARLE: Sure.
So, one question is what happens if Google Play
services is not on the phone?
The Google Play services has a client JAR that you include in
your application, and an APK that Google sends out to
devices from Froyo all the way up to the latest devices.
Google updates that automatically on most devices,
so you should be able to mostly assume that it's going
to be installed.
But if you need to, it's a good idea to use some of the
APIs we have to check whether it's installed or not, and
then you can actually can force an install, too.
And we can give you the APIs launch dialogues and things to
do the install.
CHRIS CARTLAND: Awesome.
Great.
WESLEY TARLE: Another question, what if the user
doesn't have a Google+ account?
So in this case, if a user has a Gmail account, then the plus
client connect that you'll call-- you'll see it in the
sign-in in activity.
When you call that, it will check to see if the user has a
Google+ account, and then show the [INAUDIBLE] box UI,
including entering their name and gender, so they can sign
up for Google+.
And that's sort of--
you don't have to worry about any of that.
CHRIS CARTLAND: Great.
WESLEY TARLE: What happens after they upgrade?
So after that flow, the user's kick back into your app, and
if you check in your on activity results after that,
you can tell if the user canceled or accepted the
upgrade to Google+, or if they canceled or accepted signing
into your app with that screen.
So you can use that to decide whether the user's actually
signed in or not.
CHRIS CARTLAND: Great.
So, yeah, when the user clicks the Sign-In button and has to
go through that upgrade flow, they'll be brought right back
to your application as a signed in user.
WESLEY TARLE: That's right.
Either as a signed in user, or you'll know if
they escaped it somehow.
CHRIS CARTLAND: Yeah.
Great.
WESLEY TARLE: And oh, this one might be for you.
What does Google+ Sign-In do to my quota limit?
CHRIS CARTLAND: Oh yeah, so some developers, for good
reason, would like to know how the Google+ API works in
regards to quota.
If the quota that we grant to you by default is not enough,
you can request more on the Google+ API's console by going
to the quota section and then requesting more.
By default we think that there is a lot for users to do
Sign-In and other basic applications.
And you'll keep in mind that there are two different types,
there's two buckets for APIs.
So certain API calls fall into a really big bucket for doing
basic things, like knowing who the user is.
And then there's another bucket that's smaller because
the calls are more expensive, and we want to make sure that
we're providing the best service for each of us.
So, yeah, you can go request more if you need more.
WESLEY TARLE: So I don't see any other questions, but I
think that people can take what they learned from getting
started and play around with our other APIs, and tune into
future episodes of Google Developers Live to learn more.
CHRIS CARTLAND: Yeah.
So we've shown you how to get started with Android using
Google+ Sign-In.
All of the things we talked about are on
developers.google.com/plus, and there's a lot more
resources there.
If you have any more questions--
WESLEY TARLE: Yeah.
So there's more code for different platforms and
languages at GitHub.
You can ask questions at Google+ Developers Community,
or at Stack Overflow with the tag Google+.
CHRIS CARTLAND: Great.
We're on that every day, and we're really trying to make
sure that we can help you become successful and use your
applications.
WESLEY TARLE: Before we go, I think that you had a big
announcement today.
CHRIS CARTLAND: Oh yes.
Today, Janrain and Gigya launched with Google+ Sign-In.
They are companies that allow you, as developers, to
implement Google+ Sign-In on your websites, even if you
don't want to do the work of implementing Google+ Sign-In.
So you can use their services to configure many login
options, and Google+ is now available with them.
For example, I know that NPR, National Public Radio, has
Google+ Sign-In enabled as of today.
WESLEY TARLE: Cool.
CHRIS CARTLAND: Yeah.
It's very exciting.
WESLEY TARLE: I don't think there are any more questions,
so thanks a lot for having me on.
CHRIS CARTLAND: Yeah, thanks for coming.
I'm glad you could make it today.
Yeah, well thanks everyone for watching, and
tune in next week.