Skip to content

Instantly share code, notes, and snippets.

@svareniem
Created February 19, 2016 03:18
Show Gist options
  • Save svareniem/6fbcc0ffcf7968ee122a to your computer and use it in GitHub Desktop.
Save svareniem/6fbcc0ffcf7968ee122a to your computer and use it in GitHub Desktop.
Enable Strict Mode in Application onCreate()
protected void enableStrictMode() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDeath()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog()
.penaltyDeath()
.build());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment