-
-
Notifications
You must be signed in to change notification settings - Fork 468
Expand file tree
/
Copy pathMyApplication.java
More file actions
42 lines (36 loc) · 1.28 KB
/
MyApplication.java
File metadata and controls
42 lines (36 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package io.sentry.samples.android;
import android.app.Application;
import android.os.StrictMode;
import io.sentry.Sentry;
/** Apps. main Application. */
public class MyApplication extends Application {
@Override
public void onCreate() {
Sentry.startProfiler();
strictMode();
super.onCreate();
// Example how to initialize the SDK manually which allows access to SentryOptions callbacks.
// Make sure you disable the auto init via manifest meta-data: io.sentry.auto-init=false
// SentryAndroid.init(
// this,
// options -> {
// /*
// use options, for example, to add a beforeSend callback:
//
// options.setBeforeSend((event, hint) -> {
// process event
// });
// */
// });
}
private void strictMode() {
// 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());
}
}
}