Got a YouTube account?

New: enable viewer-created translations and captions on your YouTube channel!

English subtitles

← 05-05 Google Play Services

05-05 Google Play Services

Get Embed Code
4 Languages

Showing Revision 2 created 10/01/2015 by Udacity Robot.

  1. So now we need to set up
    Google Play Services.
  2. So first let's open up the Android SD
    cam manager and scroll down to Extras.
  3. Then you need to make sure you
    have both Google Play Services and
  4. the Google Repository installed.
  5. I'm not kidding here because
    you really do need both.
  6. If you forget one of them say the Google
    Repository you'll start to get some
  7. weird Lint errors that you might
    not be able to figure out.
  8. So double-check, hit install for
    both and then we can move on.
  9. Then we'll need to update build.gradle
    to reference this new library.
  10. So all we need is a new compile role.
  11. Note, however that with Google Play
    Services you don't just reference
  12. the library, but also the particular
    bundle that you want to use.
  13. Also, the version number will probably
    have changed from what you see here, so
  14. use the Android Lint recommendation
    to make sure you always have the most
  15. up-to-date version number.
  16. For any service provided
    by Google Play Services,
  17. it's important to check that
    Google Play Services is even available.
  18. So you remember Rito's explanation of
    the Android activity life cycle, right?
  19. Obviously, we want to check that
    everything is good to go when we first
  20. start the app, but you'll also want
    to recheck anytime the app resumes,
  21. because you never know how
    the user will use their device and
  22. you don't want your app to be in a wonky
    state when it's actually trying to run.
  23. So you can just copy the helper method
    that I have in order to actually perform
  24. the check because I'm more interested
    in making sure that you know
  25. how to just perform the call in the
    right places to make sure that your app
  26. always knows what's going on.