Skip to content

Instantly share code, notes, and snippets.

@xalexchen
Created March 27, 2014 07:53
Show Gist options
  • Save xalexchen/9802470 to your computer and use it in GitHub Desktop.
Save xalexchen/9802470 to your computer and use it in GitHub Desktop.
enableStrictMode
public static void enableStrictMode() {
if (PlatformUtils.hasGingerbread()) {
StrictMode.ThreadPolicy.Builder threadPolicyBuilder =
new StrictMode.ThreadPolicy.Builder()
.detectAll()
.penaltyLog();
StrictMode.VmPolicy.Builder vmPolicyBuilder =
new StrictMode.VmPolicy.Builder()
.detectAll()
.penaltyLog();
if (PlatformUtils.hasHoneycomb()) {
threadPolicyBuilder.penaltyFlashScreen();
}
StrictMode.setThreadPolicy(threadPolicyBuilder.build());
StrictMode.setVmPolicy(vmPolicyBuilder.build());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment