title: SendBroadcast if Activity or Notification
body: <p>I have an application that downloads data in a background service and I want to be able to update an activity UI if they are currently running the application or trigger a Notification if they are not.</p>
  
  <p>How do I know if the application is currently in the foreground?</p>
  
  <p>I could register a BroadcastReceiver inner class in the activity and trigger this if its in the foreground otherwise uses notification but I don't know how I can check what action to take.</p>
  
  <p>Thanks for any replies.</p>