Skip to content

Oliver404/HMS-Android-Example-MapKit

Repository files navigation

HMS Map Kit Example

👾 Get in touch

Instagram Instagram HackerRank

Table of Contents

  1. Prerequisites
  2. Configuring AppGallery Connect
    1. Turn on the Maps API
    2. Create Key for Static Map
    3. Download configuration json file
  3. Configuring Android Project
    1. Configuring Signature and Package name
    2. Set up AppGallery connection
    3. Configure API KEY
  4. Run the Application

Prerequisites

I) Create a AppGallery project - Guide

II) Create an application in the project and save the packagename - Guide

Configuring AppGallery Connect

Turn on the Maps API

I) Inside the Project settings option enter to Manage APIs section

II) Type Map in the search bar to filter the available APIs

III) Verify that the 'Map Kit' switch is on (blue color), if it is off (gray color) it will be necessary to turn it on (clicking it)

Turn on Map Kit API

Create Key for Static Map

I) Search in the side menu (left side) for the Build section

II) In this one you will find the option of Map Kit

II) Clicking on this will show a sale similar to the one shown at the bottom

Map Kit Module

IV) Must click on the "Enable" button

V) The interface will change a bit and a key will have been generated for our static map (as shown in the image below)

Key for Static Map

Download configuration json file

I) Before downloading the JSON it is recommended to have added the SHA -256 fingerprint, the following guide shows how to get and add it to our project

II) Download the file agconnect-services.json

Download agconnect-services.json

Configuring Android Project

Configuring Signature and Package name

I) In the app folder you will find the file build.gradle

II) Opening it should locate the signingConfigs section, as shown in the image below

III) In this section you will have to replace the values of keyAlias, keyPassword, storeFile and storePassword

IV) The image, enclosed in a yellow box, shows the key used for the original project, as an example, the storeFile field should be as follows:

V) Now locate the defaultConfig section, it is above signingConfigs

VI) Replace the value of applicationId for your packagename with which the app is registered to AppGallery

Configuring Signature

Set up AppGallery connection

I) The file agconnect-services.json that was downloaded in previous sections, should be pasted into the folder app, as shown in the image below.

Paste agconnect-services.json

Configure API KEY

I) The KEY API can be obtained from the Project Information section in Project Settings of AppGallery Connect (example in the following image)

Copy API KEY

II) Once the API KEY has been copied, the value of api_key must be replaced in the file strings.xml that is located in the values folder of the Android project. Reference in the following image:

Change resource API KEY

Run the Application

I) Once all the configuration is done, you can execute the project, obtaining something similar to the following image:

Result

About

Example Android HMS Map Kit

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages