title: a way to programmatically know when an application is in "opened" state on android?
body: <p>I wanted to know if there's a way to programmatically get the "opened" application name or something from a background Service. Is it? Like let me give you an example:</p>
  
  <pre><code>if(Apps.FACEBOOK_STATUS_OPENED == currentApplication.getStatus()) { 
     ...
     do something in the service for this app 
  }else if(Apps.WHATSAPP_STATUS_OPENED == currentApplication.getStatus()) {
     ...
     do another thing for this app
  }...
  </code></pre>
  
  <p>Is there a way to listen to that? There must be.</p>
  
  <p>Thanks in advance.</p>