This Map Kit sample encapsulates APIs of the HUAWEI Map Kit. It provides many demos for your reference or usage.
- Register as a developer. Register a HUAWEI account.
- Create an app. Create an app and enable APIs.
- Build the demo. To build this demo, please first import the demo to Android Studio (3.X or later). Then download the agconnect-services.json file of the app from AppGallery Connect, and add the file to the app directory (\app) of the demo. What's more, a signing certificate is needed. For details, please refer to Preparations for Integrating HUAWEI HMS Core.
- The API key is required for initializing the map. In the MainActivity, please replace "Your API key" with api_key field value in agconnect-services.json if the field is null.
Before using this sample code, check whether the android environment and Java environment have been installed.
Use Android Studio to open the CodeLab_Mapkit_Demo folder, synchronize it, and compile it after successful synchronization. Then connect a mobile phone running the Android operating system to your PC and click the run icon (green arrow). The APK is successfully installed on the mobile phone.
Android SDK 27 or a later version is recommended. Android Build Tools
To use functions provided by packages in examples, you can to use the agconnect-services.json in the app package. If you want to create your demo, you need to change the agconnect-services.json file.
Map Kit Java sample is licensed under the Apache License, version 2.0.