Maps SDK for Android v9
Current version:v9.7.1
View changelog
- Map styles
- Run-time styling
- Data clusters
- Camera manipulation
- Querying the map
- Gestures
- Map images
The Mapbox Maps SDK for Android is a toolset for displaying maps inside of your Android application.
Mapbox's demo app on the Google Play Store includes many examples of how to use the Mapbox Maps SDK for Android. The demo app and examples page will illustrate the power of the Mapbox Maps SDK for Android.
Attribution
You must include the Mapbox wordmark and attribution notice on any map that uses the Mapbox Maps SDK for Android. The SDK provides an attribution layout that includes all required information and can be customized either in xml or using the UiSettings
object.
You may adjust the position of the Mapbox wordmark and attribution notice, but they must stay visible on the map. You may also change the background and text color of the attribution notice to match your design aesthetics, but all information must be legible.
You may not otherwise alter the Mapbox wordmark or text attribution notice.
Learn more about what kinds of attribution Mapbox requires and why.
Telemetry opt out
Mapbox Telemetry is a powerful location analytics platform included in this SDK. By default, the SDK sends de-identified location and usage data to Mapbox whenever the host app causes it to be gathered. The Mapbox Terms of Service require your app to provide users with a way to individually opt out of Mapbox Telemetry, which is provided automatically as part of the attribution control. If you hide the attribution control, you must provide an alternative opt out for your users to use.
MapView XML attributes
XML attributes can be added inside of the XML MapView
to further customize map behavior, such as setting the starting camera position, enabling tilt, or adjusting the compass' location on the screen. All MapView
XML attributes start with mapbox_
for identification and for removing any potential conflicts with other libraries. Due to the current implementation of Android Studio, you can't generate MapView
attributes by typing. View the full list of MapView
attributes here.
Some examples of MapView
attributes are:
<com.mapbox.mapboxsdk.maps.MapView
mapbox:mapbox_cameraTargetLat="-36.84"
mapbox:mapbox_cameraTargetLng="174.76"
mapbox:mapbox_cameraZoom="10"
mapbox:mapbox_cameraBearing="34.33"
mapbox:mapbox_cameraTilt="50.25"
mapbox:mapbox_cameraZoomMax="12.41"
mapbox:mapbox_cameraZoomMin="6"
mapbox:mapbox_uiRotateGestures="false"/>
Add xmlns:mapbox="http://schemas.android.com/tools"
to the XML file's root View
or ViewGroup
element if you use any MapView
XML attribute.
Understanding GeoJSON
Many parts of the Mapbox Maps SDK for Android are based on GeoJSON, an open standard file format for representing map data. Many Maps SDK methods take GeoJSON geometries as a parameter or return GeoJSON features. For example, the Maps SDK has a GeoJSONSource
class for adding data to a map style, and one helpful Maps SDK's querying method returns a list of GeoJSON Feature
s.
The Mapbox Java SDK's GeoJSON module provides GeoJSON support to the Maps SDK. Although it's not required to use the Maps SDK, becoming more familiar with GeoJSON will greatly enhance your understanding and usage of the Maps SDK. Make sure to read how to use the Java SDK's GeoJSON module with the Maps SDK.