Return to Video

Changing onConnected for Continuous Update

  • 0:00 - 0:01
    Here's the solution.
  • 0:01 - 0:04
    To create your mLocationRequest,
    you just simply call
  • 0:04 - 0:09
    LocationRequest.create and
    then to set the high accuracy priority,
  • 0:09 - 0:12
    you call LocationRequest.setPriority and
    pass it a constant
  • 0:12 - 0:17
    PRIORITY_HIGH_ACCURACY which you'll
    find in the location request class.
  • 0:17 - 0:21
    You've already set the interval to 1000
    milliseconds so then finally, all you
  • 0:21 - 0:26
    have to do on the FusedLocationApi
    is requestLocationUpdates and
  • 0:26 - 0:30
    pass it to GoogleApiClient,
    to LocationRequest, and this
  • 0:30 - 0:35
    referring to this activity so that the
    call backs will come to this activity.
  • 0:35 - 0:37
    All of these code should be on one line,
  • 0:37 - 0:40
    I've just broken it up into separate
    lines here for easy reading.
  • 0:40 - 0:43
    Now because you were
    requesting location updates,
  • 0:43 - 0:47
    you'll need to implement a call back
    called on location changed which,
  • 0:47 - 0:52
    as its name suggests, will get
    called whenever the location changes
  • 0:52 - 0:55
    even just a little with this interval
    and this high accuracy determining that.
Title:
Changing onConnected for Continuous Update
Description:

more » « less
Video Language:
English
Team:
Udacity
Project:
UD876-1 - Google Play Services - Location & Contex
Duration:
0:57

English subtitles

Revisions Compare revisions