Skip to content
This repository was archived by the owner on Aug 30, 2023. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
adding strict mode to app sample
  • Loading branch information
Manoel Aranda Neto committed Oct 29, 2019
commit a3d3d0f95dd2b997a2409e3dda715d55ff27534b
17 changes: 17 additions & 0 deletions sentry-sample/src/main/java/io/sentry/sample/MainActivity.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package io.sentry.sample;

import android.os.Bundle;
import android.os.StrictMode;
import androidx.appcompat.app.AppCompatActivity;
import io.sentry.core.Sentry;
import timber.log.Timber;
Expand All @@ -9,6 +10,9 @@ public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
// ideally Application class
districtMode();

super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);

Expand All @@ -34,4 +38,17 @@ protected void onCreate(Bundle savedInstanceState) {
Sentry.captureException(new Exception("Some exception."));
});
}

private void districtMode() {
// https://developer.android.com/reference/android/os/StrictMode
// StrictMode is a developer tool which detects things you might be doing by accident and
// brings them to your attention so you can fix them.

if (BuildConfig.DEBUG) {
StrictMode.setThreadPolicy(
new StrictMode.ThreadPolicy.Builder().detectAll().penaltyLog().build());

StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build());
}
}
}