title: How it is possible Service run indefinitely and also allow binding in android?
body: <p>I want  a service which can run in the background until I stop, even if the component that started it is destroyed and also allows binding to the activities. How it is possible ? </p>
  
  <p>As per android bound services document - there are three ways of creating bound service</p>
  
  <ol>
  <li>Extending Binder class.</li>
  <li>Using Messenger. </li>
  <li>Using AIDL.</li>
  </ol>
  
  <p>I have created a bound service using messenger (2nd method). Activity is bind to service in its onStart() method and unbind in its onStop() method. Two way messaging (between activity and service) works properly. But problem is that when activity unbinds service, service is destroyed. But I want a service which can run indefinitely. </p>
  
  <p>It is possible as android <a href="http://developer.android.com/guide/topics/fundamentals/services.html">Services Dev Guide</a> - "Although this documentation generally discusses these two types of services separately, your service can work both ways—it can be started (to run indefinitely) and also allow binding. It's simply a matter of whether you implement a couple callback methods: onStartCommand() to allow components to start it and onBind() to allow binding."</p>
  
  <p>I also implement onStartCommand() method in service and return START_STICKY, but it is never called. Looking at the lifecycle callbacks of bounded service in dev guide, there is no onStartCommand() callback method. Then how it is possible to run service until we stop and also allow binding?</p>
  
  <p>I am using eclipse platform in fedora 15 OS.</p>
  
  <p>Any Help.....</p>