Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 33f207d

Browse files
committedAug 13, 2018
Added strictmode to sample app to aid testing
1 parent 42c601c commit 33f207d

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed
 

‎app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<uses-permission android:name="android.permission.INTERNET" />
77

88
<application
9+
android:name=".ANTApplication"
910
android:allowBackup="true"
1011
android:icon="@mipmap/ic_launcher"
1112
android:label="@string/app_name"
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package com.stealthcotper.networktools;
2+
3+
import android.app.Application;
4+
import android.os.StrictMode;
5+
6+
public class ANTApplication extends Application {
7+
8+
@Override
9+
public void onCreate() {
10+
initStrictMode();
11+
super.onCreate();
12+
}
13+
14+
private void initStrictMode() {
15+
if (BuildConfig.DEBUG) {
16+
17+
// Let's be super strict so that we can discover bugs during testing
18+
19+
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
20+
.detectAll()
21+
.penaltyLog()
22+
.penaltyDeath()
23+
.build());
24+
25+
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
26+
.detectAll()
27+
.penaltyLog()
28+
.penaltyDeath()
29+
.build());
30+
}
31+
}
32+
33+
34+
}

0 commit comments

Comments
 (0)
Please sign in to comment.