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