Skip to content

Instantly share code, notes, and snippets.

@pedromassango
Created November 18, 2018 15:19
Show Gist options
  • Save pedromassango/7145a89191953eca039df5c394eafe80 to your computer and use it in GitHub Desktop.
Save pedromassango/7145a89191953eca039df5c394eafe80 to your computer and use it in GitHub Desktop.
Como inicializar StrictMode no android
public void onCreate() {
super.onCreate();
if (DEVELOPER_MODE) {
StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
.detectDiskReads()
.detectDiskWrites()
.detectNetwork() // ou .detectAll()
.penaltyLog()
.build());
StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
.detectLeakedSqlLiteObjects()
.detectLeakedClosableObjects()
.penaltyLog()
.penaltyDeath()
.build());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment