Skip to content

yuzurihaaa/huawei_health

Repository files navigation

HiHealth

[Disclaimer] This is not an official huawei hihealth plugins.

  • You must head to https://developer.huawei.com/consumer/en/ and create your account and app account.
  • This plugin is a wrapper for their .jar and android implementation.
  • Head to this link if you prefer to implement it yourself.
  • HiHealth is only available on Android. For iOS, use Apple Health.

Prerequisite

  1. Register yourself or your company at https://developer.huawei.com/.
  2. Register your app at Console > Smart Living > HiHealth Kit
  3. You may need to tweak gradle depends if you are using your own keystore. Keystore is ignored.

Getting Started

Running example

  1. Create a copy of example.properties from example.properties.bak
  2. Replace your data in example.properties
  3. Run the project.

Using in your own project

  1. Add this into your AndroidManifest.xml
<meta-data
            android:name="com.huawei.hms.client.appid"
            android:value="${huaweiID}"/>
  1. Add to pubspec.yaml
huawei_health: any 
  1. Import
import 'package:hi_health/hi_health.dart';

Usage.

To get the Steps data:

Future getSteps() async {
    final start = DateTime.now().subtract(Duration(days: 5));
    final end = DateTime.now();
    final steps = await HiHealth.getSteps(start, end);
}

To get the distance data:

Future getDistances() async {
    final start = DateTime.now().subtract(Duration(days: 5));
    final end = DateTime.now();
    final distances = await HiHealth.getDistance(start, end);
}

Release

If you enable minify, add this line into your proguard rules. This will avoid exception when unmarshalling class.

-keep class com.huawei.hihealth.* {
   public *;
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published