diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 81f46c9..7cdcf8e 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -196,7 +196,7 @@
android:value="false" />
+ android:value="https://f35f7f369a254b2ca854cf9593c99da2@sentry.androidacy.com/7" />
{
try {
- HttpURLConnection connection = (HttpURLConnection) new URL("https" + "://sentry.io/api/0/projects/androidacy-i6/foxmmm/user-feedback/").openConnection();
+ HttpURLConnection connection = (HttpURLConnection) new URL("https" + "://sentry.androidacy.com/api/0/projects/sentry/foxmmm/user-feedback/").openConnection();
connection.setRequestMethod("POST");
connection.setRequestProperty("Content-Type", "application/json");
connection.setRequestProperty("Authorization", "Bearer " + BuildConfig.SENTRY_TOKEN);
// Setups the JSON body
- if (nameString[0].equals(""))
- nameString[0] = "Anonymous";
- if (emailString[0].equals(""))
- emailString[0] = "Anonymous";
+ if (nameString[0].equals("")) nameString[0] = "Anonymous";
+ if (emailString[0].equals("")) emailString[0] = "Anonymous";
JSONObject body = new JSONObject();
body.put("event_id", lastEventId);
body.put("name", nameString[0]);
@@ -121,22 +125,27 @@ public class CrashHandler extends FoxActivity {
outputStream.write(body.toString().getBytes());
outputStream.flush();
outputStream.close();
+ // get response body
+ byte[] response;
+ if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.TIRAMISU) {
+ response = connection.getInputStream().readAllBytes();
+ // convert response to string
+ String responseBody = new String(response);
+ // log the response body
+ Timber.d("Response Body: %s", responseBody);
+ }
// close and disconnect the connection
connection.getInputStream().close();
connection.disconnect();
// For debug builds, log the response code and response body
- if (BuildConfig.DEBUG) {
- Timber.d("Response Code: %s", connection.getResponseCode());
- }
+ Timber.d("Response Code: %s", connection.getResponseCode());
// Check if the request was successful
if (connection.getResponseCode() == 200) {
runOnUiThread(() -> Toast.makeText(this, R.string.sentry_dialogue_success, Toast.LENGTH_LONG).show());
} else {
runOnUiThread(() -> Toast.makeText(this, R.string.sentry_dialogue_failed_toast, Toast.LENGTH_LONG).show());
}
- } catch (
- JSONException |
- IOException ignored) {
+ } catch (JSONException | IOException ignored) {
// Show a toast if the user feedback could not be submitted
runOnUiThread(() -> Toast.makeText(this, R.string.sentry_dialogue_failed_toast, Toast.LENGTH_LONG).show());
}
@@ -185,7 +194,7 @@ public class CrashHandler extends FoxActivity {
builder.setMessage(R.string.reset_app_confirmation);
builder.setPositiveButton(R.string.reset, (dialog, which) -> {
// reset the app
- MainApplication.getINSTANCE().resetApp();
+ MainApplication.getINSTANCE().resetApp();
});
builder.setNegativeButton(R.string.cancel, (dialog, which) -> {
// do nothing
@@ -207,8 +216,7 @@ public class CrashHandler extends FoxActivity {
new Thread(() -> {
try {
Thread.sleep(1000);
- } catch (
- InterruptedException e) {
+ } catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
runOnUiThread(() -> view.setBackgroundResource(R.drawable.baseline_copy_all_24));
diff --git a/app/src/main/java/com/fox2code/mmm/utils/sentry/SentryMain.java b/app/src/main/java/com/fox2code/mmm/utils/sentry/SentryMain.java
index 7facc2d..798c6f4 100644
--- a/app/src/main/java/com/fox2code/mmm/utils/sentry/SentryMain.java
+++ b/app/src/main/java/com/fox2code/mmm/utils/sentry/SentryMain.java
@@ -32,8 +32,10 @@ public class SentryMain {
SharedPreferences.Editor editor = MainApplication.getINSTANCE().getSharedPreferences("sentry", Context.MODE_PRIVATE).edit();
editor.putString("lastExitReason", "crash");
editor.putLong("lastExitTime", System.currentTimeMillis());
+ editor.putString("lastExitReason", "crash");
+ editor.putString("lastExitId", String.valueOf(Sentry.getLastEventId()));
editor.apply();
- Timber.e(throwable, "Uncaught exception");
+ Timber.e("Uncaught exception with sentry ID %s and stacktrace %s", Sentry.getLastEventId(), throwable.getStackTrace());
// open crash handler and exit
Intent intent = new Intent(mainApplication, CrashHandler.class);
// pass the entire exception to the crash handler