Stay organized with collections
Save and categorize content based on your preferences.
RestoreObserver
abstract class RestoreObserver
Callback class for receiving progress reports during a restore operation. These methods will all be called on your application's main thread.
Summary
Public methods |
open Unit |
An indication of which package is being restored currently, out of the total number provided in the restoreStarting(int) callback.
|
open Unit |
The restore process has completed.
|
open Unit |
The restore operation has begun.
|
Public constructors
RestoreObserver
RestoreObserver()
Public methods
onUpdate
open fun onUpdate(
nowBeingRestored: Int,
currentPackage: String!
): Unit
An indication of which package is being restored currently, out of the total number provided in the restoreStarting(int)
callback. This method is not guaranteed to be called: if the transport is unable to obtain data for one or more of the requested packages, no onUpdate() call will occur for those packages.
Parameters |
nowBeingRestored |
Int: The index, between 1 and the numPackages parameter to the restoreStarting(int) callback, of the package now being restored. This may be non-monotonic; it is intended purely as a rough indication of the backup manager's progress through the overall restore process. |
currentPackage |
String!: The name of the package now being restored. |
restoreFinished
open fun restoreFinished(error: Int): Unit
The restore process has completed. This method will always be called, even if no individual package restore operations were attempted.
Parameters |
error |
Int: Zero on success; a nonzero error code if the restore operation as a whole failed. |
restoreStarting
open fun restoreStarting(numPackages: Int): Unit
The restore operation has begun.
Parameters |
numPackages |
Int: The total number of packages being processed in this restore operation. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# RestoreObserver\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nRestoreObserver\n===============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/app/backup/RestoreObserver \"View this page in Java\") \n\n```\nabstract class RestoreObserver\n```\n\n|---|-----------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.app.backup.RestoreObserver](#) |\n\nCallback class for receiving progress reports during a restore operation. These methods will all be called on your application's main thread.\n\nSummary\n-------\n\n| Public constructors ||\n|--------------------------------------------------|---|\n| [RestoreObserver](#RestoreObserver())`()` \u003cbr /\u003e |\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onUpdate](#onUpdate(kotlin.Int,%20kotlin.String))`(`nowBeingRestored:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`, `currentPackage:` `[String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!`)` An indication of which package is being restored currently, out of the total number provided in the [restoreStarting(int)](#restoreStarting(kotlin.Int)) callback. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [restoreFinished](#restoreFinished(kotlin.Int))`(`error:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` The restore process has completed. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [restoreStarting](#restoreStarting(kotlin.Int))`(`numPackages:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` The restore operation has begun. |\n\nPublic constructors\n-------------------\n\n### RestoreObserver\n\n```\nRestoreObserver()\n```\n\nPublic methods\n--------------\n\n### onUpdate\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onUpdate(\n nowBeingRestored: Int, \n currentPackage: String!\n): Unit\n```\n\nAn indication of which package is being restored currently, out of the total number provided in the [restoreStarting(int)](#restoreStarting(kotlin.Int)) callback. This method is not guaranteed to be called: if the transport is unable to obtain data for one or more of the requested packages, no onUpdate() call will occur for those packages.\n\n| Parameters ||\n|--------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `nowBeingRestored` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The index, between 1 and the numPackages parameter to the [restoreStarting(int)](#restoreStarting(kotlin.Int)) callback, of the package now being restored. This may be non-monotonic; it is intended purely as a rough indication of the backup manager's progress through the overall restore process. |\n| `currentPackage` | [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html)!: The name of the package now being restored. |\n\n### restoreFinished\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun restoreFinished(error: Int): Unit\n```\n\nThe restore process has completed. This method will always be called, even if no individual package restore operations were attempted.\n\n| Parameters ||\n|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `error` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): Zero on success; a nonzero error code if the restore operation as a whole failed. |\n\n### restoreStarting\n\nAdded in [API level 8](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun restoreStarting(numPackages: Int): Unit\n```\n\nThe restore operation has begun.\n\n| Parameters ||\n|---------------|-----------------------------------------------------------------------------------------------------------------------------------------------------|\n| `numPackages` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html): The total number of packages being processed in this restore operation. |"]]