Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

I'm making a parental control/accountability app for android. It consists of a monitoring service that runs in the background and starts when the phone is booted.

Unfortunately, I have found that when android is started in "Safe Mode", services are not started automatically, and because of this my app has a serious flaw.

While in safe mode, the web and other apps can be started without my monitoring service running.

I thought that if it isn't possible to monitor app activity while in safe mode, maybe I could at least have my app detect if the phone was previously in safe mode. Then it could maybe alert the parent or accountability partner?

Does Android keep any log of this? Or any boot log in general? I'm very open to suggestions and alternatives.

share|improve this question
1  
I'm very much hoping that there's no way to do this. –  Richard Borcsik Jul 18 '12 at 19:44
3  
I think this shouldn't be closed. Developers are not the only ones who could be interested in this. –  Richard Borcsik Jul 18 '12 at 21:01
    
I agree with @Richard. This isn't specifically a coding question, but about how Android works. –  Al E. Jul 19 '12 at 13:02
add comment

2 Answers

I think you have caught yourself out, in short, nothing you can do!

Have a look at this source that explains why, specifically in this section:

System Partition and Safe Mode

The system partition contains Android's kernel as well as the operating system libraries, application runtime, application framework, and applications. This partition is set to read-only. When a user boots the device into Safe Mode, only core Android applications are available. This ensures that the user can boot their phone into an environment that is free of third-party software.

Keywords is free of third-party software

Edit:

When Android boots up, it keeps a cache of the logcat, in a temporary buffer that is reserved found in /dev/log. That buffer gets recycled when it hits the threshold, obviously, the bigger the threshold, the slower Android gets with the continual spamming into the logcat buffer hence kept to minimum - iirc, its around 64K:

#define DEFAULT_LOG_ROTATE_SIZE_KBYTES 16
#define DEFAULT_MAX_ROTATED_LOGS 4

Source: system/core/logcat/logcat.cpp

Do not ask how many lines that can be, as to each and to every app, its different. Not alone that, the logcat disappears upon reboot!

share|improve this answer
2  
You didn't really answer the question you just restated what he knew, that his app can't monitor during safe mode. Add something about the safe mode logs or alternatives and then +1 –  Peanut Jul 18 '12 at 20:21
1  
@Peanut, Android will still log the logcat, but only the core services, nothing else! There's no alternative to that! And there is no way for third party apps to recognize that there was a safe mode activated because, next time coming out of safe mode i.e. reboot normally,third party apps "think" nothing has happened as in "nothing to see here... move along" –  t0mm13b Jul 18 '12 at 20:22
1  
Sorry I edited my comment before seeing your comment, but as I said you didn't really answer his question. So an alternative would be to check if the logcat was running when his app wasn't? Obviously this would require the person to start it up not in safe mode at some point but at least it's a realistic solution. –  Peanut Jul 18 '12 at 20:25
    
The logcat contents... are flushed out to /dev/null upon reboot as like "business as usual"... just saying.. :) And thanks for the downvote! –  t0mm13b Jul 18 '12 at 20:28
    
Ah, I wasn't aware of that ^^ I'll up vote since you offer an answer to his question here :) I think you should add the stuff about the logs to your actual answer though. edit: Oh, I can't actually upvote till you edit the answer :p –  Peanut Jul 18 '12 at 20:32
show 1 more comment

Not the best answer but maybe the information will be some what useful.

The only method I'm aware of that contains a log produced by the system after a reboot is /proc/last_kmsg.

Whether or not the kernel keeps this log file after a reboot, depends on settings provided during kernel compilation.

My experience has shown that some stock devices (HTC) have this logging enabled and others do not. I haven't seen a consistent pattern.

share|improve this answer
    
Thank you! Where did you learn about this log? Do you have any suggestions as to how I can learn about more of these logs? Is there a reference somewhere? –  jws121295 Aug 10 '12 at 11:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.