Extra: Known exceptions
rook_sdk_samsung_health returns custom exceptions wrapped in a Future 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 🔧.
Rook Exceptions​
ConnectTimeoutException​
📜 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.
DateNotValidForEventsException​
📜 The provided DateTime is not in the allowed range to extract events.
🔧 Use a valid DateTime; between 29 days (inclusive) and today (inclusive).
DateNotValidForSummariesException​
📜 The provided DateTime is not in the allowed range to extract events.
🔧 Use a valid DateTime; between 29 days ago (inclusive) and today (inclusive).
HealthKitDisabledException​
📜 Samsung Health has been installed but it is disabled.
🔧 Prompt the user to enable Samsung Health.
HealthKitNotInstalledException​
📜 Samsung Health is not installed.
🔧 Prompt the user to install Samsung Health.
HealthKitNotReadyException​
📜 Samsung Health has been installed but the user didn't perform an initial process, such as agreeing to the Terms and Conditions.
🔧 Prompt the user to open and complete the onboarding process of Samsung Health.
HealthKitOutdatedException​
📜 The version of Samsung Health is too old.
🔧 Prompt the user to update Samsung Health.
HttpRequestException​
📜 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
message property and send a report to ROOK support.
MissingPermissionsException​
📜 The requested operation requires Samsung Health permissions which are not granted.
🔧 Go to the Samsung Health permissions section in the documentation to check how you can request permissions.
RecordsNotFoundException​
📜 The SDK could not find any health data related with the provided data type.
🔧 Open the Samsung Health app, check that that your app has the necessary read permissions and try to force a sync ( pull-to-refresh).
🔧 Open the app that is currently writing to Samsung Health. Check that all write permissions are granted and try to force a sync (pull-to-refresh).
SDKNotAuthorizedException​
📜 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.
SDKNotInitializedException​
📜 The SDK was not initialized or failed to initialize.
🔧 Call RookSamsung.initRook() and wait for a successful result.
SessionExpiredException​
📜 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.
UnknownException​
📜 Unknown exceptions from the OS (Android) or the platform (Samsung Health).
UserNotInitializedException​
📜 The User was not initialized or failed to initialize.
🔧 Call RookSamsung.updateUserID() and wait for a successful result.
Samsung Exceptions​
While developing you may get internal errors from Samsung (com.samsung.android.sdk.health.data.error) like:
com.samsung.android.sdk.health.data.error.AuthorizationException: 2003: Could not get policy
These errors have a code that can help you identify a major issue within the Samsung Health platform, below there is a list of the codes that ca be returned by Samsung Health:
INVALID UID: 1000###​
The requested data's UID is invalid and could not be found.
INVALID INPUT: 1001###​
The input data is invalid, such as being out of range, or it cannot be handled for an unknown reason.
INVALID CALLER: 1002###​
The calling application's UID is invalid. This error may occur when the application uses the API on another caller's binder.
NO USER PERMISSION: 2000###​
This occurs when a data access request has not acquired data permission from the user.
UNSUPPORTED OPERATION: 2001###​
This occurs when an unsupported operation is requested.
NO OWNERSHIP TO WRITE: 2002###​
The calling application tried to update or delete data that did not insert. Only data provided by the application can be updated or deleted.
Documented for completion, ROOK does NOT perform any write operation on Samsung Health.
ACCESS CONTROL: 2003###​
The calling application is not allowed to use the feature.
Your app is not allowed to read data from Samsung, try enabling the developer mode. (In a production environment you will need to request a partnership with Samsung).
INVALID PLATFORM SIGNATURE: 2004###​
This occurs when the Samsung Health application's signature is invalid. This may happen when installing an improper version of the Samsung Health.
CHILD ACCOUNT ACCESS: 2005###​
This occurs when the Samsung account that is set up in the Samsung Health is a child account.
PLATFORM NOT INSTALLED: 3000###​
Samsung Health is not installed.
You won't normally see this error as it is converted to a SamsungHealthNotInstalledException
OLD VERSION PLATFORM: 3001###​
The version of Samsung Health is old so it can't support this function of the SDK.
You won't normally see this error as it is converted to a SamsungHealthOutdatedException
PLATFORM DISABLED: 3002###​
Samsung Health has been installed but it is disabled.
You won't normally see this error as it is converted to a SamsungHealthDisabledException
PLATFORM NOT INITIALIZED: 3003###​
Samsung Health has been installed but the user didn't perform an initial process, such as agreeing to the Terms and Conditions.
You won't normally see this error as it is converted to a SamsungHealthNotReadyException
BD ERROR: 9000###​
An internal database error in the Samsung Health.
INVALID ENCRYPTION KEY: 9001###​
Samsung Health is unable to encrypt/decrypt user health data due to a problem with the key.
OUT OF SPACE: 9002###​
There is not enough space to store any more user health data.
INTERNAL ERROR: 9003###​
An internal error that will not be resolved even when the client retries.
CONNECTION FAIL: 9004###​
The connection continues to fail.
INTERRUPTED: 9005###​
The operation is stopped by an interrupt.
CONNECTION TIMEOUT: 9006###​
The connection request timed out.