paladinodeimari
Lurker
I'm writing a basic step counter app in Android Studio using:
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager
val stepSensor : Sensor? = sensorManager?.getDefaultSensor(Sensor.TYPE_STEP_COUNTER)
and sharedPreferences to read/write data.
I've no problem to read total steps.
What I need is my app counts the total steps since first time it is executed. My problem is that steps are reset on device reboot and I don't know how to setup the logic to continue to add steps to the total.
Anyone could help on this? TY
sensorManager = getSystemService(Context.SENSOR_SERVICE) as SensorManager
val stepSensor : Sensor? = sensorManager?.getDefaultSensor(Sensor.TYPE_STEP_COUNTER)
and sharedPreferences to read/write data.
I've no problem to read total steps.
What I need is my app counts the total steps since first time it is executed. My problem is that steps are reset on device reboot and I don't know how to setup the logic to continue to add steps to the total.
Anyone could help on this? TY