I want to show a map of type HuaweiMap on a Huawei device. I have the following code where SupportMapFragment is from com.huawei.hms.maps, but when I debug it getMapAsync it doesn't get called. I have the same method for GoogleMap and it works fine. Does anyone knows why that might happen?
val mapFragment = childFragmentManager.findFragmentById(R.id.map) as? SupportMapFragment
private fun displayMap(mapFragment: SupportMapFragment?, context: Context) {
mapFragment?.getMapAsync {
map = it //this part is never reached
refreshMap?.visibility = View.GONE
it.clear()
locationDrawUtil = LocationDrawUtil(it)
locationDrawUtil!!.clear()
it.mapType = HuaweiMap.MAP_TYPE_NORMAL
it.uiSettings.isMapToolbarEnabled = true
centerMapOnMyLocation(context)
locationDrawUtil!!.showMapLayers(context, it)
onMapReady()
}
}
Libraries that I use:
huaweiImplementation 'com.huawei.hms:location:6.7.0.300'
huaweiImplementation 'com.huawei.hms:maps:6.6.1.301'