Implementing Location Kit in HarmonyOs Wearables

Shiddalingeshwar M S
Huawei Developers
Published in
2 min readJan 28, 2022

Introduction

In this article, we will learn about Huawei Location Kit integration in HarmonyOs wearables, Huawei Location kit provides capabilities for you to quickly obtain the precise user device location, and helps you to build global positioning capabilities and expansion of your global business.

Supported devices

  • Android
  • HarmonyOs
  • iOS
  • Rest API

Supported Countries/Regions

For details, please refer to Supported Countries/Regions.

Development Overview

You need to install DevEcho Studio IDE and I assume that you have prior knowledge about the Harmony OS and java.

Hardware Requirements

  • A computer (desktop or laptop) running Windows 10.
  • A HarmonyOs phone (with the USB cable), which is used for debugging.

Software Requirements

  • Java JDK installation package.
  • DevEcho Studio installed.

Steps:

Step 1: Create a HarmonyOs Application.

Choose your desired template
Add App name and project type, package name and SDK version and supporting device type.

Step 1: Create a project in AppGallery.

Step 2: Configure App in AppGallery

Step 3: Follow the SDK integration steps

Let’s start coding

Result

Sample application output for fetching location of the device

Tips and Tricks

  • Add required dependencies without fail.
  • Add required images in resources > base > media.
  • Add custom strings in resources > base > element > string.json.
  • Define supporting devices in config.json file.
  • Do not log the sensitive data.
  • Enable required service in AppGallery Connect.
  • Use respective Log methods to print logs.

Conclusion

In this article, we have learnt, How to access the device location in HarmonyOs wearable device using Huawei Location Kit. Sample application shows how to implement Location kit in HarmonyOs Wearables device. Hope this articles helps you to understand and integration of kit, you can use this feature in your HarmonyOs application to get the user precise location of the device.

Thank you so much for reading this article and I hope this article helps you to understand Huawei Location Kit in HarmonyOS. Please provide your comments in the comment section and like.

References

Location Kit

Checkout in forum

--

--