Skip to main content

RookStepsManager to RookStepsCounter

We have migrated from the STEPS_COUNTER sensor to the STEPS_COUNTER sensor, and implemented various measures to increase the steps service resilience, this will improve step count accuracy and fix discrepancy with popular apps counter services like Google Fit.

However, this change introduced new requirements for the steps service, to avoid misunderstandings we decided to create a new component RookStepsCounter that will eventually replace the now deprecated RookStepsManager in the next major release.

Migration process

Requirements

To use RookStepsCounter you will need:

  • Android permissions: Go to the main Android Permissions section to see the implementation.
  • Alarms permissions (Optional): Go to the main Alarm permissions section to see the implementation.
Alarm permissions

RookStepsCounter uses the SCHEDULE_EXACT_ALARM permission to improve its lifetime in battery constrained scenarios, however this is optional, you can skip requesting this permission to your users and still use RookStepsCounter normally. RookStepsCounter will only schedule an alarm if the permission is granted.

IMPORTANT: You need to call enableStepsCounter again after requesting the alarms' permission.

RookStepsCounter

Next you will find a mapping of each class/function to its corresponding replacement.

Instance functions:

DeprecatedReplacement
rookStepsManager.isAvailable()rookStepsCounter.isStepsCounterAvailable()
rookStepsManager.isBackgroundAndroidStepsActive()rookStepsCounter.isStepsCounterActive()
rookStepsManager.enableBackgroundAndroidSteps()rookStepsCounter.enableStepsCounter()
rookStepsManager.disableBackgroundAndroidSteps()rookStepsCounter.disableStepsCounter()
rookStepsManager.syncTodayAndroidStepsCount()rookStepsCounter.getTodayStepsCount()

Companion functions:

DeprecatedReplacement
RookStepsManager.isAvailable(Context)RookStepsCounter.isStepsCounterAvailable(Context)
RookStepsManager.isBackgroundAndroidStepsActive(Context)RookStepsCounter.isStepsCounterActive(Context)
RookStepsManager.enableBackgroundAndroidSteps(Context)RookStepsCounter.enableStepsCounter(Context)
RookStepsManager.disableBackgroundAndroidSteps(Context)RookStepsCounter.disableStepsCounter(Context)
RookStepsManager.syncTodayAndroidStepsCount(Context)RookStepsCounter.getTodayStepsCount(Context)