Skip to main content

Extra: Diagnostics

Check the current SDK state during development.

Usage

Call getDiagnosticState from RookConfigurationManager to get the current diagnostic state.

val diagnosticState = rookConfigurationManager.getDiagnosticState().getOrNull()
DO NOT USE IN PRODUCTION

getDiagnosticState is intended only to be used during the development phase of your app and should not be used in a production build.

The returned HCDiagnosticState has the following definition:

data class HCDiagnosticState(
val isConfigured: Boolean, // Indicates whether the SDK has been properly configured.
val userIdentified: Boolean, // Indicates whether a user has been successfully identified within the SDK.
val permissions: HCDiagnosticStatePermissions, // The current permissions status.
val backgroundSync: HCDiagnosticSyncState, // The current state and diagnostic information for background data synchronization.
val manualSync: HCDiagnosticSyncState, // The current state and diagnostic information for manual data synchronization.
)

enum class HCDiagnosticStatePermissions {
NOT_REQUESTED, // Permissions have not been requested.
REQUESTED, // Permission has been requested from the user but not yet decided or granted.
GRANTED, // Permission has been explicitly granted by the user.
}

data class HCDiagnosticSyncState(
// Indicates whether the diagnostic synchronization process is currently active (background) or has been triggered at least once (manual).
val enabled: Boolean,
// The Instant when the last synchronization was triggered, or null if it has never synced.
val lastSync: Instant?,
)