Hi,
I’ve got a mapView set up in a Fragment and i don’t get onMapReadyCallback even tho the map is visible. I tried using a mapFragment and i get the same behaviour.
<androidx.fragment.app.FragmentContainerView
android:id="@+id/mapFragment"
android:name=“com.tomtom.online.sdk.map.MapFragment”
tomtom:mapStyleSource=“STYLE_MERGER”
android:layout_width=“match_parent”
android:layout_height=“200dp”
android:layout_marginBottom=“16dp”
android:layout_marginTop=“20dp”
android:layout_marginStart=“20dp”
android:layout_marginEnd=“20dp”
android:background="#A3A1A1"
app:layout_constraintTop_toBottomOf="@id/infotitle"
app:layout_constraintBottom_toTopOf="@+id/divider1"
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintStart_toStartOf=“parent”
tomtom:mapsApiKey=“api key”/>
FragmentManager fm = getChildFragmentManager();
mapFragment = (MapFragment) fm.findFragmentById(R.id.mapFragment);
if (mapFragment != null){
fm.beginTransaction().replace(R.id.mapView, mapFragment).commitNow();
mapFragment.getAsyncMap(tomtomMap → );
}
/// Map View
<com.tomtom.online.sdk.map.MapView
android:id="@+id/mapView"
android:layout_width=“match_parent”
android:layout_height=“200dp”
android:layout_marginBottom=“16dp”
android:layout_marginTop=“20dp”
android:layout_marginStart=“20dp”
android:layout_marginEnd=“20dp”
android:background="#A3A1A1"
app:layout_constraintTop_toBottomOf="@id/infotitle"
app:layout_constraintBottom_toTopOf="@+id/divider1"
app:layout_constraintEnd_toEndOf=“parent”
app:layout_constraintStart_toStartOf=“parent”
tomtom:mapsApiKey=“api key”/>
MapView mapView = new MapView(requireContext).findViewbyId(R.id.mapView);
mapView.addOnMapReadyCallback…