I'm writing a SIP application using an SDK. My application has many Activities and so I initialise and shutdown the SDK using a service's onCreate and onDestroy methods so that I can run it for the duration of my Application (not just an individual Activity).
The example application I'm working from calls startService and then just leaks the service - I don't want to do this but I'm not sure that I have an alternative.
What I would like to do is bind to the service using Context.BIND_AUTO_CREATE in my Activity base class's OnCreate method and unbind in OnDestroy. All of my Activities extend from this, so I would then have the Service available in all of my Activities.
But, what happens when the configuration changes or I switch activities? Does the service get aggressively killed in the brief period between activities, or is there a guarantee that it won't? If it's the former, doesn't that slightly cripple the use of services? What design pattern should I be using to make something persist for exactly the lifetime of my Application?