TomTomMap is not displaying map (Blank)

57 Views Asked by At

With reference to the TomTom Map Official Documentation

Build Gradle:

implementation 'com.tomtom.sdk.maps:map-display:0.33.1'

Main Activity Looks like as follows:

private lateinit var tomTomMap: TomTomMap

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        val mapOptions = MapOptions(mapKey = BuildConfig.TOMTOM_API_KEY)
        val mapFragment = MapFragment.newInstance(mapOptions)

        supportFragmentManager.beginTransaction().replace(R.id.map_fragment, mapFragment).commit()
        mapFragment.getMapAsync(this@MainActivity)
    }

    override fun onMapReady(map: TomTomMap) {
        tomTomMap = map
        Log.w(
            "TAG",
            "onMapReady: " +
                    "Latitude: ${tomTomMap.currentLocation?.position?.latitude} " +
                    "Longitude: ${tomTomMap.currentLocation?.position?.longitude}"
        )
    }

XML Looks like:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical">

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="@string/map_view"
        android:textSize="24sp"
        android:layout_weight="0.1"
        android:textAlignment="center"/>
    <androidx.fragment.app.FragmentContainerView
        android:layout_weight="0.9"
        android:id="@+id/map_fragment"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</LinearLayout>

But Output is blank as mentioned below

TomTomMap

Please help me to resolve this

0

There are 0 best solutions below