views:

68

answers:

1

Is there a way to send -D directives to an android app? On desktop java I would just do java -Dsomeflag=value.

How would you do this on android? I am building with eclipse.

+2  A: 

I assume you want to do this because you want to have conditional if blocks for debugging. You can set android:debuggable="true" in your manifest:

<application android:icon="@drawable/icon" 
    android:name=".SomeApp"
    android:label="@string/app_name" android:debuggable="true">

and then test for it like this:

if(Log.isLoggable(TAG, Log.DEBUG)) {
    Log.d(TAG, "some log statement");
}
synic
You are correct this is for debug code. Does this flag carry onto an actual device?
Maven
Yes, it does carry onto devices.
synic