HMS Core Map Service (Map Kit) provides developers with a set of SDKs for map development calls, helping global developers to realize personalized map presentation and interaction, easily and easily integrate map-related functions in applications, and improve user experience in an all-round way.
In our daily work, we will receive a lot of comments from developers about the problems encountered in integrating map services. Here we will share and summarize typical problems, hoping to provide reference for other developers who encounter similar problems.
1. After the integrated map service is applied, the map cannot be loaded (the grid map is displayed/only part of the map is displayed), how to solve the problem?
(1) Check whether the Map Kit switch is not turned on or the certificate fingerprint configuration is incorrect, please refer to the Codelab
(2) Please check whether the HMS version is 4.0.0 and above. When the SDK version is 6.X, the version of HMS core (apk) needs to be upgraded to 6.X
(3) Whether the App ID in the project is consistent with that on AppGallery Connect.
(4) The fingerprint SHA256 is not configured. The signature certificate fingerprint needs to be generated locally, and then configured in AppGallery Connect.
(5) If the AppGallery Connect configuration file of the application is not configured, copy the "agconnect-services.json" file to the application-level root directory.
(6) Configure the signature in android. Copy the signature file generated by generating the signature certificate to the "app" directory of the project, and configure the signature in the "build.gradle" file.
2. How can I get my real-time location through the map service?
(1) My location() can be enabled to add markers
hMap.setMyLocationEnabled(true);
hMap.getUiSettings().setMyLocationButtonEnabled(true);
Refer to the documentation for specific usage details
(2) getPosition() gets the current position of the marker ()
Refer to the documentation for specific usage details
3. After the map is loaded, controls such as watermark, compass, my location, and zoom buttons are not displayed, only the map is displayed. what is the reason?
(1) Check the setting of the zOrderOnTop property. zOrderOnTop(true): Indicates that the map is displayed at the top level and will cover other controls. zOrderOnTop(false): Indicates that the map is not displayed at the top level, and other controls can be displayed normally.
(2) Set properties such as zoom zoomControlsEnabled, compass compassEnabled, my location setMyLocationEnabled to true.
For details, please refer to the website description
4. After integrating the map service, why does my location function not work?
(1) Please check whether the android.permission.ACCESS_FINE_LOCATION and android.permission.ACCESS_COARSE_LOCATION permissions are enabled. (Including dynamic permission application, whether the location switch is turned on)
(2) Check whether the following two switches are turned on:
//启用位置图层
map.setMyLocationEnabled(true);
//启用我的位置按钮
map.getUiSettings().setMyLocationButtonEnabled(true);
5. After integrating the map service, when 2000 markers are added, will the application freeze?
When clearing the Marker when calling map.clear(), if there is another operation of adding the Marker, it will cause re-aggregation, which is inefficient;
When calling map.clear(), add a line of code map.setMarkersClustering(false) to prevent re-aggregation during the clearing process.
Learn more details>>
Visit the official website of Huawei Developer Alliance
Get development guidance documents
Huawei Mobile Services Open Source Warehouse Address: GitHub , Gitee
Follow us to know the latest technical information of HMS Core for the first time~
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。