public interface

LocationSource

com.google.android.gms.maps.LocationSource

Class Overview

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.

Summary

Nested Classes
interface LocationSource.OnLocationChangedListener Handles a location update. 
Public Methods
abstract void activate(LocationSource.OnLocationChangedListener listener)
Activates this provider.
abstract void deactivate()
Deactivates this provider.

Public Methods

public abstract void activate (LocationSource.OnLocationChangedListener listener)

Activates this provider. This provider will notify the supplied listener periodically, until you call deactivate(). Notifications will be broadcast on the main thread.

Parameters
listener listener that's called when a new location is available
Throws
IllegalStateException if this provider is already active
IllegalArgumentException if listener is null

public abstract void deactivate ()

Deactivates this provider. The previously-registered callback is not notified of any further updates.

Throws
IllegalStateException if this provider is already inactive