Android StrictMode Set activateStrictMode()

Here you can find the source of activateStrictMode()

Description

activate Strict Mode

License

Open Source License

Declaration

public static void activateStrictMode() 

Method Source Code




import android.os.StrictMode;

public class Main {
    public static void activateStrictMode() {
        if (isDebugBuild()) {
            StrictMode//from  w w  w  . j  ava 2s.  c  o  m
                    .setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
                    
                            .detectDiskReads()
                            
                            .detectNetwork().penaltyLog()
                            
                            .build());
            StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
                    .detectLeakedSqlLiteObjects()
                    .detectLeakedClosableObjects().penaltyLog()
                    .detectActivityLeaks()
                    .detectLeakedRegistrationObjects()
                    
                    .build());
        }
    }

    public static boolean isDebugBuild() {
        
        return false; 
    }
}

Related

  1. setStrictMode()