Lines Matching full:location
1 page.title=Receiving Location Updates
10 <li><a href="#get-last-location">Get the Last Known Location</a></li>
11 <li><a href="#updates">Request Location Updates</a></li>
12 <li><a href="#callback">Define the Location Update Callback</a></li>
13 <li><a href="#stop-updates">Stop Location Updates</a></li>
24 <a href="retrieve-current.html">Getting the Last Known Location</a>
32 <a href="https://github.com/googlesamples/android-play-location/tree/master/LocationUpdates" class="external-link">LocationUpdates</a>
38 <p>If your app can continuously track location, it can deliver more relevant
40 way while walking or driving, or if your app tracks the location of assets, it
41 needs to get the location of the device at regular intervals. As well as the
42 geographical location (latitude and longitude), you may want to give the user
45 in the {@link android.location.Location} object that your app can retrieve
47 <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html">fused
48 location provider</a>.</p>
50 <p>While you can get a device's location with
51 <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#getLastLocation(com.google.android.gms.common.api.GoogleApiClient)">{@code getLastLocation()}</a>,
53 <a href="retrieve-current.html">Getting the Last Known Location</a>,
54 a more direct approach is to request periodic updates from the fused location
56 available location, based on the currently-available location providers such
57 as WiFi and GPS (Global Positioning System). The accuracy of the location is
58 determined by the providers, the location permissions you've requested, and
59 the options you set in the location request.</p>
62 location using the
63 <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#requestLocationUpdates(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location.LocationRequest, com.google.android.gms.location.LocationListener)">{@code requestLocationUpdates()}</a>
64 method in the fused location provider.
66 <h2 id="get-last-location">Get the Last Known Location</h2>
68 <p>The last known location of the device provides a handy base from which to
69 start, ensuring that the app has a known location before starting the
70 periodic location updates. The lesson on
71 <a href="retrieve-current.html">Getting the Last Known Location</a> shows you
72 how to get the last known location by calling
73 <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#getLastLocation(com.google.android.gms.common.api.GoogleApiClient)">{@code getLastLocation()}</a>.
75 retrieved the last known location and stored it as a
76 {@link android.location.Location} object in the global variable
79 <p>Apps that use location services must request location permissions. In this
80 lesson you require fine location detection, so that your app can get as
81 precise a location as possible from the available location providers. Request
88 package="com.google.android.gms.location.sample.locationupdates" >
94 <h2 id="updates">Request Location Updates</h2>
96 <p>Before requesting location updates, your app must connect to location
97 services and make a location request. The lesson on
98 <a href="change-location-settings.html">Changing Location Settings</a>
99 shows you how to do this. Once a location request is in place you can start
101 <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#requestLocationUpdates(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location.LocationRequest, com.google.android.gms.location.LocationListener)">{@code requestLocationUpdates()}</a>.
107 <p>Depending on the form of the request, the fused location provider either
109 <a href="{@docRoot}reference/com/google/android/gms/location/LocationListener.html">{@code LocationListener.onLocationChanged()}</a>
110 callback method and passes it a {@link android.location.Location} object, or
113 that contains the location in its extended data. The accuracy and frequency of
114 the updates are affected by the location permissions you've requested and the
115 options you set in the location request object.</p>
118 <a href="{@docRoot}reference/com/google/android/gms/location/LocationListener.html">{@code LocationListener}</a>
120 <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#requestLocationUpdates(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location.LocationRequest, com.google.android.gms.location.LocationListener)">{@code requestLocationUpdates()}</a>,
124 <a href="{@docRoot}reference/com/google/android/gms/location/LocationRequest.html">{@code LocationRequest}</a>
126 and a <a href="{@docRoot}reference/com/google/android/gms/location/LocationListener.html">{@code LocationListener}</a>.
148 turned location updates on or off. For more about retaining the value of this
152 <h2 id="callback">Define the Location Update Callback</h2>
154 <p>The fused location provider invokes the
155 <a href="{@docRoot}reference/com/google/android/gms/location/LocationListener.html#onLocationChanged(android.location.Location)">{@code LocationListener.onLocationChanged()}</a>
156 callback method. The incoming argument is a {@link android.location.Location}
157 object containing the location's latitude and longitude. The following snippet
159 <a href="{@docRoot}reference/com/google/android/gms/location/LocationListener.html">{@code LocationListener}</a>
160 interface and define the method, then get the timestamp of the location update
169 public void onLocationChanged(Location location) {
170 mCurrentLocation = location;
183 <h2 id="stop-updates">Stop Location Updates</h2>
185 <p>Consider whether you want to stop the location updates when the activity is
193 <p>To stop location updates, call
194 <a href="{@docRoot}reference/com/google/android/gms/location/FusedLocationProviderApi.html#removeLocationUpdates(com.google.android.gms.common.api.GoogleApiClient, com.google.android.gms.location.LocationListener)">{@code removeLocationUpdates()}</a>,
198 <a href="{@docRoot}reference/com/google/android/gms/location/LocationListener.html">{@code LocationListener}</a>,
215 whether location updates are currently turned on. In the activity's
217 whether location updates are currently active, and activate them if not:</p>
307 <a href="display-address.html">Displaying a Location Address</a>, shows
308 you how to display the street address for a given location.</p>