Android Backup Service
Functions
createBackup
suspend fun createBackup(): Result<String?>
Creates a full JSON backup of all locally stored SDK data and returns it as a string.
Parameters: None.
createBackup
fun createBackup(
onSuccess: (String?) -> Unit,
onError: ((Throwable) -> Unit)? = null
): Unit
Creates a full JSON backup of all locally stored SDK data and returns it as a string.
Parameters:
onSuccess: (String?) -> Unit— Returns the generated JSON backup string.onError: ((Throwable) -> Unit)?— Called if the backup operation fails.
restore
suspend fun restore(json: String): Result<Unit>
Restores the SDK state from a backup JSON string. Returns true on successful restore.
Parameters:
json: String— Backup JSON string previously generated with createBackup.
restore
fun restore(
json: String,
onSuccess: () -> Unit,
onError: ((Throwable) -> Unit)? = null
): Unit
Restores the SDK state from a backup JSON string. Returns true on successful restore.
Parameters:
json: String— Backup JSON string previously generated with createBackup.onSuccess: () -> UnitonError: ((Throwable) -> Unit)?— Called when restore fails.