All Projects → yldio → react-native-wearables

yldio / react-native-wearables

Licence: Apache-2.0 license
React Native common interface for iOS and Android wearables

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to react-native-wearables

flirt
Are you ready to FLIRT with your wearable data?
Stars: ✭ 41 (+105%)
Mutual labels:  wearables
WearLock
Using Android Watch to unlock Android phone via acoustic tokens.
Stars: ✭ 12 (-40%)
Mutual labels:  wearables
scotpho-profiles-tool
ScotPHO profiles tool code
Stars: ✭ 46 (+130%)
Mutual labels:  health-data
humanapi
The easiest way to integrate health data from anywhere - https://www.humanapi.co
Stars: ✭ 21 (+5%)
Mutual labels:  health-data
biomedical-blockchain
a map of all biomedical blockchain initiatives
Stars: ✭ 43 (+115%)
Mutual labels:  health-data
open-pryv.io
open source version of Pryv.io
Stars: ✭ 106 (+430%)
Mutual labels:  health-data
rHealthDataGov
R interface to the HealthData.gov Data API
Stars: ✭ 38 (+90%)
Mutual labels:  health-data
hms-health-demo-kotlin
HMS Health demo code provides demo programs for your reference or usage. Developers can access the Huawei Health Platform and obtain sports & health data by integrating HUAWEI Health.
Stars: ✭ 21 (+5%)
Mutual labels:  health-data
hms-health-demo-java
HMS Health demo code provides demo programs for your reference or usage. Developers can access the Huawei Health Platform and obtain sports & health data by integrating HUAWEI Health.
Stars: ✭ 37 (+85%)
Mutual labels:  health-data
bluenet
Bluenet is the in-house firmware on Crownstone hardware. Functions: switching, dimming, energy monitoring, presence detection, indoor localization, switchcraft.
Stars: ✭ 79 (+295%)
Mutual labels:  wearables
WearableIntelligenceSystem
Wearable computing software framework for intelligence augmentation research and applications. Easily build smart glasses apps, relying on built in voice command, speech recognition, computer vision, UI, sensors, smart phone connection, NLP, facial recognition, database, cloud connection, and more.
Stars: ✭ 16 (-20%)
Mutual labels:  wearables
Wristkey
A free and open-source offline authenticator app for Wear OS.
Stars: ✭ 65 (+225%)
Mutual labels:  wearables
GoFIT SDK Android
GoFIT SDK for Android — GOLiFE 手環 App 介接 SDK
Stars: ✭ 32 (+60%)
Mutual labels:  wearables

React Native Wearables

A React Native module with a common interface for interacting with wearables on iOS and Android.

Getting started

  • Browse to your react-native app. (see Demo for a ready made example)

  • Install react-native-wearables. npm install react-native-wearables

  • Install the peer dependencies. npm install rn-apple-healthkit react-native-google-fitness

  • Link the native modules. react-native link

  • Edit android/app/src/main/java/.../MainApplication.java. The line that looks like new GoogleFitPackage() should be changed to new GoogleFitPackage(BuildConfig.APPLICATION_ID). (this is a temporary fix to a known react-native limitation)

  • Add the following lines to ios//Info.plist – these are what iOS shows your users when requesting access to HealthKit data.

<key>NSHealthShareUsageDescription</key>
<string>Read and understand health data.</string>
<key>NSHealthUpdateUsageDescription</key>
<string>Share workout data with other apps.</string>
  • Enable HealthKit in your iOS app's Capabilities in Xcode.

Xcode Capabilities HealthKit

Demo app

Go to yldio/react-native-wearables-demo to check out a super simple demo app that runs on both iOS and Android.

Data

Data is a common interface to the health and fitness data system repositories on iOS and Android, respectively HealthKit and Google Fitness.

It lets you write code like this which works on both iOS and Android.

import { Data } from "react-native-wearables";

Data.authorize([Data.Types.heartRateBpm])
  .then(() =>
    Data.read(Data.Types.heartRateBpm, {
      startDate: new Date("2018-05-01"),
      endDate: new Date("2018-05-09")
    })
  )
  .then(samples => console.log(samples))
  .catch(error => console.error(error));

Motivation

This project builds on the great work of existing iOS- and Android-specific React Native modules to access wearables data on each platform. It abstracts the platform differences into a common interface that makes it easy to create great cross-platform experiences with wearables data.

API Documentation

Data.Types

An object of constants representing each of the data types supported by the module.

  • Data.Types.heartRateBpm, heart rate samples, unit is BPM (beats per minute)

Data.authorize(dataTypes)

Launches the OS-specific dialog to request permission from the user to read / write the data types requested.

Example
import { Data } from "react-native-wearables";

Data.authorize([Data.Types.heartRateBpm])
  .then(() => console.log("permission granted"))
  .catch(() => console.log("permission not granted"));
Arguments
  • dataTypes, an array of data types constants, found in Data.Types.
Returns

A promise which resolves when and if the user granted the requested permission to your app and rejects if the user cancelled or didn’t grant permission.

Data.read(dataType, options)

Retrieves data samples from HealthKit on iOS and Google Fitness on Android. Will fail if called before Data.authorize has been called with success.

Example
import { Data } from "react-native-wearables";

Data.read(Data.Types.heartRateBpm, {
  startDate: new Date("2018-05-01"),
  endDate: new Date("2018-05-09")
})
  .then(samples => console.log(samples))
  .catch(() => console.log("failed"));
Arguments
  • dataType, a data type, found in Data.Types
  • options, an object of options - startDate, a Date instance - endDate, a Date instance
Returns

An array of data points, where

  • value is a number
  • startDate is a Date ISO string
  • endDate is a Date ISO string
[
	{
		value: 80,
		startDate: "2018-06-06T13:59:47.375+0100",
		endDate: "2018-06-06T13:59:47.375+0100",
	},
	...
]
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].