adb shell setprop log.tag.<your logtag> DEBUG
to enable debug level logging.
But what if you want to bring up extra UI-elements, test different algorithms or even use different backends? A valid approach for this is to use a file that (if it exists) puts the App into dev mode. This works well in Android but is also quite static. A more dynamic switch is available by (ab)using the above log level mechanism. Just define a special logger (e.g.
dev-mode
) and check if it is set to debug level logging (using Log.isLoggable
). This allows you to toggle dev-mode
at runtime.
I implemented the above approach for a client who wanted a special dev-version for testing purposes. But in that case the dependence on the AndroidSDK (you need adb) was a concern, so we settled on the property file approach.
If you have any other ideas how to dynamically switch on additional features at runtime, I'd be happy to hear them.