Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Are LogCat calls visible to end users if phone is in debug mode?

I've been using Log.whatever() calls to Log various bits of information as I've been developing my Android app. As I prepare to publish my app to the Android Marketplace, I'm trying to figure out what I need to remove.

According to the Android developer Dev Guide, before publishing, they suggest:

Deactivate any calls to Log methods in the source code.

How does one deactivate the Log methods? Obviously I could go through and erase them all (which is a bit of a pain) but is there some other way to deactivate Log calls that I'm unaware of?

Also, what danger is there to having Log calls in a published application? Can anyone install Eclipse, plugin in their phone and enable Debug mode and see all the same LogCat information that I see as I'm developing?

Also the Dev Guide suggests:

Remove the android:debuggable="true" attribute from the <application> element of the manifest.

I was unaware of this flag until now. What does it do exactly? I've been developing and debugging my app just fine up to this point and this flag is not set to true or false for in my Manifest.

like image 665
Jake Wilson Avatar asked Oct 04 '11 20:10

Jake Wilson


1 Answers

Yes, anyone can install the Android SDK (with or without Eclipse) to view all log messages on your device.

I don't recommend completely removing your logging code, but instead wrap it, such as: if (DEBUG) Log.d(...) where DEBUG is some static boolean you define in a convenient place. I prefer to create a utility class so that all log calls across various classes can be enabled/disabled at once.

like image 122
mah Avatar answered Oct 19 '22 01:10

mah