title: How to detect when the user launches another app? (Android)
body: <p>I'm trying to build an application where my application runs in the background and detects when the user launches another application so that I can control the flow from thereon.
  To illustrate my query, I'd like to specify an example. 
  My application is running in the background (say as a Service), and the user has just clicked on application 'XYZ'. Is it possible for my app to detect that app 'XYZ' has been launched?
  More than just detecting whether 'XYZ's Activity has come to the foreground,I want to detect whther 'XYZ' has been launched or not. Say someone launches 'Whatsapp Messenger', I want to know if my app can know that 'Whatsapp Messenger' has been launched.</p>
  
  <p>EDIT : A lot of people think I'm trying to build malware, but I'm not. I'm trying to build an app for a high school project. I want a stat to see how often I use my camera as part of a psych project. :/</p>
  
  <p>Thanks in advance,
  Sumit.</p>