This page explains best practices for interacting with the GoogleMap
object in
your app.
Implement GoogleMap
features on the same maps instance
Maps APIs are also available as part of Navigation SDK, which you can use to build map specific (non-navigation) experiences. If your app includes both a non-navigation map experience and a navigation experience, we recommend using the Maps and Navigation API on the same map instance.
Use getMapAsync
to obtain the GoogleMap
instance
You can obtain a GoogleMap
object using either
SupportNavigationFragment#getMapAsync
or NavigationView#getMapAsync
. We
recommend this method over holding onto the GoogleMap
instance that might
become stale once the NavigationView
underneath is recreated.
Also be sure to clean up the GoogleMap
retrieved from this method after it is
no longer needed. For more information, see Instance cleanup best
practices.