---
title: "Configure User Feedback"
description: "Learn about general User Feedback configuration fields."
url: https://docs.sentry.io/platforms/android/user-feedback/configuration/
---

# Configure User Feedback | Sentry for Android

## [User Feedback Form](https://docs.sentry.io/platforms/android/user-feedback/configuration.md#user-feedback-form)

The User Feedback form offers many customization options, and if the available options are insufficient, you can [use your own UI](https://docs.sentry.io/platforms/android/user-feedback/configuration.md#bring-your-own-form).

### [Hooks](https://docs.sentry.io/platforms/android/user-feedback/configuration.md#hooks)

There are hooks available so you can react when the user opens or closes the form, successfully submits it, or an error is triggered:

| Hook              | Type                 | Description                                                              |
| ----------------- | -------------------- | ------------------------------------------------------------------------ |
| `onFormOpen`      | `() -> Void`         | Called when the feedback form is opened.                                 |
| `onFormClose`     | `() -> Void`         | Called when the feedback form is closed.                                 |
| `onSubmitSuccess` | `(Feedback) -> Void` | Called when feedback is successfully submitted via the prepared form.    |
| `onSubmitError`   | `(Feedback) -> Void` | Called when there is an error submitting feedback via the prepared form. |

`onSubmitSuccess` and `onSubmitError` forward the feedback object that was submitted, which contains the following properties:

* `message`: The message the user entered in the feedback form.
* `name`: The name the user entered in the feedback form.
* `contactEmail`: The email the user entered in the feedback form.

Example:

**kotlin**

```kotlin
SentryAndroid.init(this) { options ->
    options.feedbackOptions.onFormOpen = Runnable { println("Form opened") }
    options.feedbackOptions.onFormClose = Runnable { println("Form closed") }
    options.feedbackOptions.onSubmitSuccess = SentryFeedbackOptions.SentryFeedbackCallback {
        println("Feedback submitted successfully: $it")
    }
    options.feedbackOptions.onSubmitError = SentryFeedbackOptions.SentryFeedbackCallback {
        println("Failed to submit feedback: $it")
    }
}
```

**java**

```java
SentryAndroid.init(context, options -> {
    options.getFeedbackOptions().setOnFormOpen(() -> System.out.println("Form opened"));
    options.getFeedbackOptions().setOnFormClose(() -> System.out.println("Form closed"));
    options.getFeedbackOptions().setOnSubmitSuccess((feedback) -> System.out.println("Feedback submitted successfully: " + feedback.toString()));
    options.getFeedbackOptions().setOnSubmitError((feedback) -> System.out.println("Failed to submit feedback: " + feedback.toString()));
});
```

### [Form Configuration](https://docs.sentry.io/platforms/android/user-feedback/configuration.md#form-configuration)

You can customize which form elements are shown, whether they are required, and even prefill some info, in `SentryOptions.SentryFeedbackOptions`:

| Option            | Type   | Default | Description                                                                                                               |
| ----------------- | ------ | ------- | ------------------------------------------------------------------------------------------------------------------------- |
| `showBranding`    | `Bool` | `true`  | Displays the Sentry logo inside the form                                                                                  |
| `isNameRequired`  | `Bool` | `false` | Requires the name field on the feedback form to be filled in.                                                             |
| `showName`        | `Bool` | `true`  | Displays the name field on the feedback form. Ignored if `isNameRequired` is `true`.                                      |
| `isEmailRequired` | `Bool` | `false` | Requires the email field on the feedback form to be filled in.                                                            |
| `showEmail`       | `Bool` | `true`  | Displays the email field on the feedback form. Ignored if `isEmailRequired` is `true`.                                    |
| `useShakeGesture` | `Bool` | `false` | Opens the feedback form when the user shakes the device. Uses the accelerometer and requires no additional permissions.   |
| `useSentryUser`   | `Bool` | `true`  | Sets the `email` and `name` fields to the corresponding Sentry SDK user fields that were called with `SentrySDK.setUser`. |

Example:

**\[xml] AndroidManifest.xml**

```xml
<application>
    <meta-data
    android:name="io.sentry.feedback.is-name-required"
    android:value="true"
  />
    <meta-data
    android:name="io.sentry.feedback.show-name"
    android:value="false"
  />
    <meta-data
    android:name="io.sentry.feedback.is-email-required"
    android:value="false"
  />
    <meta-data
    android:name="io.sentry.feedback.show-email"
    android:value="false"
  />
    <meta-data
    android:name="io.sentry.feedback.use-sentry-user"
    android:value="false"
  />
    <meta-data
    android:name="io.sentry.feedback.show-branding"
    android:value="false"
  />
    <meta-data
    android:name="io.sentry.feedback.use-shake-gesture"
    android:value="true"
  />
</application>
```

**kotlin**

```kotlin
SentryAndroid.init(this) { options ->
    options.feedbackOptions.isNameRequired = true
    options.feedbackOptions.isShowName = false
    options.feedbackOptions.isEmailRequired = true
    options.feedbackOptions.isShowEmail = false
    options.feedbackOptions.isUseSentryUser = false
    options.feedbackOptions.isShowBranding = false
    options.feedbackOptions.isUseShakeGesture = true
}
```

**java**

```java
SentryAndroid.init(context, options -> {
    options.getFeedbackOptions().setNameRequired(true);
    options.getFeedbackOptions().setShowName(false);
    options.getFeedbackOptions().setEmailRequired(true);
    options.getFeedbackOptions().setShowEmail(false);
    options.getFeedbackOptions().setUseSentryUser(false);
    options.getFeedbackOptions().setShowBranding(false);
    options.getFeedbackOptions().setUseShakeGesture(true);
});
```

### [Form Label Customization](https://docs.sentry.io/platforms/android/user-feedback/configuration.md#form-label-customization)

You can customize the labels and placeholders used in the form. Note: manifest options are not supported here, due to internationalization:

| Option               | Type     | Default                                  | Description                                                   |
| -------------------- | -------- | ---------------------------------------- | ------------------------------------------------------------- |
| `formTitle`          | `String` | `"Report a Bug"`                         | The title of the feedback form.                               |
| `messageLabel`       | `String` | `"Description"`                          | The label of the feedback description input field.            |
| `messagePlaceholder` | `String` | `"What's the bug? What did you expect?"` | The placeholder in the feedback description input field.      |
| `isRequiredLabel`    | `String` | `" (Required)"`                          | The text to attach to the title label for a required field.   |
| `successMessageText` | `String` | `"Thank you for your report!"`           | The message displayed after a successful feedback submission. |
| `nameLabel`          | `String` | `"Name"`                                 | The label next to the name input field.                       |
| `namePlaceholder`    | `String` | `"Your Name"`                            | The placeholder in the name input field.                      |
| `emailLabel`         | `String` | `"Email"`                                | The label next to the email input field.                      |
| `emailPlaceholder`   | `String` | `"your.email@example.org"`               | The placeholder in the email input field.                     |
| `submitButtonLabel`  | `String` | `"Send Bug Report"`                      | The label of the submit button.                               |
| `cancelButtonLabel`  | `String` | `"Cancel"`                               | The label of the cancel button.                               |

Example:

**kotlin**

```kotlin
SentryAndroid.init(this) { options ->
    options.feedbackOptions.formTitle = "We want to hear from you!"
    options.feedbackOptions.messageLabel = "Feedback"
    options.feedbackOptions.messagePlaceholder = "Type your feedback"
    options.feedbackOptions.isRequiredLabel = " *"
    options.feedbackOptions.successMessageText = "Thanks for the feedback!"
    options.feedbackOptions.nameLabel = "Full Name"
    options.feedbackOptions.namePlaceholder = "Type your full name"
    options.feedbackOptions.emailLabel = "Email Address"
    options.feedbackOptions.emailPlaceholder = "Type your email"
    options.feedbackOptions.submitButtonLabel = "Submit"
    options.feedbackOptions.cancelButtonLabel = "Back"
}
```

**java**

```java
SentryAndroid.init(context, options -> {
    options.getFeedbackOptions().setFormTitle("We want to hear from you!");
    options.getFeedbackOptions().setMessageLabel("Feedback");
    options.getFeedbackOptions().setMessagePlaceholder("Type your feedback");
    options.getFeedbackOptions().setIsRequiredLabel(" *");
    options.getFeedbackOptions().setSuccessMessageText("Thanks for the feedback!");
    options.getFeedbackOptions().setNameLabel("Full Name");
    options.getFeedbackOptions().setNamePlaceholder("Type your full name");
    options.getFeedbackOptions().setEmailLabel("Email Address");
    options.getFeedbackOptions().setEmailPlaceholder("Type your email");
    options.getFeedbackOptions().setSubmitButtonLabel("Submit");
    options.getFeedbackOptions().setCancelButtonLabel("Back");
});
```

### [Theme Customization](https://docs.sentry.io/platforms/android/user-feedback/configuration.md#theme-customization)

The User Feedback form integrates with the app theme by default, and can be customized with a custom xml style. Here are the attributes used by the form:

| Android style attribute           | Description                                                 |
| --------------------------------- | ----------------------------------------------------------- |
| `android:windowTitleStyle`        | Style of the feedback dialog title                          |
| `android:textColor`               | Color of title, cancel button text, and non-editable texts. |
| `android:editTextColor`           | Color of editable texts.                                    |
| `android:textColorHint`           | Color of the hint of editable texts.                        |
| `android:textColorPrimaryInverse` | Color of the send button text.                              |
| `android:colorPrimary`            | Background color of the send button.                        |
| `android:colorBackground`         | Background color of the cancel button.                      |
| `android:colorForeground`         | Color tint of the image logo.                               |

The theme used by the form is the one set in the application theme as the `android:dialogTheme`. A custom theme can be also set when instantiating it:

**kotlin**

```kotlin
val form = SentryUserFeedbackForm.Builder(context, R.style.MyAppDialogTheme).create()
```

**java**

```java
SentryUserFeedbackForm form = new SentryUserFeedbackForm.Builder(context, R.style.MyAppDialogTheme).create();
```

Here is an example of how the feedback form can be customized:

**\[xml] styles.xml**

```xml
<!-- Application theme. -->
<style name="MyAppTheme" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
  <!-- ... Current theme customizations ... -->

  <!-- Set a dialog theme if not already done. -->
  <item name="android:dialogTheme">@style/MyAppDialogTheme</item>
</style>

<!-- Edit application dialog theme. -->
<style name="MyAppDialogTheme" parent="Theme.MaterialComponents.DayNight.Dialog">
  <!-- Set the style of the feedback dialog title. -->
  <item name="android:windowTitleStyle">@style/FeedbackFormTitleStyle</item>

  <!-- Set the color of title, cancel button text, and non editable texts. -->
  <item name="android:textColor">@color/colorPrimary</item>
  <!-- Set the color of editable texts. -->
  <item name="android:editTextColor">@color/colorPrimaryDark</item>
  <!-- Set the color of the hint of editable texts. -->
  <item name="android:textColorHint">@color/colorPrimaryDark</item>
  <!-- Set the color of the send button text. -->
  <item name="android:textColorPrimaryInverse">@android:color/white</item>

  <!-- Set the background color of the send button. -->
  <item name="android:colorPrimary">@color/colorPrimary</item>
  <!-- Set the background color of the cancel button. -->
  <item name="android:colorBackground">@android:color/black</item>
  <!-- Set the color tint of the image logo. -->
  <item name="android:colorForeground">@color/colorPrimary</item>
</style>

<style name="FeedbackFormTitleStyle">
  <!-- Customize your theme here. -->
  <item name="android:textAppearance">@style/TextAppearance.AppCompat.Title</item>
</style>
```

### [Bring Your Own Form](https://docs.sentry.io/platforms/android/user-feedback/configuration.md#bring-your-own-form)

You can also use your own UI components to gather feedback and pass the feedback data object to the `Sentry.feedback().capture(Feedback)` method:

**kotlin**

```kotlin
import io.sentry.Sentry
import io.sentry.protocol.Feedback

val feedback = Feedback("I encountered a bug while using the app.")
feedback.name = "John Doe"
feedback.contactEmail = "john.doe@example.com"
// Optionally associate the feedback with an event
val sentryId = Sentry.captureMessage("My message")
feedback.associatedEventId = sentryId
Sentry.feedback().capture(feedback)
```

**java**

```java
import io.sentry.Sentry;
import io.sentry.protocol.Feedback;

Feedback feedback = new Feedback("I encountered a bug while using the app.");
feedback.setName("John Doe");
feedback.setContactEmail("john.doe@example.com");
// Optionally associate the feedback with an event
SentryId sentryId = Sentry.captureMessage("My message");
feedback.setAssociatedEventId(sentryId);
Sentry.feedback().capture(feedback);
```
