YouTube

Got a YouTube account?

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

English subtitles

← onConnection Failed

Get Embed Code
4 Languages

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

  1. onConnectionFailed is pretty complex and
  2. in many ways is the workhorse
    of your application.
  3. So in it you've just got to be
    careful to manage all your states.
  4. First of all,
    you're going to use an intent, so
  5. create an intent on the activity and
    call it mSignInIntent.
  6. Also create an integer that
    you call mSignInInteger.
  7. So when you create
    the onConnectionFailed,
  8. be sure to override it and it takes
    a connection result called result.
  9. Then you're going to need to
    check your sign in progress, and
  10. if its not STATE_IN_PROGRESS,
  11. then set the intent that you've
    created to result.getResolution().
  12. If it is STATE_SIGN_IN, then you'll
    just want to call resolveSignInError(),
  13. which you will be writing shortly.
  14. Otherwise, you're going to
    call onSignedOut(),
  15. because you're actually signed out.
  16. Implement this functionality, including
    the onConnectionFailed override and
  17. check this box when you're done.
  18. OnConnectionFailed is pretty complex and
  19. in many ways is the workhorse
    of your application.
  20. So in it you just gotta be careful
    to manage all your states.
  21. First of all,
    you're going to use an intent, so
  22. create an intent on the activity,
    and call it mSignInIntent.
  23. Also create an integer that
    you call mSignInInteger.
  24. So when you create
    the onConnectionFailed,
  25. be sure to override it, and it takes
    a ConnectionResult called result.
  26. Then you're going to need to
    check your sign in progress.
  27. And if it's not STATE_IN_PROGRESS,
  28. then set the intent that you've
    created to result.getResolution().
  29. If it is STATE_SIGN_IN, then you'll
    just want to call resolveSignInError(),
  30. which you'll be writing shortly.
  31. Otherwise you're going to call
    onSignedOut() because you're
  32. actually signed out.
  33. Implement this functionality, including
    the onConnectionFailed override, and
  34. check this box when you're done.