diff --git a/docs/platforms/android/user-feedback/configuration/index.mdx b/docs/platforms/android/user-feedback/configuration/index.mdx
index d9302195e9b6e..27abbd5ce904c 100644
--- a/docs/platforms/android/user-feedback/configuration/index.mdx
+++ b/docs/platforms/android/user-feedback/configuration/index.mdx
@@ -4,10 +4,9 @@ sidebar_order: 6900
description: "Learn about general User Feedback configuration fields."
---
-## User Feedback Widget
+## User Feedback Form
-The User Feedback Widget offers many customization options, and if the available options are insufficient, you can [use your own UI](#bring-your-own-widget).
-The widget is a custom button that opens the form, a custom AlertDialog that allows users to submit feedback.
+The User Feedback form offers many customization options, and if the available options are insufficient, you can [use your own UI](#bring-your-own-form).
### Hooks
@@ -28,14 +27,6 @@ There are hooks available so you can react when the user opens or closes the for
Example:
-```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()));
-});
-```
```kotlin
SentryAndroid.init(this) { options ->
options.feedbackOptions.onFormOpen = Runnable { println("Form opened") }
@@ -48,44 +39,13 @@ SentryAndroid.init(this) { options ->
}
}
```
-
-### Widget
-
-The widget is a custom button that opens the feedback form. As such, you can treat it like any View, customizing it through its XML attributes or programmatically.
-The default attributes of the widget are:
-
-| Attribute | Default Value |
-| -------------------------- | ------------------------------------------- |
-| `android:drawablePadding` | `4dp` |
-| `android:drawableStart` | `@drawable/baseline_campaign_24` |
-| `android:textAllCaps` | `false` |
-| `android:background` | `@drawable/oval_button_ripple_background` |
-| `android:padding` | `12dp` |
-| `android:textColor` | `?android:attr/colorForeground` |
-| `android:text` | `"Report a Bug"` |
-
-Example:
-```xml {filename:myLayout.xml}
-
-
-
-
-
-```
```java
-import io.sentry.android.core.SentryUserFeedbackButton;
-
-SentryUserFeedbackButton widget = new SentryUserFeedbackButton(context);
-```
-```kotlin
-import io.sentry.android.core.SentryUserFeedbackButton
-
-val widget = SentryUserFeedbackButton(context)
+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
@@ -115,17 +75,6 @@ Example:
```
-```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);
-});
-```
```kotlin
SentryAndroid.init(this) { options ->
options.feedbackOptions.isNameRequired = true
@@ -137,6 +86,17 @@ SentryAndroid.init(this) { options ->
options.feedbackOptions.isUseShakeGesture = true
}
```
+```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
@@ -159,21 +119,6 @@ Note: manifest options are not supported here, due to internationalization:
Example:
-```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");
-});
-```
```kotlin
SentryAndroid.init(this) { options ->
options.feedbackOptions.formTitle = "We want to hear from you!"
@@ -189,6 +134,21 @@ SentryAndroid.init(this) { options ->
options.feedbackOptions.cancelButtonLabel = "Back"
}
```
+```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
@@ -209,11 +169,11 @@ Here are the attributes used by the form:
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:
-```java
-SentryUserFeedbackDialog dialog = new SentryUserFeedbackDialog.Builder(context, R.style.MyAppDialogTheme).create();
-```
```kotlin
-val dialog = SentryUserFeedbackDialog.Builder(context, R.style.MyAppDialogTheme).create()
+val form = SentryUserFeedbackForm.Builder(context, R.style.MyAppDialogTheme).create()
+```
+```java
+SentryUserFeedbackForm form = new SentryUserFeedbackForm.Builder(context, R.style.MyAppDialogTheme).create();
```
Here is an example of how the feedback form can be customized:
@@ -255,22 +215,10 @@ Here is an example of how the feedback form can be customized:
```
-### Bring Your Own Widget
-
-You can also use your own UI components to gather feedback and pass the feedback data object to the `Sentry.captureFeedback(Feedback)` function:
+### Bring Your Own Form
-```java
-import io.sentry.Sentry;
-import io.sentry.protocol.Feedback;
+You can also use your own UI components to gather feedback and pass the feedback data object to the `Sentry.feedback().capture(Feedback)` method:
-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.captureFeedback(feedback);
-```
```kotlin
import io.sentry.Sentry
import io.sentry.protocol.Feedback
@@ -281,5 +229,17 @@ feedback.contactEmail = "john.doe@example.com"
// Optionally associate the feedback with an event
val sentryId = Sentry.captureMessage("My message")
feedback.associatedEventId = sentryId
-Sentry.captureFeedback(feedback)
+Sentry.feedback().capture(feedback)
+```
+```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);
```
diff --git a/docs/platforms/android/user-feedback/index.mdx b/docs/platforms/android/user-feedback/index.mdx
index b3ecd26742a96..60ca117a3ca07 100644
--- a/docs/platforms/android/user-feedback/index.mdx
+++ b/docs/platforms/android/user-feedback/index.mdx
@@ -14,105 +14,117 @@ If you're using a self-hosted Sentry instance, you'll need to be on version 24.4
Ensure you are using the Android SDK version 8.14.0 or above of the SDK to access the latest features.
-
+
-## Widget
+## User Feedback Form
-The widget is a custom button that opens the feedback form. You can use it directly in your layout XML or instantiate it programmatically:
+The User Feedback form allows users to submit feedback from anywhere inside your application.
+For the configuration options, please refer to the User Feedback Form Configuration.
-```xml {filename:myLayout.xml}
-
-
+```kotlin
+import io.sentry.Sentry
-
-
+val sentryId = Sentry.captureMessage("My message") // You can optionally associate an event using its id
+Sentry.feedback().show(sentryId) { options ->
+ // The options set here will be applied to the current form only
+ options.formTitle = "We want to hear from you!"
+}
```
```java
-import io.sentry.android.core.SentryUserFeedbackButton;
+import io.sentry.Sentry;
-SentryUserFeedbackButton widget = new SentryUserFeedbackButton(context);
+SentryId sentryId = Sentry.captureMessage("My message"); // You can optionally associate an event using its id
+Sentry.feedback().show(sentryId, options -> {
+ // The options set here will be applied to the current form only
+ options.setFormTitle("We want to hear from you!");
+});
```
+
+### Custom Form
+
+For more control over the form instance (custom theme, per-form configuration, etc.), use the Builder:
+
```kotlin
-import io.sentry.android.core.SentryUserFeedbackButton
+import io.sentry.Sentry
+import io.sentry.android.core.SentryUserFeedbackForm
+
+val sentryId = Sentry.captureMessage("My message")
+val form = SentryUserFeedbackForm.Builder(activity)
+ .associatedEventId(sentryId)
+ .configurator { options ->
+ options.formTitle = "We want to hear from you!"
+ }
+ .create()
+form.show()
+```
+```java
+import io.sentry.Sentry;
+import io.sentry.android.core.SentryUserFeedbackForm;
-val widget = SentryUserFeedbackButton(context)
+SentryId sentryId = Sentry.captureMessage("My message");
+SentryUserFeedbackForm form = new SentryUserFeedbackForm.Builder(activity)
+ .associatedEventId(sentryId)
+ .configurator(options -> {
+ options.setFormTitle("We want to hear from you!");
+ })
+ .create();
+form.show();
```
+### Session Replay
+
+The User Feedback form integrates seamlessly with Session Replay. When the form is opened, the SDK buffers up to 30 seconds of the user's session. If feedback is submitted, this replay is sent along with the feedback, allowing you to view both the feedback and the user's actions leading up to the feedback submission.
## Shake to Report
You can enable shake-to-report so that shaking the device opens the User Feedback form. This uses the device's accelerometer and does not require any additional permissions.
-```java
-SentryAndroid.init(context, options -> {
- options.getFeedbackOptions().setUseShakeGesture(true);
-});
-```
```kotlin
SentryAndroid.init(this) { options ->
options.feedbackOptions.isUseShakeGesture = true
}
```
+```java
+SentryAndroid.init(context, options -> {
+ options.getFeedbackOptions().setUseShakeGesture(true);
+});
+```
```xml {filename:AndroidManifest.xml}
```
-## User Feedback Form
+### Per-Form Shake
-The User Feedback form allows users to submit feedback from anywhere inside your application.
-For the configuration options, please refer to the User Feedback Widget Configuration.
+If you only want shake-to-show for specific screens instead of globally, you can enable it on individual form instances using the Builder. This only works when global shake is disabled (the default).
-```java
-import io.sentry.Sentry;
-
-SentryId sentryId = Sentry.captureMessage("My message"); // You can optionally associate an event using its id
-// Just instantiate the dialog and show it whenever you want
-Sentry.showUserFeedbackDialog(sentryId, options -> {
- // The options set here will be applied to the current form only
- options.setFormTitle("We want to hear from you!");
-});
-```
```kotlin
-import io.sentry.Sentry
+import io.sentry.android.core.SentryUserFeedbackForm
-val sentryId = Sentry.captureMessage("My message") // You can optionally associate an event using its id
-// Just instantiate the dialog and show it whenever you want
-Sentry.showUserFeedbackDialog(sentryId) { options ->
- // The options set here will be applied to the current form only
- options.formTitle = "We want to hear from you!"
-}
+val form = SentryUserFeedbackForm.Builder(activity)
+ .configurator { it.isUseShakeGesture = true }
+ .create()
```
+```java
+import io.sentry.android.core.SentryUserFeedbackForm;
-### Session Replay
+SentryUserFeedbackForm form = new SentryUserFeedbackForm.Builder(activity)
+ .configurator(options -> {
+ options.setUseShakeGesture(true);
+ })
+ .create();
+```
-The User Feedback widget integrates seamlessly with Session Replay. When the widget is opened, the SDK buffers up to 30 seconds of the user's session. If feedback is submitted, this replay is sent along with the feedback, allowing you to view both the feedback and the user's actions leading up to the feedback submission.
+The form will automatically start and stop shake detection based on the activity lifecycle.
## User Feedback API
-The User Feedback API allows you to collect user feedback while using your own UI components. You can submit feedback directly using the `Sentry.captureFeedback(Feedback)` method.
+The User Feedback API allows you to collect user feedback while using your own UI components. You can submit feedback directly using the `Sentry.feedback().capture(Feedback)` method.
Sentry can optionally pair this feedback with an event, giving you additional insight into issues. Sentry needs the `eventId` to be able to associate the user feedback to the corresponding event. For example, to get the `eventId`, you can use beforeSend, or the return value of the method capturing an event.
-```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.captureFeedback(feedback);
-```
```kotlin
import io.sentry.Sentry
import io.sentry.protocol.Feedback
@@ -123,5 +135,17 @@ feedback.contactEmail = "john.doe@example.com"
// Optionally associate the feedback with an event
val sentryId = Sentry.captureMessage("My message")
feedback.associatedEventId = sentryId
-Sentry.captureFeedback(feedback)
+Sentry.feedback().capture(feedback)
+```
+```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);
```
diff --git a/platform-includes/user-feedback/sdk-api-example/android.mdx b/platform-includes/user-feedback/sdk-api-example/android.mdx
index fcc8c9e71d711..de3715d670200 100644
--- a/platform-includes/user-feedback/sdk-api-example/android.mdx
+++ b/platform-includes/user-feedback/sdk-api-example/android.mdx
@@ -1,16 +1,3 @@
-```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.captureFeedback(feedback);
-```
```kotlin {tabTitle:Kotlin}
import io.sentry.Sentry
import io.sentry.protocol.Feedback
@@ -22,5 +9,18 @@ feedback.contactEmail = "john.doe@example.com"
val sentryId = Sentry.captureMessage("My message")
feedback.associatedEventId = sentryId
-Sentry.captureFeedback(feedback)
+Sentry.feedback().capture(feedback)
+```
+```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);
```
diff --git a/platform-includes/user-feedback/sdk-api-example/java.mdx b/platform-includes/user-feedback/sdk-api-example/java.mdx
index fcc8c9e71d711..de3715d670200 100644
--- a/platform-includes/user-feedback/sdk-api-example/java.mdx
+++ b/platform-includes/user-feedback/sdk-api-example/java.mdx
@@ -1,16 +1,3 @@
-```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.captureFeedback(feedback);
-```
```kotlin {tabTitle:Kotlin}
import io.sentry.Sentry
import io.sentry.protocol.Feedback
@@ -22,5 +9,18 @@ feedback.contactEmail = "john.doe@example.com"
val sentryId = Sentry.captureMessage("My message")
feedback.associatedEventId = sentryId
-Sentry.captureFeedback(feedback)
+Sentry.feedback().capture(feedback)
+```
+```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);
```