Advice on interactions between service, activity, and notifications

view story

http://stackoverflow.com – I am implementing a Service which will start when MainActivity starts. This service checks for and maintains a network connection. 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. I am struggling to choose the best logic to do the following when the service receives a message. Check if MainActivity is currently open and in front of the user If it is call some methods in the activity to interact with the UI If there is no activity updat (HowTos)