Git Product home page Git Product logo

huawei_health's Introduction

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 *;
}

huawei_health's People

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.