I want to implement a Service that acts like a Singleton.
I need my App to check if the screen is locked, then start a Listener IntentService. If the screen becomes unlocked, it will kill the Listener service.
I created a ScreenLockService that is an IntentService and is called by the Home activity if the user checked the on/off box because I want the Listener to run even if the the App isn't running.
So the Home activity runs and stops the ScreenLockService service which will run and stop the Listener service.
My problem is that the Home Activity creates multiple instances of ScreenLockService which also creates multiple instances of Listener.
So I'd like to have these two IntentServices run as Singletons, but I'm not sure how to do so.
I've checked out a bunch of tutorials, but they're either out dated or not tailored to IntentServices such as: http://www.devahead.com/blog/2011/06/extending-the-android-application-class-and-dealing-with-singleton/ Singleton in Android
I can post some example code of what I have if necessary, but all I'm really looking for is a how-to.