Known exceptions
rook-sdk returns custom exceptions wrapped in a Result object in each function when an issue is encountered. Below
there is a list of all ROOK exceptions, their description/cause 📜 and how to handle them if encountered 🔧.
HCDateNotValidForEventsException​
📜 The provided LocalDate is not in the allowed range to extract events.
🔧 Use a valid LocalDate; between 29 days (inclusive) and today (inclusive).
HCDateNotValidForSummariesException​
📜 The provided LocalDate is not in the allowed range to extract events.
🔧 Use a valid LocalDate; between 29 days ago (inclusive) and today (inclusive).
HCHttpRequestException​
📜 An HTTP request failed, this usually means an error in ROOK servers.
🔧 Check if you configured the SDK credentials correctly, if that is OK look for
the httpCode and httpMessage properties and send a report to ROOK support.
HCMissingConfigurationException​
📜 A RookConfiguration instance was not provided to a RookConfigurationManager.
🔧 Provide the required RookConfiguration instance. More information here.
HCNotAuthorizedException​
📜 The requested operation requires an authorization level that your clientUUID doesn't have.
🔧 Check if you configured the SDK credentials correctly, if that is OK send a report to ROOK support, some of the features of the SDK require a special level of authorization that are not included in the basic level.
HCNotInitializedException​
📜 The SDK was not initialized or failed to initialize.
🔧 Call rookConfigurationManager.initRook() and wait for a successful result.
HCQuotaExceededException​
📜 The Health Connect rate limited request quota has been exceeded, this will happen if you use the functions
of RookSyncManager too many times.
🔧 Wait for a moment before syncing data again, the quota will be partially restored as the time passes so the longer you wait the more quota will be restored, we recommend waiting from 15 to 90 minutes.
HCRecordsNotFoundException​
📜 The SDK could not find any health data related with the provided data type.
🔧 Verify that your app has the necessary read permissions.
🔧 Open the app that is currently writing to Health Connect; Fitbit, GoogleFit, etc. Check that all write permissions are granted and try to force a sync (pull-to-refresh).
HCSessionExpiredException​
📜 The SDK session expired and could not be automatically recovered.
🔧 Re-initialize the SDK with a valid Client UUID and secret. Ensure that the secret and package name of your app are registered in the ROOK portal.
HCTimeoutException​
📜 An HTTP request waited too long and could not be completed. This can happen because an unavailable or unstable internet connection.
🔧 Check your connectivity and try again.
HCUserNotInitializedException​
📜 The User was not initialized or failed to initialize.
🔧 Call rookConfigurationManager.updateUserID() and wait for a successful result.
HealthConnectNotInstalledException​
📜 The requested operation could not be completed because Health Connect is not installed, starting from Android 14, Health connect is preinstalled on all devices, so this will only happen on Android 13 or lower devices.
🔧 Ask the user to download Health Connect, you can use an Intent like below to directly open the PlayStore on the
Health Connect page.
val intent = Intent(
Intent.ACTION_VIEW,
Uri.parse("https://play.google.com/store/apps/details?id=com.google.android.apps.healthdata")
)
HealthConnectNotSupportedException​
📜 The requested operation could not be completed because the current device is not supported by Health Connect.
🔧 Don't use Health Connect operations, follow the instruction in Availability documentation to easily identify incompatible devices.
MissingAndroidPermissionsException​
📜 The requested operation requires Android permissions which are not granted.
🔧 Go to the Android permissions section in the documentation to check how you can request permissions.
MissingHealthConnectPermissionsException​
📜 The requested operation requires Health Connect permissions which are not granted.
🔧 Go to the Health Connect permissions section in the documentation to check how you can request permissions.