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.
1 comment:
I look for a file in /sdcard/.myapp/config.json which contains additional settings. That allows not only dev mode, but also setting proxy servers, timeouts and other relevant behaviour.
Sadly the same approach on iOS can't be used. There the application sandbox has to be edited (like /data on Android). At one point I did toy with media filenames (eg your music library having a song titled "My-App-Debug-Mode-is-3").
Post a Comment