Hey all, I'm really hoping someone can help me out on this one cause I'm starting to pull my hair out...
I've got a service binding to my main activity. The service is running a media player that is playing music in the background. The service also places a notification in the status bar and connects to a local database to receive track name and url info. I'm having two slightly different problems keeping my service alive. 1) When my main activity is destroyed, my service is getting destroyed along with it. The service's onDestroy get's called, playback stops, the notification gets cleared. How can I avoid this? By playing around with the unbindService(ServiceConnection) method in my activity, I've realized that it is what causes the service to be destroyed. So how can I unbind a service without destroying said service? (I'm also having a similar problem with Alarms set with AlarmManager getting destroyed with the destruction of my activity, but unless you recognize this issue right away, I'll save it for another thread.) 2) When my activity doesn't get destroyed right away (i.e. i exit via the home button instead of the back button) and I start doing other things on the device (or emulator) to take up resources, eventually the music will stop playing, but the icon in the status bar will not change, meaning the service's onDestroy is not even getting called (onDestroy clears the notif icon). I think this means that the service was killed to free memory but how can I react to that or prevent it or increase the importance of the service? I've put the imeem application through the same kind of tests and it does not stop playing even when the phone gets low on resources (however I don't know if they're using the built in MediaPlayer, but I'd assume so). So... any ideas? I think #1 is more important but I also think the 2 issues might be connected. Thanks in advance :) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

