2

I was wondering if it's possible to read a value from the Android manifest file programmatically. More specifically, I was wondering if the below pseudo-code is possible.

public void DebugLog(String label, String message) {
    // Display log messages only when debugging, i.e. not in the release product
    if (AndroidManifest.debuggable)
        Log.d(label, message);
}

Thanks

Dan
  • 842
  • 3
  • 17
  • 29

1 Answers1

4

Here is how to check if the debuggable attribute is set in the manifest:

boolean isDebuggable = (0 != (getApplicationInfo().flags & ApplicationInfo.FLAG_DEBUGGABLE));

Shamelessly stolen from here:
https://stackoverflow.com/a/4277868/483708

Community
  • 1
  • 1
Theo
  • 5,963
  • 3
  • 38
  • 56