HealthKit
HealthKit copied to clipboard
window.plugins.healthkit undefined
This is my setup:
$ cordova -v 7.1.0 Macbook El Captain 10.11.6 Phonegap 0.4.5
My workflow is to use phonegap to serve the Cordova project on a server, and I test it out on my iPhone using the Phonegap application by pointing to the server IP address on the localnetwork. I have tested several other plugins and most of them works like Camera, ..etc.
I installed the plugin but unable to find it in the namespace, window.plugins.healthkit is undefined. This is part of my index.js out of a vanilla cordova template.
...
// deviceready Event Handler
//
// Bind any cordova events here. Common events are:
// 'pause', 'resume', etc.
onDeviceReady: function() {
this.receivedEvent('deviceready');
alert(typeof window.plugins.healthkit); // <---- undefined
var callback = function (msg) {
// wrapping in a timeout because of a possbile native UI element blocking the webview
setTimeout(function () {
alert(JSON.stringify(msg))
}, 0);
};
function available() {
window.plugins.healthkit.available(
callback,
callback
);
};
},
...
At the same time, I realized this is the same issue using other cordova pedometer related plugins, this is another issue that I created.
Please help.