Google 지도 상호작용 권장사항
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
이 페이지에서는 앱에서 GoogleMap
객체와 상호작용하기 위한 권장사항을 설명합니다.
동일한 지도 인스턴스에 GoogleMap
기능 구현
Maps API는 Navigation SDK의 일부로도 제공되며, 이를 사용하여 지도 관련 (탐색이 아닌) 환경을 빌드할 수 있습니다. 앱에 내비게이션이 아닌 지도 환경과 내비게이션 환경이 모두 포함된 경우 동일한 지도 인스턴스에서 지도 및 내비게이션 API를 사용하는 것이 좋습니다.
getMapAsync
를 사용하여 GoogleMap
인스턴스 가져오기
SupportNavigationFragment#getMapAsync
또는 NavigationView#getMapAsync
를 사용하여 GoogleMap
객체를 가져올 수 있습니다. NavigationView
이 다시 생성되면 오래될 수 있는 GoogleMap
인스턴스를 유지하는 것보다 이 방법을 사용하는 것이 좋습니다.
또한 이 메서드에서 가져온 GoogleMap
는 더 이상 필요하지 않은 경우 정리해야 합니다. 자세한 내용은 인스턴스 정리 권장사항을 참고하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eImplement \u003ccode\u003eGoogleMap\u003c/code\u003e features on a separate map instance from navigation experiences to avoid conflicts and optimize performance.\u003c/p\u003e\n"],["\u003cp\u003eUse \u003ccode\u003egetMapAsync\u003c/code\u003e to retrieve the \u003ccode\u003eGoogleMap\u003c/code\u003e object instead of holding onto an instance, ensuring you have the most up-to-date map object and preventing stale data.\u003c/p\u003e\n"],["\u003cp\u003eRemember to clean up the \u003ccode\u003eGoogleMap\u003c/code\u003e object after use to prevent memory leaks and maintain optimal app performance, referring to the Instance cleanup best practices for detailed guidance.\u003c/p\u003e\n"]]],[],null,["# GoogleMap interaction best practices\n\nThis page explains best practices for interacting with the `GoogleMap` object in\nyour app.\n\nImplement `GoogleMap` features on the same maps instance\n--------------------------------------------------------\n\nMaps APIs are also available as part of Navigation SDK, which you can use to\nbuild map specific (non-navigation) experiences. If your app includes both a\nnon-navigation map experience and a navigation experience, we recommend using\nthe Maps and Navigation API on the same map instance.\n\nUse `getMapAsync` to obtain the `GoogleMap` instance\n----------------------------------------------------\n\nYou can obtain a `GoogleMap` object using either\n`SupportNavigationFragment#getMapAsync` or `NavigationView#getMapAsync`. We\nrecommend this method over holding onto the `GoogleMap` instance that might\nbecome stale once the `NavigationView` underneath is recreated.\n\nAlso be sure to clean up the `GoogleMap` retrieved from this method after it is\nno longer needed. For more information, see [Instance cleanup best\npractices](/maps/documentation/navigation/android-sdk/instance-cleanup-best-practices)."]]