#facepalm I confused minus with plus - incorrect and negative(!) step counts were possible
This commit is contained in:
parent
1584eac152
commit
6fbbd325c0
2 changed files with 4 additions and 4 deletions
|
@ -184,9 +184,9 @@ public class TrackerService extends Service implements TrackbookKeys, SensorEven
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSensorChanged(SensorEvent sensorEvent) {
|
public void onSensorChanged(SensorEvent sensorEvent) {
|
||||||
// save the step count offset (steps previously recorded by the system) and add any steps recorded during this session in case the app was killed
|
// save the step count offset (steps previously recorded by the system) and subtract any steps recorded during this session in case the app was killed
|
||||||
if (mStepCountOffset == 0) {
|
if (mStepCountOffset == 0) {
|
||||||
mStepCountOffset = sensorEvent.values[0] - 1 + mTrack.getStepCount();
|
mStepCountOffset = (sensorEvent.values[0] - 1) - mTrack.getStepCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
// calculate step count
|
// calculate step count
|
||||||
|
|
|
@ -21,8 +21,8 @@ allprojects {
|
||||||
}
|
}
|
||||||
project.ext {
|
project.ext {
|
||||||
applicationId = 'org.y20k.trackbook'
|
applicationId = 'org.y20k.trackbook'
|
||||||
versionCode = 17
|
versionCode = 18
|
||||||
versionName = '1.1.1'
|
versionName = '1.1.2'
|
||||||
minSdkVersion = 22
|
minSdkVersion = 22
|
||||||
compileSdkVersion = 27
|
compileSdkVersion = 27
|
||||||
targetSdkVersion = 27
|
targetSdkVersion = 27
|
||||||
|
|
Loading…
Reference in a new issue