Battery saving strategy for a long running IPC service
<p>I read this great blog article <a href="http://mindtherobot.com/blog/37/android-architecture-tutorial-developing-an-app-with-a-background-service-using-ipc/" rel="nofollow">Android Architecture Tutorial: Developing an App with a Background Service (using IPC)</a></p>

<p>The author show a tweet retrieving service running within a fixed interval in a separate process. </p>

<p>The service will keep running infinity. I realize to stop the process, going to <strong>Manage App</strong> and stop the service explicitly is the only way.</p>

<p>Note, this is not a very battery friendly way. Even the author claims himself.</p>

<blockquote>
  <p>Yes, there is a dark side to Android background services too – too
  many services doing too much stuff in the background will slow down
  the phone and suck the battery. However it’s not quite what I wanted
  to bring up in this post, so maybe we’ll come back to resource
  management etiquette in yet another post.</p>
</blockquote>

<p>However, the author no longer update his blog.</p>

<p>I try to stop the service through <code>TweetViewActivity</code>.</p>

<pre><code>@Override
protected void onDestroy() {
    super.onDestroy();              

    try {
        api.removeListener(collectorListener);
        unbindService(serviceConnection);
    } catch (Throwable t) {
        // catch any issues, typical for destroy routines
        // even if we failed to destroy something, we need to continue destroying
        Log.w(TAG, "Failed to unbind from the service", t);
    }

    // New code added by Cheok. Not working. Not sure why.
    this.stopService(intent);

    Log.i(TAG, "Activity destroyed");
}
</code></pre>

<p>But that doesn't work. I can see the service still running. May I know, what is the correct way to stop the IPC service, once I quit the <code>Activity</code>? What is a good battery saving strategy for the above example?</p>
