| com.google.android.gms.maps.LocationSource |
Defines an interface for providing location data, typically to a GoogleMap object.
A GoogleMap object has a built-in location provider for its my-location layer, but it can be replaced with another one that implements this interface.
A GoogleMap object activates its location provider using activate(OnLocationChangedListener). While active (between activate(OnLocationChangedListener) and deactivate()), a location provider should push periodic location updates to the listener registered in activate(OnLocationChangedListener). It is the provider's responsibility to use location services wisely according to the map's lifecycle state. For example, it should only using battery-intensive services (like GPS) occasionally, or only while an activity is in the foreground.
| Nested Classes | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
LocationSource.OnLocationChangedListener | Handles a location update. | |||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
Activates this provider.
|
||||||||||
|
|
Deactivates this provider.
|
||||||||||
Activates this provider. This provider will notify the supplied listener periodically, until you call deactivate(). Notifications will be broadcast on the main thread.
| listener | listener that's called when a new location is available |
|---|
| IllegalStateException | if this provider is already active |
|---|---|
| IllegalArgumentException | if listener is null |
Deactivates this provider. The previously-registered callback is not notified of any further updates.
| IllegalStateException | if this provider is already inactive |
|---|