How to integrate Huawei Health Kit in Flutter

Shiddalingeshwar M S
4 min readOct 1, 2021

In this article, we will be integrating Huawei Health kit. Huawei provides quickly implementation of Health kit in order to get the health data of the user in your application. It provides core capabilities to developer to quickly build apps with fitness and health data storage and sharing based on flexible authorization.

Introduction

In this article, we will be integrating Huawei Health kit. Huawei provides quickly implementation of Health kit in order to get the health data of the user in your application. It provides core capabilities to developer to quickly build apps with fitness and health data storage and sharing based on flexible authorization.

Health Kit is open to enterprise developers and individual developers.

Restrictions

Supported locations. For details, please refer to Supported Countries/Regions.

Development Overview

You need to install Flutter and Dart plugin in IDE and I assume that you have prior knowledge about the Flutter and Dart.

Hardware Requirements

· A computer (desktop or laptop) running Windows 10.

· A Huawei phone (with the USB cable), which is used for debugging.

Software Requirements

· Java JDK 1.8 or later.

· Android studio software or Visual Studio or Code installed.

· HMS Core (APK) 5.0.3.300 or later.

Integration process

Step 1. Create flutter project.

Step 2. Add the App level gradle dependencies.

Choose inside project Android > app > build.gradle

Add root level gradle dependencies

Step 3: Add the below permissions in Android Manifest file

Metadata information in application tag

Step 4: Add Huawei Health Kit Plugin path in pubspec.yaml file under dependencies

Step 5: Create a project in AppGallery Connect

Preparing Development Environment

Configuring App in AppGallery Connect

Applying for Huawei Health kit

How do I login with AuthHuaweiId?

How do I insert sample data?

How do I query health data?

How do I query health data?

How do I start autoRecorder?

How do I stop autoRecorder?

How do I clear health data?

How do I get daily summery?

How do I revoke permissions given?

Result

Tricks and Tips

· Make sure you have downloaded latest plugin.

· Make sure that updated plugin path in yaml.

· Make sure that plugin unzipped in parent directory of project.

· Makes sure that agconnect-services.json file added.

· Make sure dependencies are added build file.

· Make sure Health kit service enabled in AppGallery.

· Run flutter pug get after adding dependencies.

· Generating SHA-256 certificate fingerprint in android studio and configure in Ag-connect.

Conclusion

In this article, we have learnt how to integrate Huawei Health kit, it provides core capabilities to developer to quickly build apps with fitness and health data like steps count, daily summery, activity capture, storage and sharing based on flexible authorization.

I hope this article helps you to understand the Huawei Health kit in flutter.

Reference

Huawei Health Kit Service

Flutter Plugin

Checkout in forum

--

--