Does step Counter plugin require a restart

I am using ionic step counter plugin to count the user steps.It works perfectly for the first time but when the app is closed and opened again , the plugin fails.
By fail , I mean it works , it does not give error but the step count received remains fixed at 0.Once I uninstall the app and reinstall it again , it will work fine but once it is closed for the first time , the step counter fails again. That is after every first use of the app before closing the app , the app will work fine and once closed , it shall fail unless uninstalled and reinstalled again.Please help how to correct it.

@JyotirmayaV What do you mean when you say, “Fails”?
Console error, plugin error, alert error?

What is the link of the plugin used specifically?

@1antares1 the link of plugin used :

By fail I mean the step counter plugin function getStepCount() returns the step count as 0.
The value of count does not increase from 0,it remains fixed at 0.
It would work perfectly until the app is closed for the first time giving a proper step count.
But after the first closure the value returned is 0 only which does not change.

Well, that plugin has had some incompatibility with Android versions.

However (Iin such a case you would like to make a pedometer…), I might also suggest you to use Google Maps geolocation for now, you add that function to start tracking and use GPS to draw the route on a map from one point to another while tracking.

You could then divide the length of the path by the average step size. Unfortunately, here it requires user interaction for its implementation and it is not automatic.

There are quite a few tutorials online for Google geolocation. Hopefully this may be of some help to you.

And about this plugin, have you taken a look?

Thanks a lot @1antares1 . I finally shifted to the pedometer plugin as suggested by you and it worked perfectly as expected.It had major functionalities for ios only but atleast the step count was for android as well,so it did the job without giving failures as in case of step-counter plugin. Once again thanks a lot.

1 Like