title: How to detect that user is leaving or opening homescreen in Android
body: <p>In my application i need to show on overlay view <strong>only on home screen</strong>. At this moment my overlay view is shown not only on home screen but also on top of any launched activity. Are there any ways of detecting that user is leaving or opening home screen?</p>
  
  <p>My application is developed in the next way:
  I have a Service where i am creating a view and adding it to WindowManager with this flag WindowManager.LayoutParams.TYPE_SYSTEM_ALERT. And i am also have this permission in AndroidManifest </p>