Giter VIP home page Giter VIP logo

cordova-plugin-stepper's People

Contributors

achubutkin avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar

cordova-plugin-stepper's Issues

stopStepperUpdates resets steps_today from startStepperUpdates

 window.stepper.startStepperUpdates(
                    offset,
                    this.stepsSuccess,
                    this.stepsError,
                    this.pedometerOptions
                );

  pedometerOptions: {
                    pedometerIsCountingText:         ' counts your steps',
                    pedometerStepsToGoFormatText:    '~%s steps to finish',
                    pedometerYourProgressFormatText: '~%s progress',
                    pedometerGoalReachedFormatText:  '%s congrats finish!',
                },

then to pause, like, enable / disable.


               window.stepper.stopStepperUpdates(
                   () => {
                       // ignore
                   },
                   this.stepsError,
               );

then we start again with startStepperUpdates to cintinue steps count but steps_today in response for stepsSuccess method for today with goal reset to 0?!

offset does not work

Offset supposed to be added to the total steps counted in this session. But it does not

eg

pperUpdates(
                   555,
                   this.stepsSuccess,
                   this.stepsError,
                   this.pedometerOptions
               );

is always starts from 0


Stepper.prototype.startStepperUpdates = function (offset, onSuccess, onError, options) {
    offset = parseInt(offset) || 0;
    options = options || {};
    exec(onSuccess, onError, "Stepper", "startStepperUpdates", [offset, options]);
};

getStepsByPeriod returns wrong value

{"steps":-21760}


  var interval = 1000 * 60 * 60 * 24,
                    start = Math.floor(Date.now() / interval) * interval - (interval * 3),
                    end  = Math.floor(Date.now() / interval) * interval;
 
                      window.stepper.getStepsByPeriod(start, end, steps3=>{
                         console.log(JSON.stringify(steps3));
                     },() =>{});

When you open app first time steps does not update.

    window.stepper.startStepperUpdates(
                    offset,
                    this.updateStepsSuccess,
                    this.pedometerError,
                   {}
                );

 updateStepsSuccess (result) {
                                alert(JSON.stringify(result));
           
            },

alert is called only if you hide app and reopen.

Error: exec proxy not found for :: Stepper :: startStepperUpdates

I was realy mad because there not much docs about how to init cordova plugins.

We use nuxt (vue) + vuetify.

Cordova treated as plugin

     try {
                this.initStepsCounter()
            }
            catch (err) {
                console.log(`error`, err);
                alert(JSON.stringify(err));
            }
        },

        initStepsCounter () {
            Vue.stepper = window.stepper;
            const {Stepper} = window;
            console.log(`Stepper`, Stepper);
            console.log(`window.Stepper`, window.Stepper);
            console.log(`window.stepper`, window.stepper);
            console.log(`window`, window);
            console.log(`navigator.stepper`, navigator.stepper);
            console.log(`navigator`, navigator);
            console.log(`Vue.cordova`, Vue.cordova);
            console.log(`this`, this);
            console.log(`this.cordova`, this.cordova);
            console.log(`window.cordova`, window.cordova);
            console.log(`navigator.cordova`, navigator.cordova);
            console.log(`navigator.camera`, navigator.camera);
            var offset = 0, options = {
                pedometerIsCountingText:      'Pedometer is counting',
                pedometerStepsToGoFormatText: '%s steps to go'
            };

            window.stepper.startStepperUpdates(
                offset,
                result => {
                    var stepsToday = result.steps_today;
                    console.log(`stepsToday`, stepsToday);
                },
                err => {
                    console.error(err);
                },
                options
            );

        },

window.stepper 222 undefined
cordova.js:1021 adding proxy for Camera
Stepper undefined
window.Stepper undefined
window.stepper Stepper
window Window
navigator.stepper undefined
 navigator Navigator
 Vue ƒ Tn(t){this._init(t)}
Vue.cordova undefined
this ObjectinitCustomUrlScheme: ƒ ()initStatusBar: ƒ ()initStepsCounter: ƒ ()initWKWebView: ƒ ()initialize: ƒ ()onDeviceReady: ƒ ()__proto__: Object
this.cordova undefined
window.cordova Object
navigator.cordova undefined
navigator.camera Object
cordova.js:1001 Error: exec proxy not found for :: Stepper :: startStepperUpdates

How do we use your plugin?
How to access it???

Semple configs here this project were used as skeleton

outdated docs

Stepper.prototype.getSteps = function (date, onSuccess, onError) {
    exec(onSuccess, onError, "Stepper", "getSteps", [date]);
};

    window.stepper.getSteps(start, end, ()=>{}, steps3=>{
                         console.log(JSON.stringify(steps3));
                     });

[feature request] Allow to disable goal

Currently, there is no way to disable the goal and the associated count down in notification.

I would love to be able to disable it and simply have a count up in this text placeholder.

i.e. to replace "653 steps to go" by "347 steps today"

Missing permission "ACTIVITY_RECOGNITION" for Android 10+

It seems that ACTIVITY_RECOGNITION requirement is not handled by the plugin.
It have to be explicitly requested on Android 10+

Without this permission, I had no visible error but steps where not raised.

In order to makes it work, I had to:
1°) Add permission to manifest

	<platform name="android">
                 ...
		<config-file after="uses-permission" parent="/manifest" target="AndroidManifest.xml">
			<uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
		</config-file>
                ...
	</platform>

2°) Request permission before initializing steps using cordova-plugin-android-permissions plugin

    const permissions = window.cordova.plugins.permissions;
    permissions.requestPermission(permissions.ACTIVITY_RECOGNITION, result => {
          if (result.hasPermission) {
              window.stepper.startStepperUpdates(...);
          }
     });

Afterward it works well on any device

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.