title: how do android monitor usage applications work
body: <p>I want to write an application that logs the usage of other applications on my phone.<br>
  So for example I get the times I have entered Facebook. </p>
  
  <p>I understand there is no way to get a broadcastreceiver to wake up every time Facebook starts.
  Another way is to have a service that always runs in the background and checks for running apps and goes to sleep every second or so, but I guess this will drain my battery faster.  </p>
  
  <p>So what is the best way this could be done? is there some kind of log I can look at? </p>