StrictMode.detectAll()

September 18, 2015

You can use StrictMode to catch mistakes earlier on in the development cycle. It’s especially useful for catching accidental disk or network I/O on the main thread.

Set up StrictMode in your Application’s onCreate().

    if (BuildConfig.DEBUG) {
      StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
          .detectAll()
          .penaltyLog()
          .penaltyDeath()
          .build());
      StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
          .detectAll()
          .penaltyLog()
          .penaltyDeath()
          .build());
    }

Consider developing with StrictMode set to detectAll()

See


Profile picture
Written by Angus Morton.
I builds things.