I need to create an android service for my application which requires the killing of a previous service of the same class when a new startservice
method is called.
I need this for loading data from the web to my application. I regularly poll a notifications API and was trying to start a service using the AlarmManager using inexactalarms. I can't seem to destroy it. I wanted a previous instance of a service to be destroyed in case a new one is launched.
I have tried ending the service using stopSelf()
and stopService()
, both don't seem to work.