Suivez ces étapes pour configurer les repères avancés.
Activer le nouveau moteur de rendu de carte
Un moteur de rendu de carte amélioré est disponible à partir de la version 18.0.0 du SDK Maps pour Android. Ce moteur de rendu ajoute de nombreuses améliorations au SDK Maps pour Android, y compris la compatibilité avec les styles de cartes basés dans le cloud.
En publiant la version 18.2.0 du SDK Maps pour Android, Google a remplacé l'ancien moteur de rendu par défaut par le moteur de rendu de carte amélioré. Par conséquent, celui-ci est désormais utilisé par défaut dans votre application lorsque vous créez une application ou que vous la recompilez.
Créer un ID de carte
Pour créer un ID de carte, suivez les étapes décrites dans Créer un ID de carte. Assurez-vous de définir le type de carte sur Android.
Modifier le code d'initialisation de la carte
Cette étape nécessite l'ID de carte que vous venez de créer. Il se trouve sur votre page Gestion des cartes.
Vérifier les fonctionnalités de la carte (obligatoire)
Les repères avancés nécessitent un ID de carte. Si l'ID de carte est manquant ou si un ID non valide est transmis, les repères avancés ne seront pas chargés. Utilisez la méthode MapCapabilities.isAdvancedMarkersAvailable() pour vérifier si les repères avancés sont compatibles.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2024/05/15 (UTC).
[null,null,["Dernière mise à jour le 2024/05/15 (UTC)."],[[["\u003cp\u003eAdvanced markers necessitate the utilization of the upgraded map renderer, available in Maps SDK for Android version 18.0.0 and later, and are enabled by default in version 18.2.0 and later.\u003c/p\u003e\n"],["\u003cp\u003eA crucial initial step involves creating a map ID within the Google Cloud console and integrating it into your map initialization code.\u003c/p\u003e\n"],["\u003cp\u003eIt is imperative to verify if advanced markers are supported on the device using \u003ccode\u003eMapCapabilities.isAdvancedMarkersAvailable()\u003c/code\u003e, and to provide a fallback mechanism, such as standard markers, if they are not.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers must ensure compatibility by checking device requirements for the new map renderer, as some devices might not support it.\u003c/p\u003e\n"]]],[],null,["# Get started\n\nSelect platform: [Android](/maps/documentation/android-sdk/advanced-markers/start \"View this page for the Android platform docs.\") [iOS](/maps/documentation/ios-sdk/advanced-markers/overview \"View this page for the iOS platform docs.\") [JavaScript](/maps/documentation/javascript/advanced-markers/start \"View this page for the JavaScript platform docs.\")\n\n\u003cbr /\u003e\n\nFollow these steps to get set up with advanced markers.\n\nEnable the new map renderer\n---------------------------\n\nAn upgraded map renderer is available as of version 18.0.0 of the\nMaps SDK for Android. This renderer brings many improvements, including\nsupport for Cloud-based maps styling, to Maps SDK for Android.\n\nWith the release of version 18.2.0 of the Maps SDK for Android, Google switched the\ndefault renderer from the legacy renderer to the upgraded map renderer. This\nchange means that the upgraded map renderer is now used by default in your app\nwhen you build a new app or rebuild an existing app.\n| **Caution:** To use advanced markers in your app, your app must be built using the upgraded map renderer. If you are adding advanced markers to an existing app, ensure that you rebuild the app so that your app uses the upgraded map renderer. For more information, see [New Map Renderer](/maps/documentation/android-sdk/renderer).\n\nCreate a map ID\n---------------\n\nTo create a new map ID, follow the steps at\n[Create a map ID](/maps/documentation/get-map-id#create-a-map-id). Make sure you\nset the Map type to **Android**.\n| **Important:** For testing, you can skip the step of creating and configuring a map ID by using a map ID of `DEMO_MAP_ID` in your app code. `DEMO_MAP_ID` is intended for testing purposes only. Don't use `DEMO_MAP_ID` in a production environment.\n\nUpdate your map initialization code\n-----------------------------------\n\nThis step requires the map ID you just created. It can be found on your [Maps\nManagement](https://console.cloud.google.com/google/maps-apis/studio/maps) page.\n\nTo add the map ID to your initialization code, see\n[Add the map ID to your app](/maps/documentation/get-map-id#add-a-map-id-to-your-app).\n\nCheck map capabilities (required)\n---------------------------------\n\nAdvanced markers requires a map ID. If the map ID is missing, or an\ninvalid map ID is passed, advanced markers cannot load. Use\nthe\n[`MapCapabilities.isAdvancedMarkersAvailable()`](/android/reference/com/google/android/gms/maps/model/MapCapabilities)\nmethod to check to see if advanced markers are supported.\n| **Caution:** Some devices might not support the new map renderer and therefore cannot display advanced markers. You must use `MapCapabilities` to check for support at runtime. If advanced markers are not supported, define a fallback option such as using standard [markers](/maps/documentation/android-sdk/marker). For device requirements for the new map renderer, see [Supported\ndevices](/maps/documentation/android-sdk/renderer#supported-devices). \n\n### Kotlin\n\n\n```kotlin\nval capabilities: MapCapabilities = googleMap.getMapCapabilities()\nSystem.out.println(\"is advanced marker enabled?\" + capabilities.isAdvancedMarkersAvailable())\n```\n\n\u003cbr /\u003e\n\n### Java\n\n\n```java\nMapCapabilities capabilities = googleMap.getMapCapabilities();\nSystem.out.println(\"is advanced marker enabled?\" + capabilities.isAdvancedMarkersAvailable());\n```\n\n\u003cbr /\u003e\n\nNext steps\n----------\n\n[Create an advanced marker](/maps/documentation/android-sdk/advanced-markers/add-marker)"]]