# BugreportManager.BugreportCallback

Added in[API level 31](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  
Summary:[Constants](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#constants)\|[Ctors](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#pubctors)\|[Methods](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#inhmethods)  

# BugreportManager.BugreportCallback

*** ** * ** ***

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

`
public
static

abstract
class
BugreportManager.BugreportCallback
`  
`

extends `[Object](https://developer.android.com/reference/java/lang/Object)`


``


`

|---|-----------------------------------------------|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.os.BugreportManager.BugreportCallback |

<br />

*** ** * ** ***

An interface describing the callback for bugreport progress and status.

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

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

## Summary

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

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

|                                                                                                                                       ### Public methods                                                                                                                                       ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[onEarlyReportFinished](https://developer.android.com/reference/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. |
| ` void` | ` `[onError](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#onError(int))`(int errorCode) ` Called when taking bugreport resulted in an error.                                                                                                 |
| ` void` | ` `[onFinished](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#onFinished())`() ` Called when taking bugreport finishes successfully.                                                                                                          |
| ` void` | ` `[onProgress](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#onProgress(float))`(float progress) ` Called when there is a progress update.                                                                                                   |

| ### Inherited methods |
|-----------------------|---|
| From class` `[java.lang.Object](https://developer.android.com/reference/java/lang/Object)` ` |--------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | ` `[Object](https://developer.android.com/reference/java/lang/Object)          | ` `[clone](https://developer.android.com/reference/java/lang/Object#clone())`() ` Creates and returns a copy of this object.                                                                                                                                                      | | ` boolean`                                                                     | ` `[equals](https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object))`(`[Object](https://developer.android.com/reference/java/lang/Object)` obj) ` Indicates whether some other object is "equal to" this one.                                           | | ` void`                                                                        | ` `[finalize](https://developer.android.com/reference/java/lang/Object#finalize())`() ` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.                                                          | | ` final `[Class](https://developer.android.com/reference/java/lang/Class)`<?>` | ` `[getClass](https://developer.android.com/reference/java/lang/Object#getClass())`() ` Returns the runtime class of this`Object`.                                                                                                                                                | | ` int`                                                                         | ` `[hashCode](https://developer.android.com/reference/java/lang/Object#hashCode())`() ` Returns a hash code value for the object.                                                                                                                                                 | | ` final void`                                                                  | ` `[notify](https://developer.android.com/reference/java/lang/Object#notify())`() ` Wakes up a single thread that is waiting on this object's monitor.                                                                                                                            | | ` final void`                                                                  | ` `[notifyAll](https://developer.android.com/reference/java/lang/Object#notifyAll())`() ` Wakes up all threads that are waiting on this object's monitor.                                                                                                                         | | ` `[String](https://developer.android.com/reference/java/lang/String)          | ` `[toString](https://developer.android.com/reference/java/lang/Object#toString())`() ` Returns a string representation of the object.                                                                                                                                            | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long,%20int))`(long timeoutMillis, int nanos) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed. | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait(long))`(long timeoutMillis) ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*, or until a certain amount of real time has elapsed.                   | | ` final void`                                                                  | ` `[wait](https://developer.android.com/reference/java/lang/Object#wait())`() ` Causes the current thread to wait until it is awakened, typically by being*notified* or*interrupted*.                                                                                             | ||

## Constants

### BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS

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

```
public static final int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS
```

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

<br />

Constant Value: 5 (0x00000005)  

### BUGREPORT_ERROR_INVALID_INPUT

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

```
public static final int BUGREPORT_ERROR_INVALID_INPUT
```

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

<br />

Constant Value: 1 (0x00000001)  

### BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE

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

```
public static final int BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE
```

There is no bugreport to retrieve for the caller.

<br />

Constant Value: 6 (0x00000006)  

### BUGREPORT_ERROR_RUNTIME

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

```
public static final int BUGREPORT_ERROR_RUNTIME
```

A runtime error occurred.

<br />

Constant Value: 2 (0x00000002)  

### BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT

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

```
public static final int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT
```

The request to get user consent timed out.

<br />

Constant Value: 4 (0x00000004)  

### BUGREPORT_ERROR_USER_DENIED_CONSENT

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

```
public static final int BUGREPORT_ERROR_USER_DENIED_CONSENT
```

User denied consent to share the bugreport.

<br />

Constant Value: 3 (0x00000003)

## Public constructors

### BugreportCallback

```
public BugreportCallback ()
```

<br />

<br />

## Public methods

### onEarlyReportFinished

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

```
public void onEarlyReportFinished ()
```

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

<br />

### onError

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

```
public void onError (int errorCode)
```

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.

<br />

|                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              Parameters                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ||
|-------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `errorCode` | `int`: Value is[BUGREPORT_ERROR_INVALID_INPUT](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_INVALID_INPUT),[BUGREPORT_ERROR_RUNTIME](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_RUNTIME),[BUGREPORT_ERROR_USER_DENIED_CONSENT](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_DENIED_CONSENT),[BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT),[BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS), or[BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE](https://developer.android.com/reference/android/os/BugreportManager.BugreportCallback#BUGREPORT_ERROR_NO_BUGREPORT_TO_RETRIEVE) <br /> |

### onFinished

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

```
public void onFinished ()
```

Called when taking bugreport finishes successfully.

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

<br />

### onProgress

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

```
public void onProgress (float progress)
```

Called when there is a progress update.

<br />

|                                              Parameters                                               ||
|------------|-------------------------------------------------------------------------------------------|
| `progress` | `float`: the progress in \[0.0, 100.0\] Value is between 0.0f and 100.0f inclusive <br /> |