title: How can Service determine, if UI visible now
body: <p>I try to make Notification which must work only when Application UI <strong>isn't</strong> visible.
  I tried to store preference which was written in <code>onStart()</code> and <code>onStop()</code> of my <code>Activity</code>. But sometimes, it's not working because another application became visible without <code>MyActivity.onStop()</code> being called.</p>
  
  <p>What other method I can use for a Service to determine, if MyApplication is visible now?  Or, maybe MyActivity?</p>