Java – Huawei Map Kit Activity opens slowly

Huawei Map Kit Activity opens slowly… here is a solution to the problem.

Huawei Map Kit Activity opens slowly

When I change my activity to another one with a Huawei map, it opens very slowly.

huawei version is MED-LX9N

Android version is 10

Ram : 3.0 GB

and free space is 52 / 64 GB

When I hit the Change Activity button, it first waits 3-5 seconds.

Then I go back to the page and

go back to the map page again, and it only waits 1 second.

My code:

  com.huawei.hms.maps.SupportMapFragment supportMapFragment = new com.huawei.hms.maps.SupportMapFragment();
            context.getSupportFragmentManager().beginTransaction().replace(fragmentId, supportMapFragment).commit();

map asynchronous:

com.huawei.hms.location.FusedLocationProviderClient fusedLocationProviderClient = com.huawei.hms.location.LocationServices.getFusedLocationProviderClient( activity);

fusedLocationProviderClient.getLastLocation().addOnSuccessListener(activity, location -> {

if (location != null) {

double currentLat = location.getLatitude();
                        double currentLong = location.getLongitude();

com.huawei.hms.maps.model.LatLng latLng = new com.huawei.hms.maps.model.LatLng(currentLat, currentLong);

com.huawei.hms.maps.CameraUpdate cameraUpdate = com.huawei.hms.maps.CameraUpdateFactory.newLatLngZoom(latLng, zoom);





                    android:layout_height="350dp" />

It works but slowly, how do I fix this? Is it normal?


I use the Mapbox map activity in my application. This is also slow to open in Huawei devices. So I set the initial zoom level for map loading to 14.0 to speed up loading. It’s ok now.

Related Problems and Solutions