Skip to main content

Migration: Single permissions class

In an effort to simplify the permissions system of rook-sdk we decided to move and merge all current types of permissions from AndroidStepsManager and HCRookYesterdaySyncPermissions in a single class: HCRookHealthPermissionsManager. This new class will also have new functionality like streams for request updates.

The permissions were merged into 2 categories:

Android permissions:

  • POST_NOTIFICATIONS
  • ACTIVITY_RECOGNITION
  • FOREGROUND_SERVICE
  • FOREGROUND_SERVICE_HEALTH

These permissions are used to track and upload steps data (AndroidStepsManager) or to extract and upload Health Connect data (HCRookYesterdaySyncManager).

Health Connect permissions:

  • READ_SLEEP
  • READ_STEPS
  • READ_DISTANCE
  • READ_FLOORS_CLIMBED
  • READ_ELEVATION_GAINED
  • READ_OXYGEN_SATURATION
  • READ_VO2_MAX
  • READ_TOTAL_CALORIES_BURNED
  • READ_ACTIVE_CALORIES_BURNED
  • READ_HEART_RATE
  • READ_RESTING_HEART_RATE
  • READ_HEART_RATE_VARIABILITY
  • READ_EXERCISE
  • READ_SPEED
  • READ_WEIGHT
  • READ_HEIGHT
  • READ_BLOOD_GLUCOSE
  • READ_BLOOD_PRESSURE
  • READ_HYDRATION
  • READ_BODY_TEMPERATURE
  • READ_RESPIRATORY_RATE
  • READ_NUTRITION
  • READ_MENSTRUATION
  • READ_POWER

These permissions are used to extract Health Connect data manually (HCRookSummaryManager, HCRookEventManager) or automatically (HCRookYesterdaySyncManager).

Migration process

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

AndroidStepsManager

DeprecatedReplace with this
Future<bool> AndroidStepsManager.hasPermissions()Future<bool> HCRookHealthPermissionsManager.checkAndroidPermissions()
Future<void> AndroidStepsManager.requestPermissions()Future<RequestPermissionsStatus> HCRookHealthPermissionsManager.requestAndroidPermissions()

HCRookYesterdaySyncPermissions

DeprecatedReplace with this
Future<bool> HCRookYesterdaySyncPermissions.hasAndroidPermissions()Future<bool> HCRookHealthPermissionsManager.checkAndroidPermissions()
Future<void> HCRookYesterdaySyncPermissions.requestAndroidPermissions()Future<RequestPermissionsStatus> HCRookHealthPermissionsManager.requestAndroidPermissions()
Future<bool> HCRookYesterdaySyncPermissions.hasHealthConnectPermissions()Future<bool> HCRookHealthPermissionsManager.checkHealthConnectPermissions()
Future<void> HCRookYesterdaySyncPermissions.requestHealthConnectPermissions()Future<RequestPermissionsStatus> HCRookHealthPermissionsManager.requestHealthConnectPermissions()

HCRookHealthPermissionsManager

DeprecatedReplace with this
Future<HCAvailabilityStatus> HCRookHealthPermissionsManager.checkAvailability()Future<HCAvailabilityStatus> HCRookHealthPermissionsManager.checkHealthConnectAvailability()
Future<bool> HCRookHealthPermissionsManager.checkPermissions()Future<bool> HCRookHealthPermissionsManager.checkHealthConnectPermissions()
Future<void> HCRookHealthPermissionsManager.requestPermissions()Future<RequestPermissionsStatus> HCRookHealthPermissionsManager.requestHealthConnectPermissions()