メインコンテンツまでスキップ

Maps SDK for Android v9

現在のバージョン:v9.7.1変更履歴を表示

  • check
    Map styles
  • check
    Run-time styling
  • check
    Data clusters
  • check
    Camera manipulation
  • check
    Querying the map
  • check
    Gestures
  • check
    Map images
A newer version of the Maps SDK is available
This page uses v9.7.1 of the Mapbox Maps SDK. A newer version of the SDK is available and is recommended for all users. SDK versions before v10 are no longer receiving updates, including compatibility and bug fixes. Learn about the latest version, v11.9.0, in the Maps SDK documentation.

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.

Upgrade to the most recent version
For information about migrating from older versions of the Mapbox Maps SDK for Android to newer ones, see:- v8.x.x to v9.x.x: Applications implementing this version of the Maps SDK must support AndroidX.- v7.x.x to v8.x.x: This version change improved the method for counting monthly active users. No migration guide is required, but you can read more about these changes in the changelog and the Pricing by products guide.- v6.x.x to v7.x.x- v5.x.x to v6.x.x- v4.x.x to v5.x.x

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.

GUIDE
Attribution guidelines

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 Features.

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.