0

Alternatively, does getLastLocation() get the last location update generated by requestLocationUpdates() or can my app access location data requested by other applications: say if Yelp makes the most recent location request will my GoogleApiClient access that resource when I call getLastLocation()?

My confusion is in this line in the Google API docs:

If a location is not available, which should happen very rarely, null will be returned. The best accuracy available while respecting the location permissions will be returned.

Furthermore, in the Udacity android location services course the instructor never calls requestLocationUpdates() only getLastLocation().

mehrdad khosravi
  • 2,228
  • 9
  • 29
  • 34
avicenna.x
  • 303
  • 1
  • 2
  • 9
  • 1
    No relation between getLastLocation() and requestLocationUpdates() directly. getLastLocation() will return location immediately if available. Either location available by your requestLocationUpdates() or by other app. – Ramit Aug 20 '16 at 08:18
  • Can you clarify on `if available`? – avicenna.x Aug 20 '16 at 08:39
  • 1
    Doc says "The getLastLocation() method returns a Location object from which you can retrieve the latitude and longitude coordinates of a geographic location. The location object returned may be null in rare cases when the location is not available." If device do not have location update at all then its possible to get null (Suppose you cleared location history and then gps is off). But in general you will get last updated location of device. – Ramit Aug 20 '16 at 09:08
  • Sweet, thanks @Ramit. – avicenna.x Aug 22 '16 at 04:39
  • If it helps I can add it as answer – Ramit Aug 22 '16 at 05:32

0 Answers0