Nearest Hospitals / Pharmacies with HMS Map Kit& Location Kit& Site Kit

Kübra Kızılca
Huawei Developers
Published in
3 min readMay 21, 2021

Hi everyone,

In this article, I will show you how we can develop the application that shows the nearest hospitals / pharmacies with Site&Map&Location Kit.

Location Kit combines the Global Navigation Satellite System (GNSS), Wi-Fi, and base station location functionalities into your app to build up global positioning capabilities, allowing you to provide flexible location-based services for global users. We will use Fused Location Service.

Site Kit provides place search services including keyword search, nearby place search, place detail search, and place search suggestion, helping your app provide convenient place-related services to attract more users and improve user loyalty. We will use this service for find nearest hospitals / pharmacies according to location information.

Map Kit is an SDK for map development. It covers map data of more than 200 countries and regions, and supports over one hundred of languages. With this SDK, you can easily integrate map-based functions into your apps. We will use to show hospitals / pharmacies.

Implementation

First of all, please follow these steps to create an app on App Gallery.

Add neccesary dependency :

Now, add permissions to the AndroidManifest.xml file.

We will create layout file. SupportMapFragment and MapView are commonly used map containers. I will use MapView.

Now we will get location data with Location Kit. We will use Fused Location Service.

If the location service returns a successful result, we will define lattitude and longtitude variables and call search() method. Search method will return sites.We need to set our api key here.And then we will call nearbySearch api.

If the search service returns a successful result, we will add marker to sites on map.

Conclusion

In this article, we have learnt how to integrate Map & Site & Location Kit. Have a good reading :)

Reference

--

--