YouTube

Got a YouTube account?

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

English subtitles

← Unconnected

Get Embed Code
4 Languages

Showing Revision 4 created 05/24/2016 by Udacity Robot.

  1. After we connect the client in
    the onStart, it takes some time for
  2. the connection to happen.
  3. And when it does,
    the onConnected callback will fire.
  4. This is the meat of our app.
  5. We've connected to location services,
    so we should be
  6. able to get the last location
    from the fused location provider.
  7. And if we do get something,
    then we can read the latitude and
  8. the longitude from it.
  9. We convert that to a string and
  10. then load it into the appropriate
    text field as you can see here.
  11. Now, remember, all this will happen
    if last location is not null.
  12. So, here I've just checked if
    mLastLocation is not equal to null,
  13. then I will do all of this.
  14. Because if it was equal to null,
    then getting the latitude and
  15. getting the longitude
    might produce an error.