# BugreportManager.BugreportCallback

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)

# BugreportCallback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback "View this page in Java")  

```
abstract class BugreportCallback
```

|---|------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                 ||
| ↳ | [android.os.BugreportManager.BugreportCallback](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#) |

An interface describing the callback for bugreport progress and status.

Callers will receive[onProgress](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onProgress(kotlin.Float))calls as the bugreport progresses, followed by a terminal call to either[onFinished](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onFinished())or[onError](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onError(kotlin.Int)).

If an issue is encountered while starting the bugreport asynchronously, callers will receive an[onError](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onError(kotlin.Int))call without any[onProgress](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onProgress(kotlin.Float))callbacks.

## Summary

|                                                                                                                                                            Constants                                                                                                                                                             ||
|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS:kotlin.Int) There is currently a bugreport running.       |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [BUGREPORT_ERROR_INVALID_INPUT](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_INVALID_INPUT:kotlin.Int) The input options were invalid.                                         |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE:kotlin.Int) There is no bugreport to retrieve for the caller. |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [BUGREPORT_ERROR_RUNTIME](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_RUNTIME:kotlin.Int) A runtime error occurred.                                                           |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT:kotlin.Int) The request to get user consent timed out.            |
| static[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [BUGREPORT_ERROR_USER_DENIED_CONSENT](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_DENIED_CONSENT:kotlin.Int) User denied consent to share the bugreport.                 |

|                                                                 Public constructors                                                                 ||
|--------------------------------------------------------------------------------------------------------------------------------------------------|---|
| [BugreportCallback](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BugreportCallback())`()` <br /> |

|                                                                                                                                                                               Public methods                                                                                                                                                                               ||
|----------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onEarlyReportFinished](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onEarlyReportFinished())`()` Called when it is ready for calling app to show UI, showing any extra UI before this callback can interfere with bugreport generation. |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onError](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onError(kotlin.Int))`(`errorCode:` `[Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html)`)` Called when taking bugreport resulted in an error.              |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onFinished](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onFinished())`()` Called when taking bugreport finishes successfully.                                                                                                          |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onProgress](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#onProgress(kotlin.Float))`(`progress:` `[Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html)`)` Called when there is a progress update.              |

## Constants

### BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS: Int
```

There is currently a bugreport running. The caller should try again later.  

    Value: 5

### BUGREPORT_ERROR_INVALID_INPUT

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val BUGREPORT_ERROR_INVALID_INPUT: Int
```

The input options were invalid. For example, the destination file the app provided could not be written by the system.  

    Value: 1

### BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE

Added in[API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE: Int
```

There is no bugreport to retrieve for the caller.  

    Value: 6

### BUGREPORT_ERROR_RUNTIME

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val BUGREPORT_ERROR_RUNTIME: Int
```

A runtime error occurred.  

    Value: 2

### BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT: Int
```

The request to get user consent timed out.  

    Value: 4

### BUGREPORT_ERROR_USER_DENIED_CONSENT

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
static val BUGREPORT_ERROR_USER_DENIED_CONSENT: Int
```

User denied consent to share the bugreport.  

    Value: 3

## Public constructors

### BugreportCallback

```
BugreportCallback()
```

## Public methods

### onEarlyReportFinished

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onEarlyReportFinished(): Unit
```

Called when it is ready for calling app to show UI, showing any extra UI before this callback can interfere with bugreport generation.  

### onError

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onError(errorCode: Int): Unit
```

Called when taking bugreport resulted in an error.

If`BUGREPORT_ERROR_USER_DENIED_CONSENT`is passed, then the user did not consent to sharing the bugreport with the calling app.

If`BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT`is passed, then the consent timed out, but the bugreport could be available in the internal directory of dumpstate for manual retrieval.

If`BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS`is passed, then the caller should try later, as only one bugreport can be in progress at a time.

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ||
|-------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `errorCode` | [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html):Value is[android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_INVALID_INPUT](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_INVALID_INPUT:kotlin.Int),[android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_RUNTIME](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_RUNTIME:kotlin.Int),[android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_DENIED_CONSENT](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_DENIED_CONSENT:kotlin.Int),[android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT:kotlin.Int),[android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS:kotlin.Int), or[android.os.BugreportManager.BugreportCallback#BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE](https://developer.android.com/reference/kotlin/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE:kotlin.Int) |

### onFinished

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onFinished(): Unit
```

Called when taking bugreport finishes successfully.

This callback will be invoked if the`BugreportParams#BUGREPORT_FLAG_DEFER_CONSENT`flag is not set.  

### onProgress

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)  

```
open fun onProgress(progress: Float): Unit
```

Called when there is a progress update.

|                                                                              Parameters                                                                              ||
|------------|----------------------------------------------------------------------------------------------------------------------------------------------------------|
| `progress` | [Float](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-float/index.html):the progress in \[0.0, 100.0\] Value is between 0.0f and 100.0f inclusive |