Menu

 

Cordova

Cordova plugin for integrating WeFitter and HealthKit into your app

Installation

cordova plugin add https://github.com/wefitter/cordova-plugin-wefitter-ios.git#v1.2.0

 

Usage

Add the following code inside onDeviceReady in www/js/index.js:

See wefitterhealthkit.js for all available functions.

Show code example
Hide code example

var configureSuccess = function (message) {
  console.log(message);
  // Connect can be called after configure has succeeded
  wefitterhealthkit.connect(success, failure);
};

var success = function (message) {
  console.log(message);
  alert(message);
};

var failure = function (message) {
  console.log(message);
  alert(message);
};

var config = {
  token: "YOUR_TOKEN", // required, WeFitter API profile bearer token
  url: "CUSTOM_URL", // optional, the url should be base without `v1.3/ingest/` as the library will append this. Default: `https://api.wefitter.com/api/`
  startDate: "CUSTOM_START_DATE", // optional with format `yyyy-MM-dd`, by default data of the past 7 days will be uploaded
};

// Configure should be called every time your app starts when HealthKit is supported
wefitterhealthkit.canConnectToHealthData((supported) => {
  if (supported) {
    wefitterhealthkit.configure(config, configureSuccess, failure);
  }
});

You are subscribed!

You will soon receive our newsletter!
WeFitter team.
footer_bg