English subtitles

← Google API Client

Get Embed Code
4 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. So here you can see my onCreates and
    in my onCreate,
  2. I've done most of these tasks.
  3. So first of all my three buttons are my
    mSignInButton, mSignOutButton, and
  4. mRevokeButton.
  5. And these I just find them
    using findViewById and
  6. passing in the ordered id of the button.
  7. These are objects that I've declared.
  8. Two of them are button and
    one of them is one of sign in buttons.
  9. I'm also saying the TextView status,
    I'm just, again, sign_in_status
  10. is my TextView, and allocating this
    to the local object called mStatus.
  11. So then, for the three buttons, I set
    an OnClickListener, and I just set it to
  12. this, so then this class becomes
    the callback for OnClickListener.
  13. And then finally, I'm saying, for
  14. my GoogleApiClient, I've defined
    a local Google API client here.
  15. If I scroll up,
    you can see here where I've defined it.
  16. It's a private GoogleApiClient and
    GoogleApiClient.
  17. I've done the same with the buttons and
    the textView.
  18. And so now here, I'm just assigning my
    GoogleApiClient to the output of this
  19. function, buildApiClient.
  20. I've created that function here, and
    this just builds the API client.
  21. It uses the Plus.API
    as we had discussed.
  22. And it just does the usual API Client
    stuff, adding the ConnectionCallbacks,
  23. adding the OnConnectionFailedListener,
    adding the API,
  24. but also adding Scope as we've defined.
  25. So we're going to use the PROFILE Scope
    and we do it in this way.
  26. Now we'll build that and then return it.
  27. So now in my onCreate,
    I'm going to get a Google API client And
  28. it's going to be built
    by this helper function.
  29. And it's going to be one to use
    the Plus.API and PROFILE scope.
  30. Pretty straight forward, right?