2

I have both GMS and HMS in one android project. GMS version works, but HMS dont call the onMapReady callback. This is the code:


    private var mMap: HuaweiMap? = null
    private var mapFragment: SupportMapFragment? = null

 private fun setMapFragment() {
        mapFragment = supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment?
        mapFragment!!.getMapAsync(this)
        mapFragment!!.view!!.isClickable = false
    }

    override fun onMapReady(huaweiMap: HuaweiMap) {
        mMap = huaweiMap
        loadMap()
    }

I thought GMS and HMS was implemented the same way, but i guess i am wrong. Does HMS need more permissions than GMS or something to make it work??

Meyben
  • 451
  • 3
  • 15

2 Answers2

1

This problem is a known bug and it will be rectified on November 9, 2020.

Currently, workarounds can be used:

  1. Change SupportMapFragement to MapView.
  2. Roll back the SDK version.
zhangxaochen
  • 32,744
  • 15
  • 77
  • 108
0

Make sure you implemented OnMapReadyCallback also you need to pass Bundle in onCreate map methode before calling mapFragment!!.getMapAsync(this) :

 val mapViewBundle: Bundle? = null
 mapFragment!!.onCreate(mapViewBundle)
 mapFragment!!.getMapAsync(this)
Ahmed Nezhi
  • 190
  • 2
  • 12