Skip to content

Commit

Permalink
Merge pull request #4 from danielgek/updates-android
Browse files Browse the repository at this point in the history
fix: uniform data
  • Loading branch information
EddyVerbruggen committed Mar 5, 2018
2 parents 1d11220 + 408bf45 commit fb31a09
Show file tree
Hide file tree
Showing 8 changed files with 471 additions and 521 deletions.
37 changes: 20 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@
## A cross platform (iOS & Android) plugin

### Description
This is a NativeScript plugin that abstracts Apple HealthKit and Google Fit repositories to collect some health data from user's smartphone. Unfortunately, I am a starter in NativeScript's plugins development so, because of that, not every data type is available right now.
This is a NativeScript plugin that abstracts Apple HealthKit and Google Fit repositories to collect health data from user's smartphone. Unfortunately, I am a starter in NativeScript's plugins development so, because of that, not every data type is available right now.

This work is based on [Cordova Health Plugin](https://github.com/dariosalvi78/cordova-plugin-health) (the propose, not the code). If you are experiencing some kind of issue, feel free to contact me or open a repository issue.

## Prerequisites
iOS - Cocoapods is [installed](https://guides.cocoapods.org/using/getting-started.html#getting-started)

Android - Latest Google Play services SDK [installed](https://developer.android.com/studio/intro/update.html)

Google Fit API Key - Go to the [Google Developers Console](https://console.developers.google.com/), create a project, and enable the ```Google Fitness API```. Then under credentials, create an OAuth for an Android App. If you are using Linux/OSX, generate your SHA1-key with the code below. Then, make sure you download the result OAuth client key, rename it to ```client_id.json``` and place it in project root directory.

Expand Down Expand Up @@ -60,7 +57,7 @@ healthData.getCommonData(configData)
Like you can see, the ```getCommonData(configObj)``` method receives a configuration object, something like this one above.

```typescript
interface IConfigurationData {
interface ConfigurationData {
gfStartTimeInMillis: number,
gfEndTimeInMillis: number,
gfBucketUnit: string,
Expand All @@ -74,23 +71,29 @@ interface IConfigurationData {
From any API endpoint, you will receive one of these 2 objects. In success case, you will receive this:

```typescript
interface IResultResponse {
status: {
action: string,
message: string
}, data: {
type: string,
response: string
}
interface ResultResponse {
status: {
action: string;
message: string;
};
data: {
type: string;
response: Array<ResponseItem>;
};
}

interface ResponseItem {
start: Date;
end: Date;
value: string;
}
```
In error case, you will receive this one:

```typescript
interface IErrorResponse {
action: string,
code: string,
description: string
interface ErrorResponse {
action: string;
description: string;
}
```

Expand Down
Loading

0 comments on commit fb31a09

Please sign in to comment.