Skip to content

Commit 62678a2

Browse files
committed
updated java docs for user feedback
added associatedEventId in sample code snippets updated java/android sdk-api-example
1 parent 85a8c9e commit 62678a2

File tree

5 files changed

+49
-32
lines changed

5 files changed

+49
-32
lines changed

docs/platforms/android/user-feedback/configuration/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ import io.sentry.protocol.Feedback;
262262
Feedback feedback = new Feedback("I encountered a bug while using the app.");
263263
feedback.setName("John Doe");
264264
feedback.setContactEmail("[email protected]");
265+
// Optionally associate the feedback with an event
266+
SentryId sentryId = Sentry.captureMessage("My message");
267+
feedback.setAssociatedEventId(sentryId);
265268
Sentry.captureFeedback(feedback);
266269
```
267270
```kotlin
@@ -271,5 +274,8 @@ import io.sentry.protocol.Feedback
271274
val feedback = Feedback("I encountered a bug while using the app.")
272275
feedback.name = "John Doe"
273276
feedback.contactEmail = "[email protected]"
277+
// Optionally associate the feedback with an event
278+
val sentryId = Sentry.captureMessage("My message")
279+
feedback.associatedEventId = sentryId
274280
Sentry.captureFeedback(feedback)
275281
```

docs/platforms/android/user-feedback/index.mdx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ import io.sentry.protocol.Feedback;
7373
Feedback feedback = new Feedback("I encountered a bug while using the app.");
7474
feedback.setName("John Doe");
7575
feedback.setContactEmail("[email protected]");
76+
// Optionally associate the feedback with an event
77+
SentryId sentryId = Sentry.captureMessage("My message");
78+
feedback.setAssociatedEventId(sentryId);
7679
Sentry.captureFeedback(feedback);
7780
```
7881
```kotlin
@@ -82,5 +85,8 @@ import io.sentry.protocol.Feedback
8285
val feedback = Feedback("I encountered a bug while using the app.")
8386
feedback.name = "John Doe"
8487
feedback.contactEmail = "[email protected]"
88+
// Optionally associate the feedback with an event
89+
val sentryId = Sentry.captureMessage("My message")
90+
feedback.associatedEventId = sentryId
8591
Sentry.captureFeedback(feedback)
8692
```

docs/platforms/java/common/user-feedback/index.mdx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@ description: "Learn more about collecting user feedback when an event occurs. Se
55
sidebar_order: 6000
66
---
77

8-
When a user experiences an error, Sentry provides the ability to collect additional feedback. You can collect feedback according to the method supported by the SDK.
8+
The User Feedback feature allows you to collect user feedback from anywhere inside your application at any time, without needing an error event to occur first.
9+
10+
<Alert>
11+
If you're using a self-hosted Sentry instance, you'll need to be on version 24.4.2 or higher in order to use the full functionality of the User Feedback feature. Lower versions may have limited functionality.
12+
Ensure you are using the Java SDK version 8.12.0 or above of the SDK to access the latest features.
13+
</Alert>
914

1015
## User Feedback API
1116

12-
The user feedback API allows you to collect user feedback while utilizing your own UI. You can use the same programming language you have in your app to send user feedback. In this case, the SDK creates the HTTP request so you don't have to deal with posting data via HTTP.
17+
The User Feedback API allows you to collect user feedback while using your own UI components.
1318

14-
Sentry pairs the feedback with the original 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 <PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink> or the return value of the method capturing an event.
19+
Sentry can optionally pair the 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 <PlatformLink to="/configuration/options/#before-send"><PlatformIdentifier name="before-send" /></PlatformLink> or the return value of the method capturing an event.
1520

1621
<PlatformContent includePath="user-feedback/sdk-api-example/" />
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
```java
22
import io.sentry.Sentry;
3-
import io.sentry.UserFeedback;
3+
import io.sentry.protocol.Feedback;
44

5+
Feedback feedback = new Feedback("I encountered a bug while using the app.");
6+
feedback.setName("John Doe");
7+
feedback.setContactEmail("[email protected]");
8+
// Optionally associate the feedback with an event
59
SentryId sentryId = Sentry.captureMessage("My message");
10+
feedback.setAssociatedEventId(sentryId);
611

7-
UserFeedback userFeedback = new UserFeedback(sentryId);
8-
userFeedback.setComments("It broke.");
9-
userFeedback.setEmail("[email protected]");
10-
userFeedback.setName("John Doe");
11-
Sentry.captureUserFeedback(userFeedback);
12+
Sentry.captureFeedback(feedback);
1213
```
13-
14-
```kotlin
14+
```kotlin {tabTitle:Kotlin}
1515
import io.sentry.Sentry
16-
import io.sentry.UserFeedback
16+
import io.sentry.protocol.Feedback
1717

18+
val feedback = Feedback("I encountered a bug while using the app.")
19+
feedback.name = "John Doe"
20+
feedback.contactEmail = "[email protected]"
21+
// Optionally associate the feedback with an event
1822
val sentryId = Sentry.captureMessage("My message")
23+
feedback.associatedEventId = sentryId
1924

20-
val userFeedback = UserFeedback(sentryId).apply {
21-
comments = "It broke."
22-
23-
name = "John Doe"
24-
}
25-
Sentry.captureUserFeedback(userFeedback)
25+
Sentry.captureFeedback(feedback)
2626
```
Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
11
```java
22
import io.sentry.Sentry;
3-
import io.sentry.UserFeedback;
3+
import io.sentry.protocol.Feedback;
44

5+
Feedback feedback = new Feedback("I encountered a bug while using the app.");
6+
feedback.setName("John Doe");
7+
feedback.setContactEmail("[email protected]");
8+
// Optionally associate the feedback with an event
59
SentryId sentryId = Sentry.captureMessage("My message");
10+
feedback.setAssociatedEventId(sentryId);
611

7-
UserFeedback userFeedback = new UserFeedback(sentryId);
8-
userFeedback.setComments("It broke.");
9-
userFeedback.setEmail("[email protected]");
10-
userFeedback.setName("John Doe");
11-
Sentry.captureUserFeedback(userFeedback);
12+
Sentry.captureFeedback(feedback);
1213
```
13-
1414
```kotlin {tabTitle:Kotlin}
1515
import io.sentry.Sentry
16-
import io.sentry.UserFeedback
16+
import io.sentry.protocol.Feedback
1717

18+
val feedback = Feedback("I encountered a bug while using the app.")
19+
feedback.name = "John Doe"
20+
feedback.contactEmail = "[email protected]"
21+
// Optionally associate the feedback with an event
1822
val sentryId = Sentry.captureMessage("My message")
23+
feedback.associatedEventId = sentryId
1924

20-
val userFeedback = UserFeedback(sentryId).apply {
21-
comments = "It broke."
22-
23-
name = "John Doe"
24-
}
25-
Sentry.captureUserFeedback(userFeedback)
25+
Sentry.captureFeedback(feedback)
2626
```

0 commit comments

Comments
 (0)