hi_health 0.1.3 hi_health: ^0.1.3 copied to clipboard
Flutter plugin for Huawei HiHealth integration. For fetching steps, distance and dates.
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 #
- Register yourself or your company at https://developer.huawei.com/.
- Register your app at Console > Smart Living > HiHealth Kit
- You may need to tweak gradle depends if you are using your own keystore. Keystore is ignored.
Getting Started #
Running example
- Create a copy of
example.properties
from example.properties.bak - Replace your data in example.properties
- Run the project.
Using in your own project
- Add this into your
AndroidManifest.xml
<meta-data
android:name="com.huawei.hms.client.appid"
android:value="${huaweiID}"/>
- Add to
pubspec.yaml
huawei_health:
git:
url: git://github.com/zaralockheart/huawei_health
- 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);
}