npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

com.wefitter.plugins.healthkit

v0.2.5

Published

Interact with the iOS HealthKit SDK and connects to the Wefitter server

Downloads

20

Readme

WeFitter HealthKit Cordova Plugin

1. Installation

You should install the cordova plugin on your cordova project to use the plugin:

cordova plugin add com.wefitter.plugins.healthkit --variable HEALTH_READ_PERMISSION='App needs read access' --variable HEALTH_WRITE_PERMISSION='App needs write access'

The plugin will be saved on window.plugins.wefitterhealthkit variable (on a device environment, not browser!).

2. Usage of WeFitter Plugin

2.1. Be sure plugin are enabled

Before the library run() execution, you should be sure that the plugin are available. Usage:

window.plugins.wefitterhealthkit.available(function(yes) {
  var libraryWorking = true;
  console.log("window.plugins.wefitterhealthkit available");
  window.plugins.wefitterhealthkit.setAPIToken('test');
  window.plugins.wefitterhealthkit.setAuthToken('wf5b87108d2d7ac91789342818629500');
}, function(no) {
  console.log("window.plugins.wefitterhealthkit not available");
});

Remember that depending of the platform, maybe you should use document.addEventListener("deviceready", function () {[...]}); before try to access to the cordova plugin.

2.2. Configure Auth

Before run(), you will need to configure auth with setAPIToken and setAuthToken, for example:

window.plugins.wefitterhealthkit.setAPIToken('test');
window.plugins.wefitterhealthkit.setAuthToken('wf5b87108d2d7ac91789342818629500');

You can change it dinamically.

2.3. Run and send healthkit data to WeFitter

If the available() function result are true, you can go and run without problem run() to retrieve and send the healthkit data to WeFitter API. It will send the data only one time, on background and async.

Example of usage:

window.plugins.wefitterhealthkit.run({}, function(yes) {
  console.log("healthkit run() working");
}, function(no) {
  console.log("healthkit run() not working:");
  console.log(no);
});
Success messages
  • "data sent correctly": Plugin worked perfectly
Error messages
  • "healthkit permissions error": The user doesn't accept the healthkit permissions
  • "data send failed": Server connection error
  • "auth variables are undefined": you don't used the auth functions to set the auth variables
Option: backendConfig

If you use backendConfig: true the plugin will retrieve before the communication with healthkit the healthkit config to send customized data to the server.

Example:

window.plugins.wefitterhealthkit.run({backendConfig: true}, function(yes) {
  console.log("sent data correctly");
}, function(no) {
  console.log("send data failed");
  console.log(no);
});