Pedometer plugin (version 1.5) for Unity3d
Hi Guys, we are happy to announced that we finally added the new features that every wants which is the following
- make the pedometer service run in the background even if unity3d Application is close
- Make the pedometer service auto run when the mobile device is restarted or boot
- Save the steps data on each day and access them using date
- Continue the step count even if the Android mobile device is restart or boot
- more helpers to help queries the step data
And yeah that is the main features that we added but there’s a catch when you open your Unity3d Application with pedometer plugin please don’t forget to start the service and yes the service is auto run but when you open your app you need to call the start service, you need to do this because you will not received the callback method data without starting the pedometer service.
because of this new main features you can now make little fitbit application now for mobile but for counting steps only 🙂
Since this changes a lot of things have change on the API some method is already remove to avoid confusion on how to used it.
Here’s the list of new API methods
void StartPedometerService(SensorDelay sensorType) – this will start the pedometer service , you need to call this once to activate the pedometer service without calling this the pedometer service will not run when you close the unity3d application and you can’t even get the data from the callback because it will never trigger.
StopPedometerService() – this will stop the pedometer service only call this if you really want to stop the pedometer service but for me no need to call this if you always want to record or save the steps all of the time
void LoadTotalStep() – this will load the total step count since the last boot of your android device
public void LoadStepToday() – will load the step count today and take not each day have its own step count
public void LoadPrevTotalStep() – will load the total step count since the last boot of your device until yesterday same with LoadTotalStep but minus 1 day on total steps
int GetTotalStep() – for getting the total step count please run the LoadTotalStep before calling this because it might give you the outdated value
int GetTotalStepYesterday() – for getting the total step count yesterday please run the LoadPrevTotalStep before calling this because it might give you the outdated value
int GetTotalStepToday() – for getting the total step count today please run the LoadStepToday() before calling this because it might give you the outdated value
int GetPrevTotalStep() – same with GetTotalStepYesterday
int GetStepByDate(int month,int day, int year) – gets the step count based on date you pass for example you want to get the step count on April 18, 2017, you need to pass int GetStepByDate(3,18,2017) look carefully on the month it’s 3 for April because months in android starts with Zero value remember that because if you pass the wrong date you will get the different data or nothing at all.
GetStepToday() – gets the step count for today
int GetStepYesterday() – get the step yesterday but not the total steps yesterday just the step count yesterday
int GetStepLastDay(int day) – gets the step count on the amount of day you put if you put 1 it means step count yesterday , if you put 2 that means step count on last 2 days, if you put 3 last 3 days step count, this is just a lazy helper method
public void DeleteData() – for the deleting all the step data but keep in mind that this will not reset the step count because this step count is running by the android system it will just continue no matter what we can’t control this, Note: if you want to delete and reset it to zero you need to restart your mobile device.
Note: i know it’s confusing but when we say Step Today it’s only the step count that accumulate today and when we say total step count it means the total steps since the Android mobile booted or restarted.
Note: Remove methods
Always Reset to zero
I hope this Information helps you out on using the new Pedometer plugin (version 1.5) for Unity3d and i hope you like our plugin , and please do give us a good reviews and please perfect stars we really need it, it will helps us a lot to make our plugin better and for us to continue adding more features so please help us and we will help you too in return 🙂
For more questions or suggestion or comments or feedback just email us on email@example.com
See you and have fun coding! 🙂