Skip to main content

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? It's 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.


Source: Tips4allCCNA FINAL EXAM

Comments

  1. 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.

    ReplyDelete
  2. Simplest chnages for that would be to define one custom Class say MyLog, now replace all the calls of Log.d() to MyLog.d().
    Now inside your class you can have one flag that can enable or disable logs.
    hope this helps.

    ReplyDelete
  3. A good practice is to use something like if (DEBUG) Log.whatever, and then simply make DEBUG false.

    There is no real danger except that you may expose some underlying implementaion which may expose glitches and hackable points in you app. The real problem is the performance penalty that you will get from logging too much.

    As for android:debuggable="true", search for it in here

    Finally, yes, Logcat logs are global and can be seen by anyone using the Android SDK.

    ReplyDelete
  4. Yep, most certainly. Everyone can see them.

    If you don't want that to happen, delete them from your code. It's quite normal though. I see a lot of apps using logs, and odds are that almost none of your users will be using that to check your logs.

    ReplyDelete

Post a Comment

Popular posts from this blog

Why is this Javascript much *slower* than its jQuery equivalent?

I have a HTML list of about 500 items and a "filter" box above it. I started by using jQuery to filter the list when I typed a letter (timing code added later): $('#filter').keyup( function() { var jqStart = (new Date).getTime(); var search = $(this).val().toLowerCase(); var $list = $('ul.ablist > li'); $list.each( function() { if ( $(this).text().toLowerCase().indexOf(search) === -1 ) $(this).hide(); else $(this).show(); } ); console.log('Time: ' + ((new Date).getTime() - jqStart)); } ); However, there was a couple of seconds delay after typing each letter (particularly the first letter). So I thought it may be slightly quicker if I used plain Javascript (I read recently that jQuery's each function is particularly slow). Here's my JS equivalent: document.getElementById('filter').addEventListener( 'keyup', function () { var jsStart = (new Date).getTime()...

Is it possible to have IF statement in an Echo statement in PHP

Thanks in advance. I did look at the other questions/answers that were similar and didn't find exactly what I was looking for. I'm trying to do this, am I on the right path? echo " <div id='tabs-".$match."'> <textarea id='".$match."' name='".$match."'>". if ($COLUMN_NAME === $match) { echo $FIELD_WITH_COLUMN_NAME; } else { } ."</textarea> <script type='text/javascript'> CKEDITOR.replace( '".$match."' ); </script> </div>"; I am getting the following error message in the browser: Parse error: syntax error, unexpected T_IF Please let me know if this is the right way to go about nesting an IF statement inside an echo. Thank you.