HMS Location Kit in Flutter

Nithin KC
2 min readAug 10, 2022

Today’s article I am going to discuss about HMS Location Kit integration in Flutter.

Let’s know about HMS Location Kit.

Location Kit combines the Global Navigation Satellite System (GNSS), Wi-Fi, and base station location functionalities into the application to provide flexible location-based services for global users.

Location Kit provides three main capabilities:

Ø Fused location

Ø Activity identification

Ø Geofence

To integrate HMS Location Kit in Flutter we need Location Kit Flutter Plugin. The plugin provides code for adapting HUAWEI Location Kit to the Flutter platform.

Integration process

Let’s discuss integration steps here.

  1. Create project in App Gallery Connect and provide relevant information such as app name, Data Storage, SHA 256 Key, package name etc. Enable Location Kit in Manage API Section. Download agconnect-services.json file.
  2. Add “agconnect-services.json” file under “app” directory.
  3. Open project level “build.gradle” file.

Add the maven repositories under “buildscript” and “allprojects” section. Add the classpath in dependency section.

4. Open the build.gradle file in the android/app directory of your Flutter project.

Add the AppGallery Connect plugin configuration.

5. Download the Location Kit Flutter Plugin and decompress it.

Add downloaded file into parent directory of the project.

6. Open the pubspec.yaml.

Declare plugin path in pubspec.yaml file under dependencies.

Click pub get to pull the dependency.

7. Open the dart file under lib folder.

Let’s start the coding

That’s it.

Result

Conclusion

HMS Location Kit can be used in different service scenarios such as -

Navigation : Provides accurate location information for users.

Food and drink : Presents a large amount of information about food and drink and restaurants, as well as accurately locating users and delivery personnel.

Travel and accommodation : Provides the geographical locations and information for tourist attractions and accommodations.

Convenient living: Provides local information relating to weather and other utility apps.

Reference

Location Kit

Thank You.

--

--