How can an Android Service know that its not bound to any Activities
- by tunneling
I have an Android Service that I would like to keep running even after the last Activity has been popped off the stack, or the User has chosen to do something else.
Essentially the Service is listening for changes on a remote server, and I would like to generate a Notification if and only if an Activity from the app isn't running(or visible). In other words, I don't want the Notifications to occur while the User is directly interacting with the app.
In the case where the User is directly interacting with the app, the Service will notify the Activity and update appropriate UI elements based on the changes. I plan to implement this through the Observer pattern.
How can the Service know if none of apps Activities are bound to it?
Thanks,
J