package net.rdrei.android.wakimail;

import org.acra.ACRA;
import org.acra.annotation.ReportsCrashes;

import android.app.Application;
import android.os.StrictMode;

/**
 * Sets up settings that are required for the application to run.
 * 
 * @author pascal
 */
@ReportsCrashes(formUri = "http://www.bugsense.com/api/acra?api_key=2b0a6e7c", formKey = "")
public class WAKiMailApplication extends Application {
	@Override
	public void onCreate() {
		super.onCreate();

		if (BuildConfig.DEBUG) {
			enableStrictMode();
		} else {
			// Only if DEBUG is disabled.
			ACRA.init(this);
		}
	}

	private void enableStrictMode() {
		StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder()
				.detectAll().penaltyLog().build());
		StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder()
				.detectLeakedSqlLiteObjects()
				// Only on 11+ if I'm not mistaken.
				.detectLeakedClosableObjects().penaltyLog().penaltyDeath()
				.build());
	}
}

@@ -128,16 +128,59 @@
 cation;%0A
+import android.content.pm.ApplicationInfo;%0A
 import a
@@ -514,25 +514,22 @@
 if (
-BuildConfig.DEBUG
+isDebuggable()
 ) %7B%0A
@@ -619,16 +619,16 @@
 s);%0A
-
 %09%09%7D%0A%09%7D%0A%0A
 %09pri
@@ -623,16 +623,186 @@
 %09%09%7D%0A%09%7D%0A%0A
+%09private boolean isDebuggable() %7B%0A%09%09final int applicationFlags = this.getApplicationInfo().flags;%0A%09%09return (applicationFlags & ApplicationInfo.FLAG_DEBUGGABLE) != 0;%0A%09%7D%0A%0A
 %09private

Use portable way to detect DEBUG mode