Extra: Known exceptions
rook-sdk-samsung 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 🔧.
Rook Exceptions​
SamsungHealthDisabledException
📜 Samsung Health has been installed but it is disabled.
🔧 Prompt the user to enable Samsung Health.
SamsungHealthNotInstalledException
📜 Samsung Health is not installed.
🔧 Prompt the user to install Samsung Health.
SamsungHealthNotReadyException
📜 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.
SamsungHealthOutdatedException
📜 The version of Samsung Health is too old.
🔧 Prompt the user to update Samsung Health.
SHDateNotValidForEventsException
📜 The provided LocalDate
is not in the allowed range to extract events.
🔧 Use a valid LocalDate
; between 29 days (inclusive) and today (inclusive).
SHDateNotValidForSummariesException
📜 The provided LocalDate
is not in the allowed range to extract events.
🔧 Use a valid LocalDate
; between 29 days ago (inclusive) and yesterday (inclusive).
SHHttpRequestException
📜 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 code
and error
properties and send a report to ROOK support.
SHNotAuthorizedException
📜 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.
SHNotInitializedException
📜 The SDK was not initialized or failed to initialize.
🔧 Call rookConfigurationManager.initRook()
and wait for a successful result.
SHTimeoutException
📜 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.
SHUserNotInitializedException
📜 The User was not initialized or failed to initialize.
🔧 Call rookConfigurationManager.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.