ConsumerGoogleMap

public interface ConsumerGoogleMap

Provides access to Google Maps Android API as a proxy to the underlying GoogleMap which is the entry point for all methods related to the map. You must obtain ConsumerGoogleMap object using ConsumerMapFragment.getConsumerGoogleMapAsync(ConsumerMapReadyCallback), ConsumerMapView.getConsumerGoogleMapAsync(ConsumerMapReadyCallback, Fragment, GoogleMapOptions) or ConsumerMapView.getConsumerGoogleMapAsync(ConsumerMapReadyCallback, FragmentActivity, GoogleMapOptions). You cannot instantiate an instance directly.

Note: Similar to a View object, a ConsumerGoogleMap can only be read and modified from the Android UI thread. Calling ConsumerGoogleMap methods from another thread will result in an exception.

You can adjust the viewpoint of a map by changing the position of the camera (as opposed to moving the map). You can use the map's camera to set parameters such as location, zoom level, tilt angle, and bearing. For more information, see Camera and View.

Developer Guide

To get started, read the Google Maps Android API v2 developer guide.

ConsumerGoogleMap methods behave the same as the underlying GoogleMap with a few differences.

Nested Class Summary

class ConsumerGoogleMap.ConsumerMapReadyCallback Callback to get a handle to ConsumerGoogleMap

Public Method Summary

abstract Circle
addCircle(CircleOptions options)
Add a circle to this map.
abstract GroundOverlay
addGroundOverlay(GroundOverlayOptions options)
Adds an image to this map.
abstract Marker
addMarker(MarkerOptions options)
Adds a marker to this map.
abstract Polygon
addPolygon(PolygonOptions options)
Adds a polygon to this map.
abstract Polyline
addPolyline(PolylineOptions options)
Adds a polyline to this map.
abstract TileOverlay
addTileOverlay(TileOverlayOptions options)
Adds a tile overlay to this map.
abstract void
animateCamera(CameraUpdate update, GoogleMap.CancelableCallback callback)
Animates the movement of the camera from the current position to the position defined in the update and calls an optional callback on completion.
abstract void
animateCamera(CameraUpdate update)
Animates the movement of the camera from the current position to the position defined in the update.
abstract void
animateCamera(CameraUpdate update, int durationMs, GoogleMap.CancelableCallback callback)
Moves the map according to the update with an animation over a specified duration, and calls an optional callback on completion.
abstract void
clear()
Removes all markers, polylines, polygons, overlays, etc from the map.
abstract CameraPosition
getCameraPosition()
Gets the current position of the camera.
abstract ConsumerController
getConsumerController()
Returns ConsumerController for managing ridesharing.
abstract IndoorBuilding
getFocusedBuilding()
Gets the currently focused building.
abstract int
getMapType()
Gets the type of map that's currently displayed.
abstract float
getMaxZoomLevel()
Returns the maximum zoom level for the current camera position.
abstract float
getMinZoomLevel()
Returns the minimum zoom level.
abstract Projection
getProjection()
Returns a Projection object that you can use to convert between screen coordinates and latitude/longitude coordinates.
abstract UiSettings
getUiSettings()
Gets the user interface settings for the map.
abstract boolean
isBuildingsEnabled()
Returns whether 3D buildings layer is enabled.
abstract boolean
isIndoorEnabled()
Gets whether indoor maps are currently enabled.
abstract boolean
isMyLocationEnabled()
Gets the status of the my-location layer.
abstract boolean
isTrafficEnabled()
Checks whether the map is drawing traffic data.
abstract void
moveCamera(CameraUpdate update)
Repositions the camera according to the instructions defined in the update.
abstract void
resetMinMaxZoomPreference()
Removes any previously specified upper and lower zoom bounds.
abstract void
setBuildingsEnabled(boolean enabled)
Turns the 3D buildings layer on or off.
abstract void
setContentDescription(String description)
Sets a contentDescription for the map.
abstract boolean
setIndoorEnabled(boolean enabled)
Sets whether indoor maps should be enabled.
abstract void
setInfoWindowAdapter(GoogleMap.InfoWindowAdapter adapter)
Sets a custom renderer for the contents of info windows.
abstract void
setLatLngBoundsForCameraTarget(LatLngBounds bounds)
Specifies a LatLngBounds to constrain the camera target, so that when users scroll and pan the map, the camera target does not move outside these bounds.
abstract void
setLocationSource(LocationSource source)
Replaces the location source of the my-location layer.
abstract boolean
setMapStyle(MapStyleOptions style)
Sets the styling of the base map.
abstract void
setMapType(int type)
Sets the type of map tiles that should be displayed.
abstract void
setMaxZoomPreference(float maxZoomPreference)
Sets a preferred upper bound for the camera zoom.
abstract void
setMinZoomPreference(float minZoomPreference)
Sets a preferred lower bound for the camera zoom.
abstract void
setMyLocationEnabled(boolean enabled)
Enables or disables the my-location layer.
abstract void
setOnCameraIdleListener(GoogleMap.OnCameraIdleListener listener)
Sets a callback that is invoked when camera movement has ended.
abstract void
setOnCameraMoveCanceledListener(GoogleMap.OnCameraMoveCanceledListener listener)
Sets a callback that is invoked when camera motion is stopped or interrupted by a new type of animation.
abstract void
setOnCameraMoveListener(GoogleMap.OnCameraMoveListener listener)
Sets a callback that is invoked repeatedly while the camera is in motion.
abstract void
setOnCameraMoveStartedListener(GoogleMap.OnCameraMoveStartedListener listener)
Sets a callback that is invoked when the camera starts moving or the reason for camera motion has changed.
abstract void
setOnCircleClickListener(GoogleMap.OnCircleClickListener listener)
Sets a callback that is invoked when a circle is clicked.
abstract void
setOnGroundOverlayClickListener(GoogleMap.OnGroundOverlayClickListener listener)
Sets a callback that is invoked when a ground overlay is clicked.
abstract void
setOnIndoorStateChangeListener(GoogleMap.OnIndoorStateChangeListener listener)
Sets or clears the listener for indoor events.
abstract void
setOnInfoWindowClickListener(GoogleMap.OnInfoWindowClickListener listener)
Sets a callback that is invoked when a marker info window is clicked.
abstract void
setOnInfoWindowCloseListener(GoogleMap.OnInfoWindowCloseListener listener)
Sets a callback that is invoked when a marker's info window is closed.
abstract void
setOnInfoWindowLongClickListener(GoogleMap.OnInfoWindowLongClickListener listener)
Sets a callback that is invoked when a marker's info window is long pressed.
abstract void
setOnMapClickListener(GoogleMap.OnMapClickListener listener)
Sets a callback that is invoked when the map is tapped.
abstract void
setOnMapLoadedCallback(GoogleMap.OnMapLoadedCallback callback)
Sets a callback that is invoked when this map has finished rendering.
abstract void
setOnMapLongClickListener(GoogleMap.OnMapLongClickListener listener)
Sets a callback that is invoked when the map is long pressed.
abstract void
setOnMarkerClickListener(GoogleMap.OnMarkerClickListener listener)
Sets a callback that is invoked when a marker is clicked.
abstract void
setOnMarkerDragListener(GoogleMap.OnMarkerDragListener listener)
Sets a callback that is invoked when a marker is dragged.
abstract void
setOnMyLocationButtonClickListener(GoogleMap.OnMyLocationButtonClickListener listener)
Sets a callback that is invoked when the my location button is clicked.
abstract void
setOnMyLocationClickListener(GoogleMap.OnMyLocationClickListener listener)
Sets a callback that is invoked when the My Location dot (which signifies the user's location) is clicked.
abstract void
setOnPoiClickListener(GoogleMap.OnPoiClickListener listener)
Sets a listener that is triggered when a point of interest is clicked or tapped.
abstract void
setOnPolygonClickListener(GoogleMap.OnPolygonClickListener listener)
Sets a callback that is invoked when a polygon is clicked.
abstract void
setOnPolylineClickListener(GoogleMap.OnPolylineClickListener listener)
Sets a callback that is invoked when a polyline is clicked.
abstract void
setPadding(int left, int top, int right, int bottom)
Sets padding on the map.
abstract void
setTrafficEnabled(boolean enabled)
Turns the traffic layer on or off.
abstract void
snapshot(GoogleMap.SnapshotReadyCallback callback, Bitmap bitmap)
Takes a snapshot of the map.
abstract void
snapshot(GoogleMap.SnapshotReadyCallback callback)
Takes a snapshot of the map.
abstract void
stopAnimation()
Stops the camera animation if there is one in progress.

Public Methods

public abstract Circle addCircle (CircleOptions options)

Add a circle to this map.

Parameters
options A circle options object that defines how to render the Circle
Returns
  • The Circle object that is added to the map

public abstract GroundOverlay addGroundOverlay (GroundOverlayOptions options)

Adds an image to this map.

Parameters
options A ground-overlay options object that defines how to render the overlay. Options must have an image (AnchoredBitmap) and position specified.
Returns
Throws
IllegalArgumentException if either the image or the position is unspecified in the options.

public abstract Marker addMarker (MarkerOptions options)

Adds a marker to this map.

The marker's icon is rendered on the map at the location Marker.position. Clicking the marker centers the camera on the marker. If Marker.title is defined, the map shows an info box with the marker's title and snippet. If the marker is draggable, long-clicking and then dragging the marker moves it.

Parameters
options A marker options object that defines how to render the marker.
Returns
  • The Marker that was added to the map.

public abstract Polygon addPolygon (PolygonOptions options)

Adds a polygon to this map.

Parameters
options A polygon options object that defines how to render the Polygon.
Returns
  • The Polygon object that is added to the map.

public abstract Polyline addPolyline (PolylineOptions options)

Adds a polyline to this map.

Parameters
options A polyline options object that defines how to render the Polyline.
Returns
  • The Polyline object that was added to the map.

public abstract TileOverlay addTileOverlay (TileOverlayOptions options)

Adds a tile overlay to this map. See TileOverlay for more information.

Note that unlike other overlays, if the map is recreated, tile overlays are not automatically restored and must be re-added manually.

Parameters
options A tile-overlay options object that defines how to render the overlay. Options must have a TileProvider specified, otherwise an IllegalArgumentException will be thrown.
Returns
Throws
IllegalArgumentException if the TileProvider is unspecified in the options.

public abstract void animateCamera (CameraUpdate update, GoogleMap.CancelableCallback callback)

Animates the movement of the camera from the current position to the position defined in the update and calls an optional callback on completion. See CameraUpdateFactory for a set of updates.

During the animation, a call to getCameraPosition() returns an intermediate location of the camera.

Parameters
update The change that should be applied to the camera.
callback The callback to invoke from the Android UI thread when the animation stops. If the animation completes normally, GoogleMap.CancelableCallback.onFinish() is called; otherwise, GoogleMap.CancelableCallback.onCancel() is called. Do not update or animate the camera from within GoogleMap.CancelableCallback.onCancel().

public abstract void animateCamera (CameraUpdate update)

Animates the movement of the camera from the current position to the position defined in the update. During the animation, a call to getCameraPosition() returns an intermediate location of the camera.

See CameraUpdateFactory for a set of updates.

Parameters
update The change that should be applied to the camera.

public abstract void animateCamera (CameraUpdate update, int durationMs, GoogleMap.CancelableCallback callback)

Moves the map according to the update with an animation over a specified duration, and calls an optional callback on completion. See CameraUpdateFactory for a set of updates.

If getCameraPosition() is called during the animation, it will return the current location of the camera in flight.

Parameters
update
durationMs The duration of the animation in milliseconds. This must be strictly positive, otherwise an IllegalArgumentException will be thrown.
callback An optional callback to be notified from the Android UI thread when the animation stops. If the animation stops due to its natural completion, the callback will be notified with GoogleMap.CancelableCallback.onFinish(). If the animation stops due to interruption by a later camera movement or a user gesture, GoogleMap.CancelableCallback.onCancel() will be called. The callback should not attempt to move or animate the camera in its cancellation method. If a callback isn't required, leave it as null.

public abstract void clear ()

Removes all markers, polylines, polygons, overlays, etc from the map.

public abstract CameraPosition getCameraPosition ()

Gets the current position of the camera.

The CameraPosition returned is a snapshot of the current position, and will not automatically update when the camera moves.

For more information about changing the camera's position, see Camera and View.

Returns
  • The current position of the Camera.

public abstract ConsumerController getConsumerController ()

Returns ConsumerController for managing ridesharing.

public abstract IndoorBuilding getFocusedBuilding ()

Gets the currently focused building.

Returns
  • The current focused building or null if no building is focused.

public abstract int getMapType ()

Gets the type of map that's currently displayed. See #MAP_TYPE_NORMAL, #MAP_TYPE_SATELLITE, #MAP_TYPE_TERRAIN for possible values.

Returns
  • The map type.

public abstract float getMaxZoomLevel ()

Returns the maximum zoom level for the current camera position. This takes into account what map type is currently being used, for example, satellite or terrain may have a lower max zoom level than the base map tiles.

For more information about changing the camera's zoom level, see Camera and View.

Returns
  • The maximum zoom level available at the current camera position.

public abstract float getMinZoomLevel ()

Returns the minimum zoom level. This is the same for every location (unlike the maximum zoom level) but may vary between devices and map sizes.

For more information about changing the camera's zoom level, see Camera and View.

Returns
  • The minimum zoom level available.

public abstract Projection getProjection ()

Returns a Projection object that you can use to convert between screen coordinates and latitude/longitude coordinates.

The Projection returned is a snapshot of the current projection, and will not automatically update when the camera moves. As this operation is expensive, you should get the projection only once per screen. Google Maps uses the Mercator projection to create its maps from geographic data and convert points on the map into geographic coordinates.

Returns

public abstract UiSettings getUiSettings ()

Gets the user interface settings for the map.

Returns

public abstract boolean isBuildingsEnabled ()

Returns whether 3D buildings layer is enabled.

Returns
  • true if buildings are enabled; false otherwise.

public abstract boolean isIndoorEnabled ()

Gets whether indoor maps are currently enabled.

Returns
  • true if indoor maps are enabled; false if indoor maps are disabled;

public abstract boolean isMyLocationEnabled ()

Gets the status of the my-location layer.

Returns
  • true if the my-location layer is enabled; false otherwise.

public abstract boolean isTrafficEnabled ()

Checks whether the map is drawing traffic data. This is subject to the availability of traffic data.

Returns
  • true if traffic data is enabled; false otherwise.

public abstract void moveCamera (CameraUpdate update)

Repositions the camera according to the instructions defined in the update. The move is instantaneous, and a subsequent getCameraPosition() will reflect the new position. See CameraUpdateFactory for a set of updates.

Parameters
update The change that should be applied to the camera.

public abstract void resetMinMaxZoomPreference ()

Removes any previously specified upper and lower zoom bounds.

public abstract void setBuildingsEnabled (boolean enabled)

Turns the 3D buildings layer on or off.

Parameters
enabled true to enable the 3D buildings layer; false to disable 3D buildings.

public abstract void setContentDescription (String description)

Sets a contentDescription for the map.

This is used to provide a spoken description of the map in accessibility mode. The default value is "Google Map"

Parameters
description a string to use as a description.

public abstract boolean setIndoorEnabled (boolean enabled)

Sets whether indoor maps should be enabled. Currently, indoor maps can only be shown on one map at a time and by default, this is the first map added to your application. To enable indoor maps on another map, you must first disable indoor maps on the original map. If you try to enable indoor maps when it is enabled on another map, nothing will happen and this will return false. When Indoor is not enabled for a map, all methods related to indoor will return null, or false.

Parameters
enabled true to try to enable indoor maps; false to disable indoor maps.
Returns
  • whether it was possible to enable indoor maps.

public abstract void setInfoWindowAdapter (GoogleMap.InfoWindowAdapter adapter)

Sets a custom renderer for the contents of info windows.

Like the map's event listeners, this state is not serialized with the map. If the map is re-created (for example, due to a configuration change), you must call this method again in order to preserve the customization.

Parameters
adapter The adapter to use for info window contents, or null to use the default content rendering in info windows.

public abstract void setLatLngBoundsForCameraTarget (LatLngBounds bounds)

Specifies a LatLngBounds to constrain the camera target, so that when users scroll and pan the map, the camera target does not move outside these bounds.

Set to null to clear the bounding box completely. The new bounds replaces any previously specified bounding box.

When the LatLngBounds changes, the API adjusts all later camera updates to respect those bounds if possible. Note that there are technical considerations that may prevent the API from keeping the camera target strictly within the bounds. For example, floating point precision rounding errors or a very low zoom level.

Parameters
bounds The bounds to constrain the camera target within.

public abstract void setLocationSource (LocationSource source)

Replaces the location source of the my-location layer.

Parameters
source A location source to use in the my-location layer. Set to null to use the default location source.

public abstract boolean setMapStyle (MapStyleOptions style)

Sets the styling of the base map.

Using the style options, you can apply custom styles to features and elements on the map. See MapStyleOptions for style definition details.

Set to null to clear any previous custom styling.

Returns
  • true if the style was successfully parsed; false if problems are detected with the MapStyleOptions, such as unparsable styling JSON, unrecognized feature type, unrecognized element type, or invalid styler keys. If the return value is false, the current style is left unchanged.

public abstract void setMapType (int type)

Sets the type of map tiles that should be displayed. The allowable values are:

  • #MAP_TYPE_NORMAL: Basic map.
  • #MAP_TYPE_SATELLITE: Satellite imagery.
  • #MAP_TYPE_HYBRID: Satellite imagery with roads and labels.
  • #MAP_TYPE_TERRAIN: Topographic data.
  • #MAP_TYPE_NONE: No base map tiles.
Parameters
type The type of map to display.

public abstract void setMaxZoomPreference (float maxZoomPreference)

Sets a preferred upper bound for the camera zoom.

When the maximum zoom changes, the API adjusts all later camera updates to respect that maximum if possible. Note that there are technical considerations that may prevent the API from allowing users to zoom too deeply into the map. For example, satellite or terrain may have a lower maximum zoom than the base map tiles.

The API resolves any conflicts in the minimum and maximum values. If you set the minimum zoom to a higher zoom level than the current maximum, then the API uses the new minimum value for both minimum and maximum. If you set the maximum zoom to a lower zoom level than the minimum, the API uses the new maximum value for both minimum and maximum. For example: Assume the current minimum zoom is 8 and the maximum is 14. Then you set the maximum zoom to 6. The API uses a minimum zoom of 6 and a maximum zoom of 6.

Parameters
maxZoomPreference The preferred upper bound.

public abstract void setMinZoomPreference (float minZoomPreference)

Sets a preferred lower bound for the camera zoom.

When the minimum zoom changes, the API adjusts all later camera updates to respect that minimum if possible. Note that there are technical considerations that may prevent the API from allowing users to zoom too low.

The API resolves any conflicts in the minimum and maximum values. If you set the minimum zoom to a higher zoom level than the current maximum, then the API uses the new minimum value for both minimum and maximum. If you set the maximum zoom to a lower zoom level than the minimum, the API uses the new maximum value for both minimum and maximum. For example: Assume the current minimum zoom is 8 and the maximum is 14. Then you set the minimum zoom to 16. The API uses a minimum zoom of 16 and a maximum zoom of 16.

Parameters
minZoomPreference The preferred lower bound.

public abstract void setMyLocationEnabled (boolean enabled)

Enables or disables the my-location layer.

While enabled and the location is available, the my-location layer continuously draws an indication of a user's current location and bearing, and displays UI controls that allow a user to interact with their location (for example, to enable or disable camera tracking of their location and bearing).

In order to use the my-location-layer feature you need to request permission for either ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION unless you have set a custom location source.

If you have set a custom location source via setLocationSource(LocationSource) the Google Maps Android API will not check whether the above permissions have been granted. However, you still need to make sure that the user has granted all the permissions required for your custom location source.

Parameters
enabled true to enable; false to disable.
Throws
SecurityException if location permission is not granted.

public abstract void setOnCameraIdleListener (GoogleMap.OnCameraIdleListener listener)

Sets a callback that is invoked when camera movement has ended.

Parameters
listener The callback that is invoked. To unset the callback, use null.

public abstract void setOnCameraMoveCanceledListener (GoogleMap.OnCameraMoveCanceledListener listener)

Sets a callback that is invoked when camera motion is stopped or interrupted by a new type of animation.

Parameters
listener The callback that is invoked. To unset the callback, use null. Do not update or animate the camera from within onCameraMoveCanceled().

public abstract void setOnCameraMoveListener (GoogleMap.OnCameraMoveListener listener)

Sets a callback that is invoked repeatedly while the camera is in motion. The callback may be invoked as often as once every frame and should not perform expensive operations.

Parameters
listener The callback that is invoked. To unset the callback, use null.

public abstract void setOnCameraMoveStartedListener (GoogleMap.OnCameraMoveStartedListener listener)

Sets a callback that is invoked when the camera starts moving or the reason for camera motion has changed.

Parameters
listener The callback that is invoked. To unset the callback, use null. Do not update or animate the camera from within onCameraMoveStarted().

public abstract void setOnCircleClickListener (GoogleMap.OnCircleClickListener listener)

Sets a callback that is invoked when a circle is clicked.

Parameters
listener The callback that is invoked when a circle is clicked. To unset the callback, use null.

public abstract void setOnGroundOverlayClickListener (GoogleMap.OnGroundOverlayClickListener listener)

Sets a callback that is invoked when a ground overlay is clicked.

Parameters
listener The callback that is invoked when a ground overlay is clicked. To unset the callback, use null.

public abstract void setOnIndoorStateChangeListener (GoogleMap.OnIndoorStateChangeListener listener)

Sets or clears the listener for indoor events. Only one listener can ever be set. Setting a new listener will remove the previous listener.

Parameters
listener the listener for indoor events if non-null; otherwise, clears the listener

public abstract void setOnInfoWindowClickListener (GoogleMap.OnInfoWindowClickListener listener)

Sets a callback that is invoked when a marker info window is clicked.

Parameters
listener The callback that is invoked when a marker info window is clicked. To unset the callback, use null.

public abstract void setOnInfoWindowCloseListener (GoogleMap.OnInfoWindowCloseListener listener)

Sets a callback that is invoked when a marker's info window is closed.

Parameters
listener The callback that is invoked when a marker's info window is closed. To unset the callback, use null.

public abstract void setOnInfoWindowLongClickListener (GoogleMap.OnInfoWindowLongClickListener listener)

Sets a callback that is invoked when a marker's info window is long pressed.

Parameters
listener The callback that is invoked when a marker's info window is long pressed. To unset the callback, use null.

public abstract void setOnMapClickListener (GoogleMap.OnMapClickListener listener)

Sets a callback that is invoked when the map is tapped.

Parameters
listener The callback that is invoked when the map is tapped. To unset the callback, use null.

public abstract void setOnMapLoadedCallback (GoogleMap.OnMapLoadedCallback callback)

Sets a callback that is invoked when this map has finished rendering. The callback will only be invoked once.

If this method is called when the map is fully rendered, the callback will be invoked immediately. This event will not fire if the map never loads due to connectivity issues, or if the map is continuously changing and never completes loading due to the user constantly interacting with the map.

Parameters
callback The callback invoked when the map has finished rendering. To unset the callback, use null.

public abstract void setOnMapLongClickListener (GoogleMap.OnMapLongClickListener listener)

Sets a callback that is invoked when the map is long pressed.

Parameters
listener The callback that is invoked when the map is long pressed. To unset the callback, use null.

public abstract void setOnMarkerClickListener (GoogleMap.OnMarkerClickListener listener)

Sets a callback that is invoked when a marker is clicked. ConsumerGoogleMap may take action and may consume this event in which case this callback will not be called, otherwise it will be called normally.

Parameters
listener The callback that is invoked when a marker is clicked. To unset the callback, use null.

public abstract void setOnMarkerDragListener (GoogleMap.OnMarkerDragListener listener)

Sets a callback that is invoked when a marker is dragged.

Parameters
listener The callback that is invoked on marker drag events. To unset the callback, use null.

public abstract void setOnMyLocationButtonClickListener (GoogleMap.OnMyLocationButtonClickListener listener)

Sets a callback that is invoked when the my location button is clicked.

If the listener returns true, the event is consumed and the default behavior will not occur. If it returns false, the default behavior occurs (for example, the camera moves such that it is centered on the user's location).

Parameters
listener The callback that is invoked when the My Location button is clicked.

public abstract void setOnMyLocationClickListener (GoogleMap.OnMyLocationClickListener listener)

Sets a callback that is invoked when the My Location dot (which signifies the user's location) is clicked. ConsumerGoogleMap may take action and may consume this event in which case this callback will not be called, otherwise it will be called normally.

Parameters
listener The callback that is invoked when the My Location dot is clicked.

public abstract void setOnPoiClickListener (GoogleMap.OnPoiClickListener listener)

Sets a listener that is triggered when a point of interest is clicked or tapped.

Pass null to clear the listener.

public abstract void setOnPolygonClickListener (GoogleMap.OnPolygonClickListener listener)

Sets a callback that is invoked when a polygon is clicked.

Parameters
listener The callback that is invoked when a polygon is clicked. To unset the callback, use null.

public abstract void setOnPolylineClickListener (GoogleMap.OnPolylineClickListener listener)

Sets a callback that is invoked when a polyline is clicked.

Parameters
listener The callback that is invoked when a polyline is clicked. To unset the callback, use null.

public abstract void setPadding (int left, int top, int right, int bottom)

Sets padding on the map.

This method allows you to define a visible region on the map, to signal to the map that portions of the map around the edges may be obscured, by setting padding on each of the four edges of the map. Map functions will be adapted to the padding. For example, the zoom controls, compass, copyright notices and Google logo will be moved to fit inside the defined region, and camera movements will be relative to the center of the visible region.

Parameters
left the number of pixels of padding to be added on the left of the map.
top the number of pixels of padding to be added on the top of the map.
right the number of pixels of padding to be added on the right of the map.
bottom the number of pixels of padding to be added on the bottom of the map.

public abstract void setTrafficEnabled (boolean enabled)

Turns the traffic layer on or off.

public abstract void snapshot (GoogleMap.SnapshotReadyCallback callback, Bitmap bitmap)

Takes a snapshot of the map.

This method is equivalent to snapshot(SnapshotReadyCallback) but lets you provide a preallocated Bitmap. If the bitmap does not match the current dimensions of the map, another bitmap will be allocated that fits the map's dimensions.

Although in most cases the object passed by the callback method is the same as the one given in the parameter to this method, in some cases the returned object can be different (for example, if he view's dimensions have changed by the time the snapshot is actually taken). You should only trust the content of the bitmap passed by the callback method.

Parameters
callback Callback method invoked when the snapshot is taken.
bitmap A preallocated bitmap. If null, behaves like snapshot(SnapshotReadyCallback).

public abstract void snapshot (GoogleMap.SnapshotReadyCallback callback)

Takes a snapshot of the map.

You can use snapshots within your application when an interactive map would be difficult, or impossible, to use. For example, images produced with the snapshot() method can be used to display a thumbnail of the map in your app, or a snapshot in the notification center.

Note: Images of the map must not be transmitted to your servers, or otherwise used outside of the application. If you need to send a map to another application or user, send data that allows them to reconstruct the map for the new user instead of a snapshot.

Parameters
callback Callback method invoked when the snapshot is taken.

public abstract void stopAnimation ()

Stops the camera animation if there is one in progress. When the method is called, the camera stops moving immediately and remains in that position.