diff --git a/CHANGELOG.md b/CHANGELOG.md index 43d0b933413..954443542d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # 3.1.2 +* feat: Manually capturing User Feedback * Enhancement: Set environment to "production" by default. # 3.1.1 diff --git a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/sample/MainActivity.java b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/sample/MainActivity.java index a6e424df7f0..eb7980ed739 100644 --- a/sentry-samples/sentry-samples-android/src/main/java/io/sentry/sample/MainActivity.java +++ b/sentry-samples/sentry-samples-android/src/main/java/io/sentry/sample/MainActivity.java @@ -3,6 +3,8 @@ import android.os.Bundle; import androidx.appcompat.app.AppCompatActivity; import io.sentry.Sentry; +import io.sentry.UserFeedback; +import io.sentry.protocol.SentryId; import io.sentry.protocol.User; import io.sentry.sample.databinding.ActivityMainBinding; import java.util.Collections; @@ -22,6 +24,16 @@ protected void onCreate(Bundle savedInstanceState) { binding.sendMessage.setOnClickListener(view -> Sentry.captureMessage("Some message.")); + binding.sendUserFeedback.setOnClickListener(view -> { + SentryId sentryId = Sentry.captureException(new Exception("I have feedback")); + + UserFeedback userFeedback = new UserFeedback(sentryId); + userFeedback.setComments("It broke on Android. I don't know why, but this happens."); + userFeedback.setEmail("john@me.com"); + userFeedback.setName("John Me"); + Sentry.captureUserFeedback(userFeedback); + }); + binding.captureException.setOnClickListener( view -> Sentry.captureException( diff --git a/sentry-samples/sentry-samples-android/src/main/res/layout/activity_main.xml b/sentry-samples/sentry-samples-android/src/main/res/layout/activity_main.xml index 54cac756107..b1d82bbb0d7 100644 --- a/sentry-samples/sentry-samples-android/src/main/res/layout/activity_main.xml +++ b/sentry-samples/sentry-samples-android/src/main/res/layout/activity_main.xml @@ -16,7 +16,13 @@ android:id="@+id/send_message" android:text="@string/send_message"/> -