cordova-plugin-pedometer icon indicating copy to clipboard operation
cordova-plugin-pedometer copied to clipboard

pedometer undefined

Open datafireball opened this issue 7 years ago • 0 comments

I am using Cordova 7.1.0 and I am trying to get this pedometer plugin working. I am using Phonegap to load the app onto my iPhone 7Plus (Version 11.0.3 - 15A432). This workflow works pretty well for the other plugins on Cordova's website like Camera, Device, ..etc. However, the pedometer plugin just does not work.

This is a snippet of the modified index.js out of a vanilla Cordova app:

...
// deviceready Event Handler
//
// Bind any cordova events here. Common events are:
// 'pause', 'resume', etc.
onDeviceReady: function() {
    this.receivedEvent('deviceready');
    alert(typeof pedometer);                      --> UNDEFINED
    // function successCallback(){
    //      alert("success");     
    // };
    // function failureCallback(){
    //      alert("fail");     
    // };
    // pedometer.isStepCountingAvailable(successCallback, failureCallback);
},
...

And the app will show that pedometer is undefined, let alone calling all the various methods. I also tried other variables like Pedometer, window.pedometer, window.Pedometer and none of them works. Can someone share if this plugin is purely outdated and not actively maintained by anyone or there could be an easy fix.

datafireball avatar Dec 15 '17 05:12 datafireball