From 7a51a0b6c8d9a40ccb0521b010a6afe45c74891f Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Tue, 5 May 2026 22:33:52 +0200 Subject: [PATCH 1/2] chore(android): Update feedback docs to use new Sentry.feedback() API Switch all Android user feedback examples from the old showUserFeedbackDialog/captureFeedback APIs to the new Sentry.feedback().show() and Sentry.feedback().capture() entry points. Drop the SentryUserFeedbackButton widget section entirely and add Builder-based custom form and per-form shake-to-show documentation. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../user-feedback/configuration/index.mdx | 56 ++-------- .../platforms/android/user-feedback/index.mdx | 104 +++++++++++------- .../user-feedback/sdk-api-example/android.mdx | 4 +- .../user-feedback/sdk-api-example/java.mdx | 4 +- 4 files changed, 76 insertions(+), 92 deletions(-) diff --git a/docs/platforms/android/user-feedback/configuration/index.mdx b/docs/platforms/android/user-feedback/configuration/index.mdx index d9302195e9b6e..2f51f3dc784a9 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 @@ -49,45 +48,6 @@ 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) -``` - ### Form Configuration You can customize which form elements are shown, whether they are required, and even prefill some info, in `SentryOptions.SentryFeedbackOptions`: @@ -210,10 +170,10 @@ The theme used by the form is the one set in the application theme as the `andro A custom theme can be also set when instantiating it: ```java -SentryUserFeedbackDialog dialog = new SentryUserFeedbackDialog.Builder(context, R.style.MyAppDialogTheme).create(); +SentryUserFeedbackForm form = new SentryUserFeedbackForm.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() ``` Here is an example of how the feedback form can be customized: @@ -255,9 +215,9 @@ Here is an example of how the feedback form can be customized: ``` -### Bring Your Own Widget +### Bring Your Own Form -You can also use your own UI components to gather feedback and pass the feedback data object to the `Sentry.captureFeedback(Feedback)` function: +You can also use your own UI components to gather feedback and pass the feedback data object to the `Sentry.feedback().capture(Feedback)` method: ```java import io.sentry.Sentry; @@ -269,7 +229,7 @@ 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); +Sentry.feedback().capture(feedback); ``` ```kotlin import io.sentry.Sentry @@ -281,5 +241,5 @@ 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) ``` diff --git a/docs/platforms/android/user-feedback/index.mdx b/docs/platforms/android/user-feedback/index.mdx index b3ecd26742a96..ab56c126b718b 100644 --- a/docs/platforms/android/user-feedback/index.mdx +++ b/docs/platforms/android/user-feedback/index.mdx @@ -14,35 +14,66 @@ 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. -![An example of the User Feedback Widget on Android =350x](./img/user-feedback-android-widget.png) +![An example of the User Feedback Form on Android =350x](./img/user-feedback-android-widget.png) -## Widget +## User Feedback Form + +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. -The widget is a custom button that opens the feedback form. You can use it directly in your layout XML or instantiate it programmatically: +```java +import io.sentry.Sentry; -```xml {filename:myLayout.xml} - - +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!"); +}); +``` +```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!" +} ``` + +### Custom Form + +For more control over the form instance (custom theme, per-form configuration, etc.), use the Builder: + ```java -import io.sentry.android.core.SentryUserFeedbackButton; +import io.sentry.Sentry; +import io.sentry.android.core.SentryUserFeedbackForm; -SentryUserFeedbackButton widget = new 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(); ``` ```kotlin -import io.sentry.android.core.SentryUserFeedbackButton +import io.sentry.Sentry +import io.sentry.android.core.SentryUserFeedbackForm -val widget = SentryUserFeedbackButton(context) +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() ``` +### 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 @@ -64,39 +95,32 @@ SentryAndroid.init(this) { options -> ``` -## 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; +import io.sentry.android.core.SentryUserFeedbackForm; -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!"); -}); +SentryUserFeedbackForm form = new SentryUserFeedbackForm.Builder(activity) + .configurator(options -> { + options.setUseShakeGesture(true); + }) + .create(); ``` ```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() ``` -### Session Replay - -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. @@ -111,7 +135,7 @@ 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); +Sentry.feedback().capture(feedback); ``` ```kotlin import io.sentry.Sentry @@ -123,5 +147,5 @@ 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) ``` diff --git a/platform-includes/user-feedback/sdk-api-example/android.mdx b/platform-includes/user-feedback/sdk-api-example/android.mdx index fcc8c9e71d711..f9eb6416d3298 100644 --- a/platform-includes/user-feedback/sdk-api-example/android.mdx +++ b/platform-includes/user-feedback/sdk-api-example/android.mdx @@ -9,7 +9,7 @@ feedback.setContactEmail("john.doe@example.com"); SentryId sentryId = Sentry.captureMessage("My message"); feedback.setAssociatedEventId(sentryId); -Sentry.captureFeedback(feedback); +Sentry.feedback().capture(feedback); ``` ```kotlin {tabTitle:Kotlin} import io.sentry.Sentry @@ -22,5 +22,5 @@ feedback.contactEmail = "john.doe@example.com" val sentryId = Sentry.captureMessage("My message") feedback.associatedEventId = sentryId -Sentry.captureFeedback(feedback) +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..f9eb6416d3298 100644 --- a/platform-includes/user-feedback/sdk-api-example/java.mdx +++ b/platform-includes/user-feedback/sdk-api-example/java.mdx @@ -9,7 +9,7 @@ feedback.setContactEmail("john.doe@example.com"); SentryId sentryId = Sentry.captureMessage("My message"); feedback.setAssociatedEventId(sentryId); -Sentry.captureFeedback(feedback); +Sentry.feedback().capture(feedback); ``` ```kotlin {tabTitle:Kotlin} import io.sentry.Sentry @@ -22,5 +22,5 @@ feedback.contactEmail = "john.doe@example.com" val sentryId = Sentry.captureMessage("My message") feedback.associatedEventId = sentryId -Sentry.captureFeedback(feedback) +Sentry.feedback().capture(feedback) ``` From 6d988190aec55ca71df05bbb3416b964b40ed8f6 Mon Sep 17 00:00:00 2001 From: Roman Zavarnitsyn Date: Wed, 6 May 2026 09:55:12 +0200 Subject: [PATCH 2/2] chore(android): Reorder code snippets to show Kotlin first Co-Authored-By: Claude Opus 4.6 (1M context) --- .../user-feedback/configuration/index.mdx | 98 +++++++++---------- .../platforms/android/user-feedback/index.mdx | 92 ++++++++--------- .../user-feedback/sdk-api-example/android.mdx | 26 ++--- .../user-feedback/sdk-api-example/java.mdx | 26 ++--- 4 files changed, 121 insertions(+), 121 deletions(-) diff --git a/docs/platforms/android/user-feedback/configuration/index.mdx b/docs/platforms/android/user-feedback/configuration/index.mdx index 2f51f3dc784a9..27abbd5ce904c 100644 --- a/docs/platforms/android/user-feedback/configuration/index.mdx +++ b/docs/platforms/android/user-feedback/configuration/index.mdx @@ -27,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") } @@ -47,6 +39,14 @@ SentryAndroid.init(this) { options -> } } ``` +```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 @@ -75,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 @@ -97,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 @@ -119,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!" @@ -149,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 @@ -169,12 +169,12 @@ 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 -SentryUserFeedbackForm form = new SentryUserFeedbackForm.Builder(context, R.style.MyAppDialogTheme).create(); -``` ```kotlin 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: @@ -219,18 +219,6 @@ Here is an example of how the feedback form can be customized: You can also use your own UI components to gather feedback and pass the feedback data object to the `Sentry.feedback().capture(Feedback)` method: -```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); -``` ```kotlin import io.sentry.Sentry import io.sentry.protocol.Feedback @@ -243,3 +231,15 @@ val sentryId = Sentry.captureMessage("My message") feedback.associatedEventId = sentryId 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 ab56c126b718b..60ca117a3ca07 100644 --- a/docs/platforms/android/user-feedback/index.mdx +++ b/docs/platforms/android/user-feedback/index.mdx @@ -21,15 +21,6 @@ Ensure you are using the Android SDK version 8.14.0 or above of the SDK to acces 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. -```java -import io.sentry.Sentry; - -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!"); -}); -``` ```kotlin import io.sentry.Sentry @@ -39,24 +30,20 @@ Sentry.feedback().show(sentryId) { options -> options.formTitle = "We want to hear from you!" } ``` +```java +import io.sentry.Sentry; + +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: -```java -import io.sentry.Sentry; -import io.sentry.android.core.SentryUserFeedbackForm; - -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(); -``` ```kotlin import io.sentry.Sentry import io.sentry.android.core.SentryUserFeedbackForm @@ -70,6 +57,19 @@ val form = SentryUserFeedbackForm.Builder(activity) .create() form.show() ``` +```java +import io.sentry.Sentry; +import io.sentry.android.core.SentryUserFeedbackForm; + +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 @@ -79,16 +79,16 @@ The User Feedback form integrates seamlessly with Session Replay. When the form 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} @@ -99,6 +99,13 @@ SentryAndroid.init(this) { options -> 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). +```kotlin +import io.sentry.android.core.SentryUserFeedbackForm + +val form = SentryUserFeedbackForm.Builder(activity) + .configurator { it.isUseShakeGesture = true } + .create() +``` ```java import io.sentry.android.core.SentryUserFeedbackForm; @@ -108,13 +115,6 @@ SentryUserFeedbackForm form = new SentryUserFeedbackForm.Builder(activity) }) .create(); ``` -```kotlin -import io.sentry.android.core.SentryUserFeedbackForm - -val form = SentryUserFeedbackForm.Builder(activity) - .configurator { it.isUseShakeGesture = true } - .create() -``` The form will automatically start and stop shake detection based on the activity lifecycle. @@ -125,18 +125,6 @@ The User Feedback API allows you to collect user feedback while using your own U 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.feedback().capture(feedback); -``` ```kotlin import io.sentry.Sentry import io.sentry.protocol.Feedback @@ -149,3 +137,15 @@ val sentryId = Sentry.captureMessage("My message") feedback.associatedEventId = sentryId 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 f9eb6416d3298..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.feedback().capture(feedback); -``` ```kotlin {tabTitle:Kotlin} import io.sentry.Sentry import io.sentry.protocol.Feedback @@ -24,3 +11,16 @@ feedback.associatedEventId = sentryId 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 f9eb6416d3298..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.feedback().capture(feedback); -``` ```kotlin {tabTitle:Kotlin} import io.sentry.Sentry import io.sentry.protocol.Feedback @@ -24,3 +11,16 @@ feedback.associatedEventId = sentryId 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); +```