Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Fine tune the app by integrating with the Google+ APIs
Key Terms
Server Client ID: this is the ID that Google provides in the Google Developer Console on the web.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Welcome back.
0:04
Our app displays listings from Etsy and
0:05
successfully detects when
Google Play services are available.
0:08
Now let's finish this app by
integrating with the Google Plus APIs.
0:12
We're going to add in the +1 button so
0:17
users can promote content
to their followers.
0:19
After that, we'll provide
sharing directly to Google Plus.
0:22
Let's do this.
0:24
The first thing we want to
do is request access to
0:26
the Google Plus APIs that
are part of Google Play services.
0:30
To do this, we need to add an API and
0:34
any API options to
the Google API client object.
0:36
We do this by calling add API to our
Google API client builder object
0:41
in our Google services helper class.
0:46
Let's go ahead and add an API.
0:48
And we can see here that we
simply need to add an API object.
0:52
As part of the Google Play Services Plus
library there's a Plus.API object.
0:57
That's the API object we need.
1:02
And we're going to add in the Plus
options as well, and the Plus
1:03
options are where we're going to actually
set our unique identifier for our app.
1:07
Now we got this from
the Google developer console,
1:12
the website that we registered
with before we started everything.
1:15
So let's go over there right now, and
we're going to need, under credentials
1:18
when we created our client ID we're
going to need the client ID right here.
1:22
And it's this whole thing, so
we're just going to go ahead and copy it.
1:26
So it's copied, and then we're going
to use that back in our project here.
1:29
And what we need to do is
use the Plus.Plus options.
1:33
And it has a builder as well, and
with this builder there's a method called
1:37
setServerClientId, and
you just pass it in as a string.
1:42
So we just copy it in here,
the whole thing.
1:45
And we're going to call build on this, and
1:48
let's make sure we enclose
this with a bracket here, and
1:52
we need to make sure that we got
all of our parentheses lined up.
1:55
And it looks good now.
1:59
And that's all we need to do.
2:00
Now we have the API added
along with our ServerClientId.
2:01
And now we'll be able to connect to the
API client, connect to Google Play service
2:06
and be able to display our Plus One and
Share buttons.
2:11
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up