The Google Maps Android API can serve a bitmap image of a map, offering limited interactivity to the user. This is called a lite mode map.
The ApiDemos repository on GitHub includes samples that demonstrate the use of lite mode:
- LiteDemoActivity: The basics of using a lite mode map
- LiteListDemoActivity: Displaying maps efficiently in ListViews using lite mode
Overview of lite mode
A lite mode map is a bitmap image of a map at a specified location and zoom level. Lite mode supports all of the map types (normal, hybrid, satellite, terrain) and a subset of the functionality supplied by the full API. Lite mode is useful when you want to provide a number of maps in a stream, or a map that is too small to support meaningful interaction.
Users viewing the map cannot zoom or pan the map. Icons on the map give users access to viewing the map in the Google Maps mobile app and requesting directions.
Adding a lite mode map
Lite mode uses the same classes and interfaces as the full Google Maps Android
API. You can set a
GoogleMap to lite mode in the following
- Either as an XML attribute for a
- Or in the
As an XML attribute for a
<fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:name="com.google.android.gms.maps.MapFragment" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" map:cameraZoom="13" map:mapType="normal" map:liteMode="true"/>
GoogleMapOptions options = new GoogleMapOptions().liteMode(true);
For details on setting the initial state of the map, see the guide to the map object.
Intents to launch a map view or directions request
By default, a toolbar at the bottom right of the map contains icons that
provide access to a map view or directions request in the Google Maps mobile
app. You can disable the toolbar by calling
UiSettings.setMapToolbarEnabled(false). For more
details, see the toolbar documentation.
Also by default when a user taps the map, the API starts the Google Maps mobile
app. You can override this by using
set your own listener. You can also disable click events on the map, by calling
setClickable() on the view that contains the
details of these two techniques, see the events documentation.
Life cycle events
When using the API in fully interactive mode, users of the
must forward all the activity life cycle methods to the corresponding methods
MapView class. Examples of the life cycle methods include
When using the
MapView class in lite mode, forwarding lifecycle events is
optional, except for the following situations:
- It is mandatory to call
onCreate(), otherwise no map will appear.
- If you wish to show the My Location dot on your lite mode map and use the
default location source, you will need to call
onPause(), because the location source will only update between these calls. If you use your own location source, it's not necessary to call these two methods.
Supported API features
The following table describes the behavior of a lite mode map for each area of API functionality. If an app calls a method that's not supported in lite mode, the API will log a warning message.
The following map types are available via
|Polylines, polygons, circles||
The lite mode functionality for shapes matches the full API.
The lite mode functionality for Projection matches the full API.
The lite mode functionality for the My Location layer matches the full API.
The lite mode support for map padding matches the full API.
If you set the
|Custom base map styles||
The Google Maps Android API supports custom styling of the base map.
You can add a marker and respond to a click event. You can also add custom marker icons. It's not possible to make a marker draggable. Markers on a lite mode map are flat, and they cannot be rotated.
|Camera position, zoom, and animation||
You can set the camera target and zoom, but not the tilt or bearing.
Zoom level is rounded to the nearest integer in lite mode.
Lite mode supports
To disable click events on a map in lite mode, you can call
For details, see the events documentation.
|Indoor maps and buildings||
Lite mode will show the same tiles as the Google Static Maps API. This means that if the indoor floor plan is baked into the default tile, it will appear. Otherwise, it won't. Further, you cannot change the level shown or manipulate a level picker.
Lite mode does not support gestures. Enabling and disabling gestures will have no effect.
Street View is not supported in lite mode.