0

I do have an android app which is adjusted to be released at huawei store. Here is the initialization snippet:

if (areGoogleServicesAvailable()) {
      // google map here
} else {
      MapsInitializer.initialize(this)
      val mapFragment =
                supportFragmentManager.findFragmentById(R.id.mapHuawei) as com.huawei.hms.maps.SupportMapFragment
      mapFragment.getMapAsync {
          mapHuawei = it

          mapHuawei.update()
      }
}

This code runs in onCreate method of an activity. Now, if I open the activity for the first time since app being started, the map isn't shown, getMapAsync isn't triggered at all and in logs I can observe:

2023-05-15 12:32:00.429 11025-11025 HmsMapKit_...ragment_13 some.app              E  MapsInitializer is not initialized.

But starting from second time I open the activity, everything works as expected, getMapAsync is triggered and works further. Any ideas?

nKognito
  • 6,297
  • 17
  • 77
  • 138

1 Answers1

0

Seems like moving MapsInitializer.initialize(this) to application.onCreate solves the issue

nKognito
  • 6,297
  • 17
  • 77
  • 138