Maps API는 Navigation SDK의 일부로도 제공되며, 이를 사용하여 지도 관련 (탐색이 아닌) 환경을 빌드할 수 있습니다. 앱에 내비게이션이 아닌 지도 환경과 내비게이션 환경이 모두 포함된 경우 동일한 지도 인스턴스에서 지도 및 내비게이션 API를 사용하는 것이 좋습니다.
getMapAsync를 사용하여 GoogleMap 인스턴스 가져오기
SupportNavigationFragment#getMapAsync 또는 NavigationView#getMapAsync를 사용하여 GoogleMap 객체를 가져올 수 있습니다. NavigationView이 다시 생성되면 오래될 수 있는 GoogleMap 인스턴스를 유지하는 것보다 이 방법을 사용하는 것이 좋습니다.
또한 이 메서드에서 가져온 GoogleMap는 더 이상 필요하지 않은 경우 정리해야 합니다. 자세한 내용은 인스턴스 정리 권장사항을 참고하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(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)."]]