# OnMapReadyCallback

public interface **OnMapReadyCallback** Callback interface for when the map is ready to be used.

Once an instance of this interface is set on a `https://developers.google.com/android/reference/com/google/android/gms/maps/MapFragment` or
`https://developers.google.com/android/reference/com/google/android/gms/maps/MapView` object, the
`https://developers.google.com/android/reference/com/google/android/gms/maps/OnMapReadyCallback#onMapReady(com.google.android.gms.maps.GoogleMap)` method is triggered when the map is ready to be used and
provides a non-null instance of `https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap`.

If Google Play services is not installed on the device, the user will be prompted to
install it, and the `https://developers.google.com/android/reference/com/google/android/gms/maps/OnMapReadyCallback#onMapReady(com.google.android.gms.maps.GoogleMap)` method will only be triggered when the user has installed it
and returned to the app.

### Public Method Summary

|---|---|
| abstract void | [onMapReady](https://developers.google.com/android/reference/com/google/android/gms/maps/OnMapReadyCallback#onMapReady(com.google.android.gms.maps.GoogleMap))([GoogleMap](https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap) googleMap) Called when the map is ready to be used. |

## Public Methods

#### public abstract void **onMapReady** ([GoogleMap](https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap) googleMap)

Called when the map is ready to be used.

Note that this does not guarantee that the map has undergone layout. Therefore, the
map's size may not have been determined by the time the callback method is called. If
you need to know the dimensions or call a method in the API that needs to know the
dimensions, get the map's `https://developer.android.com/reference/android/view/View.html` and register
an `https://developer.android.com/reference/android/view/ViewTreeObserver.OnGlobalLayoutListener.html` as well.

Do not chain the `OnMapReadyCallback` and
`OnGlobalLayoutListener` listeners, but instead register and wait for both
callbacks independently, since the callbacks can be fired in any order.

As an example, if you want to update the map's camera using a `https://developers.google.com/android/reference/com/google/android/gms/maps/model/LatLngBounds`
without dimensions, you should wait until both `OnMapReadyCallback` and
`OnGlobalLayoutListener` have completed. Otherwise there is a race condition
that could trigger an `https://developer.android.com/reference/java/lang/IllegalStateException.html`.

##### Parameters

| googleMap | A non-null instance of a GoogleMap associated with the `https://developers.google.com/android/reference/com/google/android/gms/maps/MapFragment` or `https://developers.google.com/android/reference/com/google/android/gms/maps/MapView` that defines the callback. |
|---|---|