title: Advice on interactions between service, activity, and notifications
body: <p>I am implementing a Service which will start when MainActivity starts. This service checks for and maintains a network connection.</p>
  
  <p>I have not bound the Service to the Activity because I want the service to continue running even if the activity isn't available. The Service will receive messages from the server that it is connected to.</p>
  
  <p>I am struggling to choose the best logic to do the following when the service receives a message.</p>
  
  <p>Check if MainActivity is currently open and in front of the user</p>
  
  <p>If it is call some methods in the activity to interact with the UI</p>
  
  <p>If there is no activity update the notification are.</p>
  
  <p>My question is;</p>
  
  <p>How do I correctly check if the activity is running in the UI from my service? I know that I could bind the service but I wouldn't want to unbind it if the activity is closed. Would that be a problem?</p>
  
  <p>I will somehow need to send messages from the service to the activity. Given the above scenario what would be the best way to do this?</p>