Skip to content

Instantly share code, notes, and snippets.

@engincancan
Forked from amitshekhariitbhu/StrictMode.java
Created March 1, 2017 11:26
Show Gist options
  • Save engincancan/7613538e9715d9a4a2c0ce26ec46e3c8 to your computer and use it in GitHub Desktop.
Save engincancan/7613538e9715d9a4a2c0ce26ec46e3c8 to your computer and use it in GitHub Desktop.
public void onCreate() {
if (DEVELOPER_MODE) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork() // or .detectAll() for all detectable problems
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build());
}
super.onCreate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment