Return to Video

Resolve Sign In Error

  • 0:00 - 0:03
    So now we can see the code for
    resolve sign in error and
  • 0:03 - 0:04
    we can see how it works.
  • 0:04 - 0:07
    First of all, if we don't
    already have a sign in intent,
  • 0:07 - 0:08
    we want to execute this code.
  • 0:08 - 0:11
    If we have one already we'll just wait
    for it do it's activity callback.
  • 0:12 - 0:15
    So what we're going to do is we're
    going to first of all set the sign in
  • 0:15 - 0:17
    progress to say,
    the state is in progress.
  • 0:17 - 0:20
    And then we're going to call
    the startIntentSenderForResult.
  • 0:20 - 0:22
    Check the documentation for this one.
  • 0:22 - 0:26
    What it does basically is it takes your
    sign in intent's intent sender, and
  • 0:26 - 0:28
    then you tell it the RC_SIGN_IN code so
  • 0:28 - 0:31
    it's actually sign in intent
    that we're working on.
  • 0:31 - 0:34
    This needs to be put
    in a try catch clause.
  • 0:34 - 0:37
    So the catch would be
    IntentSender.SendIntentException,
  • 0:37 - 0:38
    in which case we're
    just going to log it.
  • 0:38 - 0:41
    And we're going to change
    our sign-in progress.
  • 0:41 - 0:44
    If it errors of course,
    we'll also try to reconnect the client.
  • 0:44 - 0:47
    So now this is what we did if
    we didn't have a sign-in intent.
  • 0:47 - 0:50
    And of course, if we did have one
    already we'll just show a dialog saying
  • 0:50 - 0:51
    there was an error.
  • 0:51 - 0:55
    Though sometimes it can happen where
    it's unable to provide an intent.
  • 0:55 - 0:56
    We don't get the accounts intent.
  • 0:56 - 0:59
    And we don't get the confirmation
    screen or anything like that.
  • 0:59 - 1:01
    And in that case we'll
    just log an error.
  • 1:02 - 1:06
    Now this intent will also generate an on
    activity result, so we just need to
  • 1:06 - 1:11
    implement an on activity result code for
    the results coming back from the intent.
Cím:
Resolve Sign In Error
Leírás:

more » « less
Video Language:
English
Team:
Udacity
Projekt:
ud876-5 - Google Play Services - Identity
Duration:
01:12
Udacity Robot edited Angol subtitles for Resolve Sign In Error
Udacity Robot edited Angol subtitles for Resolve Sign In Error
Udacity Robot edited Angol subtitles for Resolve Sign In Error
Cogi-Admin edited Angol subtitles for Resolve Sign In Error

English subtitles

Felülvizsgálatok Compare revisions