According to the docs, just binding to a local service doesn't raise the process' importance to the out of memory killer:
http://developer.android.com/guide/topics/fundamentals/processes-and-threads.html#Processes Just having a service does affect the rank somewhat, but having a foreground service does more. Using binding with a local service has, as far as I'm concerned, two benefits: 1) Provides a way to know when the service has actually been started, since it happens asynchronously wrt. startService 2) Is somewhat cleaner. -- K 12 апреля 2012 г. 20:05 пользователь TreKing <[email protected]> написал: > On Wed, Apr 11, 2012 at 2:59 AM, Lindsay Mathieson < > [email protected]> wrote: > >> And kinda wondering whats the point - "public IBinder onBind(Intent >> arg0)" is essentially being used to retrun a reference to the service class >> so its methods can be called directly by the activity. Why not just store a >> reference to the Service in a static global and have the Activity call that >> directly - it would seem much easier. > > > The system can kill your Service instance at any time if it needs memory, > which would suck quite bad if you had a global reference to it. But if you > bind to it, via the provided API, it tells the system "hey, I'm using this > thingy, please don't kill it from under me. k thx bye". > > (This is mostly a guess from my understanding how Android works. Someone > can correct me if I'm wrong.) > > > ------------------------------------------------------------------------------------------------- > TreKing <http://sites.google.com/site/rezmobileapps/treking> - Chicago > transit tracking app for Android-powered devices > > -- > 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 > -- 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

